public class ClassDescriptor implements GraphElement, Comparable<ClassDescriptor> {
private static final int MAX_REFERECNES_COUNT = 10;
+ final List<ClassDescriptor> interfaces = new ArrayList<>();
private final Map<String, FieldDescriptor> nameToFieldMap = new TreeMap<>();
- private final SortedSet<MethodDescriptor> methods = new TreeSet<MethodDescriptor>();
+ private final SortedSet<MethodDescriptor> methods = new TreeSet<>();
private final ClassGraph classGraph;
boolean isEnum;
boolean isInterface;
boolean isArray;
- List<ClassDescriptor> interfaces = new ArrayList<ClassDescriptor>();
ClassDescriptor superClass;
private String fullyQualifiedName;
/**
this.classGraph = classGraph;
}
- protected void analyzeClass(final Class<? extends Object> clazz) {
+ protected void analyzeClass(final Class<?> clazz) {
fullyQualifiedName = clazz.getName();
try {
indexFields(clazz.getDeclaredFields());
indexFields(clazz.getFields());
- } catch (NoClassDefFoundError error){
+ } catch (NoClassDefFoundError error) {
// TODO: better logging of this error
System.out.println(error.toString());
}
@Override
public String getGraphId() {
- final String result = "class_"
+
+ return "class_"
+ fullyQualifiedName
.replace('.', '_')
.replace(";", "")
.replace("[[L", "") // array of arrays
.replace("[[[L", "") // array of arrays of arrays
.replace('$', '_');
-
- return result;
}
private String getInterfaceColor() {
return;
}
- return;
}
private void indexFields(final Field[] fields) {
getOrCreateFieldDescriptor(field);
}
- private void indexMethods(final Class<? extends Object> clazz) {
+ private void indexMethods(final Class<?> clazz) {
for (final Method method : clazz.getMethods()) {
final MethodDescriptor methodDescriptor = new MethodDescriptor(
this, method.getName());