cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [42/50] [abbrv] git commit: ApiDispatcher: Get rid of reflections, reuse utils' ReflectUtil
Date Wed, 09 Jan 2013 04:37:22 GMT
ApiDispatcher: Get rid of reflections, reuse utils' ReflectUtil

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d7602719
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d7602719
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d7602719

Branch: refs/heads/master
Commit: d76027194578ab7b12ec33aa8738abec1e9c8fa3
Parents: 539d94b
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Tue Jan 8 18:43:45 2013 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Tue Jan 8 18:54:29 2013 -0800

----------------------------------------------------------------------
 server/pom.xml                              |    5 -----
 server/src/com/cloud/api/ApiDispatcher.java |   16 +++-------------
 2 files changed, 3 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d7602719/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 9e6bc68..64bd2a2 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -80,11 +80,6 @@
       <classifier>tests</classifier>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.reflections</groupId>
-      <artifactId>reflections</artifactId>
-      <version>0.9.8</version>
-    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d7602719/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 60d8836..fa9114e 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -31,6 +31,7 @@ import java.util.StringTokenizer;
 import java.util.regex.Matcher;
 
 import com.cloud.dao.EntityManager;
+import com.cloud.utils.ReflectUtil;
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.InfrastructureEntity;
 import org.apache.cloudstack.acl.Role;
@@ -374,19 +375,8 @@ public class ApiDispatcher {
             }
         }
 
-        // Process all the fields of the cmd object using reflection to recursively process
super class
-        Field[] fields = cmd.getClass().getDeclaredFields();
-        Class<?> superClass = cmd.getClass().getSuperclass();
-        while (BaseCmd.class.isAssignableFrom(superClass)) {
-            Field[] superClassFields = superClass.getDeclaredFields();
-            if (superClassFields != null) {
-                Field[] tmpFields = new Field[fields.length + superClassFields.length];
-                System.arraycopy(fields, 0, tmpFields, 0, fields.length);
-                System.arraycopy(superClassFields, 0, tmpFields, fields.length, superClassFields.length);
-                fields = tmpFields;
-            }
-            superClass = superClass.getSuperclass();
-        }
+        Field[] fields = ReflectUtil.getAllFieldsForClass(cmd.getClass(),
+                new Class<?>[] {BaseCmd.class});
 
         for (Field field : fields) {
             PlugService plugServiceAnnotation = field.getAnnotation(PlugService.class);


Mime
View raw message