Class NestedType

  • All Implemented Interfaces:, 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.

    Reflection-Classes Inheritance-Diagram

    Class Declaration
    Class Callable
    Class Method
    Class Constructor
    Also Inherits Class Callable
    No Additional Fields
    Reflection Class
    Inheritance Diagram

    Class Field
    Class EnumConstant
    Class AnnotationElem
    Class NestedType

    Native JDK API Hook:
    All reflection classes above, also contain an additional (transient, non-Serializable) field that hooks into the native Java Tree-Parser Tools available in JDK Package com.sun.source.tree.*

    If a more in-depth Code-Analysis is needed, the JDK's AST's have full and complete Parses of your Source-Code that can facilitate almost any analysis.
    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 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
        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 ( 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

        If the String's in a type-as-String contain complicated or intricate detailed information, and all you need is a simple identifier, the JOW-String stores the type-as-String with all package-name and generic-parameters (if they were present / included) stripped from the String. Furthermore, if the type was originally an inner-class, even the containing class-name is removed from the JOW-String.

        If a parameter to a Method, or the type of a Field had the (fully-qualified) type-name:<String>, the JOW-String would simply have the word "Builder".

        NOTE: If the type, itself, is an array of any kind, the array-brackets will be included in this String-name.
        Output Single-Word, Type-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..."

        NOTE: You may view the StringParse class' methods removeGeneric, and typeToJavaIdentifier for more information.
      • 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 Sun/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.
        toString in class Declaration
        A printable String of this nested-type.
        See Also:
        PF, toString(int), StrCSV.toCSV(String[], boolean, boolean, Integer)
        Exact Method Body:
             "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 class expects a flags that has been masked using the constant (public, static, final int) fields of class PF. Please view this class for more information about the flags available for modifying the return-value of this toString() method.
        toString in class Declaration
        flags - These are the toString flags from class PF ("Print Flags"). View available flags listed in class PF.
        A printable String of this method, with comment information included as well.
        See Also:
        StrCSV.toCSV(String[], boolean, boolean, Integer), toString(), PF
        Exact Method Body:
         boolean color = (flags & UNIX_COLORS) > 0;
         String nameTitle = "Nested " + ciet.toString();
         // 7 ==> " Name: ".length()
         int LEN = nameTitle.length() + 7;
             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.
        nt - Any other Nested-Type to be compared to 'this'
        An integer that fulfills Java's interface Comparable<NestedType>, public boolean compareTo(NestedType nt) method requirements.
        Exact Method Body:
         return (this == nt) ? 0 :;
      • 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.
        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.
        This method returns TRUE when 'this' instance of Field has the same 'name' as the name-field of input-parameter 'other'
        Exact Method Body: