/*
* JavaInspect - Utility to visualize java software
- * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Copyright (C) 2013-2017, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public License
public class FieldDescriptor implements GraphElement {
- private final ClassDescriptor parentClass;
+ private final ClassDescriptor parentClassDescriptior;
private final List<ClassDescriptor> typeArguments = new ArrayList<ClassDescriptor>();
private String name;
private ClassDescriptor type;
private boolean isInherited;
public FieldDescriptor(final ClassDescriptor parent) {
- parentClass = parent;
+ parentClassDescriptior = parent;
}
public void analyzeField(final Field field) {
if (!field.getDeclaringClass().getName()
- .equals(parentClass.getFullyQualifiedName()))
+ .equals(parentClassDescriptior.getFullyQualifiedName()))
isInherited = true;
name = field.getName();
- type = parentClass.getClassGraph().getOrCreateClassDescriptor(
+ type = parentClassDescriptior.getClassGraph().getOrCreateClassDescriptor(
field.getType());
type.registerReference();
- final Type genericType = field.getGenericType();
- if (genericType instanceof ParameterizedType) {
- final ParameterizedType pt = (ParameterizedType) genericType;
- for (final Type t : pt.getActualTypeArguments())
- if (t instanceof Class) {
- final Class cl = (Class) t;
- final ClassDescriptor genericTypeDescriptor = parentClass
- .getClassGraph().getOrCreateClassDescriptor(cl);
+ final Type fieldGenericType = field.getGenericType();
+ if (fieldGenericType instanceof ParameterizedType) {
+ final ParameterizedType fieldParameterizedGenericType = (ParameterizedType) fieldGenericType;
+ for (final Type type : fieldParameterizedGenericType.getActualTypeArguments())
+ if (type instanceof Class) {
+ final Class aClass = (Class) type;
+ final ClassDescriptor genericTypeDescriptor = parentClassDescriptior
+ .getClassGraph().getOrCreateClassDescriptor(aClass);
genericTypeDescriptor.registerReference();
typeArguments.add(genericTypeDescriptor);
}
// main type
boolean showLink = type.areReferencesShown();
- if (type == parentClass)
+ if (type == parentClassDescriptior)
showLink = false;
- if (parentClass.isEnum)
+ if (parentClassDescriptior.isEnum)
showLink = false;
if (showLink)
final StringBuffer result = new StringBuffer();
result.append(" // " + name + "\n");
- if (parentClass.isEnum && (type == parentClass)) {
+ if (parentClassDescriptior.isEnum && (type == parentClassDescriptior)) {
result.append(" <TR><TD colspan=\"2\" PORT=\"" + name);
result.append("\" ALIGN=\"left\"><FONT POINT-SIZE=\"11.0\">");
result.append(name + "</FONT></TD></TR>\n");
@Override
public String getGraphId() {
- return parentClass.getGraphId() + ":" + name;
+ return parentClassDescriptior.getGraphId() + ":" + name;
}
protected int getOutsideVisibleReferencesCount() {