X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Finspector%2Fjava%2Fstructure%2FFieldDescriptor.java;h=216267469b10c2469c081f2fd3a2b77dd2a6517a;hb=8886bb51f2caf11b8e778bacb4c8ea18ac7f1027;hp=e4611aa02b6bd1c9797194df7f9185cb2d139976;hpb=39a8ba91a8541b26180cc3c3dcb99f5ff295785d;p=javainspect.git diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java b/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java old mode 100644 new mode 100755 index e4611aa..2162674 --- a/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java +++ b/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java @@ -1,10 +1,10 @@ /* * JavaInspect - Utility to visualize java software - * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Copyright (C) 2013-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. */ package eu.svjatoslav.inspector.java.structure; @@ -17,15 +17,19 @@ import java.util.List; public class FieldDescriptor implements GraphElement { + /** + * This class corresponds to single field within a java class. + */ + public String name; - public ClassDescriptor type; - private ClassDescriptor parent; + private ClassDescriptor type; + private ClassDescriptor parentClass; List typeArguments = new ArrayList(); public FieldDescriptor(final Field field, final ClassDescriptor parent, final ClassGraph dump) { - this.parent = parent; + parentClass = parent; if (!field.getDeclaringClass().getName() .equals(parent.fullyQualifiedName)) @@ -79,10 +83,10 @@ public class FieldDescriptor implements GraphElement { // main type boolean showLink = type.areReferencesShown(); - if (type == parent) + if (type == parentClass) showLink = false; - if (parent.isEnum) + if (parentClass.isEnum) showLink = false; if (showLink) @@ -102,7 +106,7 @@ public class FieldDescriptor implements GraphElement { final StringBuffer result = new StringBuffer(); result.append(" // " + name + "\n"); - if (parent.isEnum && (type == parent)) { + if (parentClass.isEnum && (type == parentClass)) { result.append(" "); result.append(name + "\n"); @@ -119,7 +123,7 @@ public class FieldDescriptor implements GraphElement { @Override public String getGraphId() { - return parent.getGraphId() + ":" + name; + return parentClass.getGraphId() + ":" + name; } public int getOutsideVisibleReferencesCount() { @@ -127,12 +131,17 @@ public class FieldDescriptor implements GraphElement { if (!isVisible()) return 0; - if (type.isVisible()) - return 1; + if (type != null) + if (type.isVisible()) + return 1; return 0; } + public ClassDescriptor getType() { + return type; + } + @Override public boolean isVisible() { if (name.contains("$")) @@ -143,4 +152,5 @@ public class FieldDescriptor implements GraphElement { return true; } + } \ No newline at end of file