Class 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: JavaDocHTMLFile

    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.
    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


    • Field Detail

      • serialVersionUID

        🡅  🡇     🗕  🗗  🗖
        protected static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable 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;
        
      • 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
        The name-field (Declaration.name) of this class uses the lone Java-Identifier (Just One Word) which identifies this NestedClass within the scope of the enclosing class. However, nameWithContainer is a String that also includes any / all enclosing-class names, each followed-by a '.'

        EXAMPLE: For Java java.util.Map.Entry<K, V>, the nameWithContainer would be "Map.Entry".

        Generic Type-Parameter information is not included in this String, and neither is the Package-Name.
      • fullyQualifiedName

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String fullyQualifiedName
        This field is identical to nameWithContainer, but also has the Package-Name prepended to it, if the Package-Name was present in the enclosing class' '.java' file.

        EXAMPLE: For Java java.util.Map.Entry<K, V>, the fullyQualifiedName would be "java.util.Map.Entry".
      • genericTypeParameters

        🡅  🡇     🗕  🗗  🗖
        public final ReadOnlyList<java.lang.String> genericTypeParameters
        A String[]-Array containing the actuala text of each / any / all type parameters utilized by this nested-type.

        If the inner-class being parsed were java.util.Map.Entry<K, V>, this array would have length 2. The two String's in this array would contain the single-character String's - "K" and "V".
      • implementedTypesJOW

        🡅  🡇     🗕  🗗  🗖
        public final ReadOnlyList<java.lang.String> implementedTypesJOW
        A String[]-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 a NestedType implemented interface java.util.Iterator<HTMLNode>, the type-String representing it in this String[]-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 a Method, or the type of a Field inside of a class had the fully qualified type-name:

        java.util.stream.Stream.Builder<String>

        the JOW-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 this String-Name. Please review the Example Table, below:
        Output JOW-StringInput 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
        A String[]-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 a String[] Array, rather than a simple String 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 a NestedType extended class java.util.Map.Entry<K, V>, the type-String representing it in this String[]-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 Oracle ClassTree instance that was used to build this NestedType instance, it may be retrieved from this transient field.
    • Method Detail

      • toString

        🡇     🗕  🗗  🗖
        public java.lang.String toString()
        Generates a String of this nested-type, with most information included.
        Overrides:
        toString in class Declaration
        Returns:
        A printable String of this nested-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 the PF class. Please view the Static-Constants which are provided by class PF for more information about modifying the return-value of this toString(int) method.
        Overrides:
        toString in class Declaration
        Parameters:
        flags - These are defined in the Print-Flags class
        Returns:
        A printable String of this NestedType.
        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's interface Comparable<T> requirements. This does a very simple comparison using the two nested-types's 'name' field.
        Parameters:
        nt - Any other Nested-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 usual equals(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 a class, interface, or enumerated-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 return TRUE 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 of Field has the same 'name' as the name-field of input-parameter 'other'
        Code:
        Exact Method Body:
         return this.name.equals(other.name);