Package Torello.JavaDoc
Class NestedType
- java.lang.Object
-
- Torello.JavaDoc.Declaration
-
- Torello.JavaDoc.NestedType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class NestedType extends Declaration implements java.lang.Cloneable
Reflection Class:
Holds all information extracted from'.java'
Source-Files regarding Nested-Types (Inner-Classes).
Instances of this Class are Obtained From:
Use of the Reflection-HTML API is *NOT REQUIRED* to perform a standard Java Doc HTML File Upgrade. This "extra API" allows for programmatic modification of Java Doc HTML. This class contains quite a bit of reflected information, and furthermore, here there is a hook to the Native Java Parser Reflection Class.JavaDocHTMLFile
A Nested-Type may be any one of the primary types, including:Classes, Interfaces, Enum's, Annotations & Records
. This class provides some reflected information about an inner-type retrieved using Java Parser.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/NestedType.java
- Open New Browser-Tab: Torello/JavaDoc/NestedType.java
File Size: 16,854 Bytes Line Count: 392 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field protected static long
serialVersionUID
CIET / Kind of Nested-Type Modifier and Type Field CIET
ciet
Reflection & Inspection final- String
'sModifier and Type Field String
fullyQualifiedName
String
nameWithContainer
String
packageName
Entity / Member Count final- int
'sModifier and Type Field int
numFields
int
numMethods
Native Source-Parser Library Reference Hooks Modifier and Type Field ClassTree
classTree
Read-Only String Lists of Reflected Type-Data Modifier and Type Field ReadOnlyList<String>
extendedTypesJOW
ReadOnlyList<String>
genericTypeParameters
ReadOnlyList<String>
implementedTypesJOW
-
Fields inherited from class Torello.JavaDoc.Declaration
annotations, body, entity, id, jdComment, jduAnnotationMirrors, location, modifiers, name, signature
-
-
Constructor Summary
Public Constructors that are Intended for Internal-Use, Only Constructor NestedType(ClassTree ct, TreeUtils util)
-
Method Summary
Methods: interface java.lang.Comparable Modifier and Type Method int
compareTo(NestedType nt)
Methods: class java.lang.Object Modifier and Type Method boolean
equals(NestedType other)
String
toString()
String
toString(int flags)
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
ciet
-
packageName
public final java.lang.String packageName
The name of the package in which the enclosing-class of this nested-type is defined. This field will be null if the package was not found, or left blank as the 'default class'.
-
nameWithContainer
public final java.lang.String nameWithContainer
Thename
-field (Declaration.name
) of this class uses the lone Java-Identifier (Just One Word) which identifies thisNestedClass
within the scope of the enclosing class. However,nameWithContainer
is aString
that also includes any / all enclosing-class names, each followed-by a'.'
EXAMPLE: For Javajava.util.Map.Entry<K, V>
, thenameWithContainer
would be"Map.Entry"
.
Generic Type-Parameter information is not included in thisString
, and neither is the Package-Name.
-
fullyQualifiedName
public final java.lang.String fullyQualifiedName
This field is identical tonameWithContainer
, but also has the Package-Name prepended to it, if the Package-Name was present in the enclosing class''.java'
file.
EXAMPLE: For Javajava.util.Map.Entry<K, V>
, thefullyQualifiedName
would be"java.util.Map.Entry"
.
-
numFields
public final int numFields
The number of fields that are defined in this inner-type
-
numMethods
public final int numMethods
The number of methods defined in this inner-type
-
genericTypeParameters
public final ReadOnlyList<java.lang.String> genericTypeParameters
AString[]
-Array containing the actuala text of each / any / all type parameters utilized by this nested-type.
If the inner-class being parsed werejava.util.Map.Entry<K, V>
, this array would have length 2. The twoString's
in this array would contain the single-characterString's
-"K"
and"V"
.
-
implementedTypesJOW
public final ReadOnlyList<java.lang.String> implementedTypesJOW
AString[]
-Array of the interface-names that this class implements. If this Nested-Type does not implement any interfaces, then this array will be null.
JOW: Just One Word, The type-String's
in this array are single Java-Identifiers that have had all package, container-class, and generic-parameter information removed from the type-name.
If aNestedType
implemented interfacejava.util.Iterator<HTMLNode>
, the type-String
representing it in thisString[]
-Array would simply be"Iterator"
.JOW: Just One Word
The Just One Word convention used by the JDU Tool elminates BOTH Package-Name Information AND (for Inner-Types / Nested-Types) any & all Container-Class Information from the Type-String's
.
The Java-Doc Upgrader does not perform a Compiler-Styled "Linking Pass" on the Java-Doc Web-Pages it parses, and must suffice with the unlinked Type-Names provided by the Oracle AST-Parser and Java-Doc'.html'
Output Pages.
As an example of this, If a parameter to aMethod
, or the type of aField
inside of a class had the fully qualified type-name:java.util.stream.Stream.Builder<String>
theJOW-String
for that type would simply be the word"Builder"
For Arrays:
If the type, itself, is an array of any kind, any & all Array-Brackets will be included in thisString
-Name. Please review the Example Table, below:Output JOW-String Input Type "Entry"
"java.util.Map.Entry<K, V>"
"Vector"
"java.util.Vector<E>"
"Vector"
"Vector<TagNode>"
"Vector"
"Vector<Vector<TagNode>>"
"Vector"
"java.util.Vector<Vector<TagNode>>"
"String"
"String"
"String"
"java.lang.String"
"String[]"
"java.lang.String[]"
"Integer"
"Integer"
"Integer[]"
"java.lang.Integer[]"
"String[]"
"String..."
"String[]"
"java.lang.String..."
-
extendedTypesJOW
public final ReadOnlyList<java.lang.String> extendedTypesJOW
AString[]
-Array of the types that this class or interface extends. If this Nested-Type does not extend any classes or interfaces, then this array will be null.
Note that in Java, a class may only extend a single other class; however, an interface is permitted to extend multiple other interfaces. The reason this field is aString[]
Array, rather than a simpleString
is, as was just explained, because if a Nested-Type were an interface rather than a class, it is possible in Java for that "inner interface" to have multiple parents, rather than just one.
JOW: Just One Word, The type-String's
in this array are single Java-Identifiers that have had all package, container-class, and generic-parameter information removed from the type-name.
If aNestedType
extended classjava.util.Map.Entry<K, V>
, the type-String
representing it in thisString[]
-Array would simply be"Entry"
.
-
classTree
public final transient com.sun.source.tree.ClassTree classTree
Hook Reference to Sun/Oracle Parser-Refletion Class
Though this class offers a streamlined set of reflection features, the Native Oracle Library Reflection-Classes offer a detailed AST interface into the standard Java Compiler. If you would like to use these Tree's to provide further code analysis on your Java-Doc Pages, this field is provided as a convenience for such purposes.
If a user decides to make use of the native OracleClassTree
instance that was used to build thisNestedType
instance, it may be retrieved from thistransient
field.
-
-
Method Detail
-
toString
public java.lang.String toString()
Generates aString
of thisnested-type
, with most information included.- Overrides:
toString
in classDeclaration
- Returns:
- A printable
String
of thisnested-type
. - See Also:
PF
,toString(int)
- Code:
- Exact Method Body:
return "Name: [" + name + "]\n" + "With Container: [" + nameWithContainer + "]\n" + "Kind: [" + ciet.toString() + "]\n" + "Signature: [" + StrPrint.abbrevEndRDSF(signature, MAX_STR_LEN, true) + "]\n" + // "Type Parameters:".length() ==> 16 (17=16+1) printedTypeParameters(17) + "Modifiers: [" + StrCSV.toCSV(modifiers, true, true, null) + "]\n" + // This will **NEVER** be null - unless 'this' instance was built from an HTML File, // rather than a source-code file. Instances like that are only used temporarily, and // are garbage collected instantly. Do this check anyway (just in case). "Location: " + ((this.location == null) ? "null" : ('[' + this.location.quickSummary() + ']'));
-
toString
public java.lang.String toString(int flags)
This method accepts a'flags'
parameter which has been constructed using the Bit-Masks provided by thePF
class. Please view the Static-Constants which are provided by classPF
for more information about modifying the return-value of thistoString(int)
method.- Overrides:
toString
in classDeclaration
- Parameters:
flags
- These are defined in thePrint-Flags
class- Returns:
- A printable
String
of thisNestedType
. - See Also:
toString()
,PF
- Code:
- Exact Method Body:
boolean color = (flags & UNIX_COLORS) > 0; String nameTitle = "Nested " + ciet.toString(); // 7 ==> " Name: ".length() int LEN = nameTitle.length() + 7; return printedName(nameTitle, LEN, color) + StringParse.rightSpacePad("Fully Qualified:", LEN) + '[' + fullyQualifiedName + "]\n" + StringParse.rightSpacePad("With Container:", LEN) + '[' + nameWithContainer + "]\n" + printedSignature(LEN, color) + printedTypeParameters(LEN) + printedModifiers(LEN) + printedExtendsImplements(LEN) + printedMethodField(LEN, color) + printedLocation(LEN, color, (flags & BRIEF_LOCATION) > 0) + // The previous method does not add a '\n' end to the end of the returned string // This is optional, it adds a '\n' AT THE BEGINNING if it is included printedComments(LEN, color, (flags & JAVADOC_COMMENTS) > 0);
-
compareTo
public int compareTo(NestedType nt)
Java'sinterface Comparable<T>
requirements. This does a very simple comparison using the two nested-types's'name'
field.- Parameters:
nt
- Any otherNested-Type
to be compared to'this'
- Returns:
- An integer that fulfills Java's
interface Comparable<NestedType>, public boolean compareTo(NestedType nt)
method requirements. - Code:
- Exact Method Body:
return (this == nt) ? 0 : this.name.compareTo(nt.name);
-
equals
public boolean equals(NestedType other)
This should be called an "atypical version" of the usualequals(Object other)
method. This version of equals merely compares the name of the field defined. The presumption here is that the definition of a 'field' only has meaning - at all - inside the context of aclass, interface,
orenumerated-type
where that field is defined. Since inside any'.java'
source-code file, there may only be one field with a given name, this method shall returnTRUE
whenever the field being compared also has the same name.- Parameters:
other
- This may be any other field. It is strongly suggested that'other'
be a field defined in the same'.java'
source-code file as'this'
field.- Returns:
- This method returns
TRUE
when'this'
instance ofField
has the same'name'
as the name-field of input-parameter'other'
- Code:
- Exact Method Body:
return this.name.equals(other.name);
-
-