mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
ApiDispatcher: Get rid of reflections, reuse utils' ReflectUtil
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
539d94b4a6
commit
d760271945
@ -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>
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user