001package Torello.HTML.Tools.JavaDoc;
002
003import com.github.javaparser.ast.body.*;
004import com.github.javaparser.ast.Node;
005
006/**
007 * Entity: Exhaustive list of all items that may be defined inside of a Java Type.
008 * 
009 * <BR /><BR />
010 * <EMBED CLASS="external-html" DATA-FILE-ID="ENTITY">
011 */
012public enum Entity
013{
014    /** Denotes Field(s) */
015    FIELD(Field.class, VariableDeclarator.class, "FD"),
016
017    /** Denotes Method(s). */
018    METHOD(Method.class, MethodDeclaration.class, "MD"),
019
020    /** Denotes Constructor(s). */
021    CONSTRUCTOR(Constructor.class, ConstructorDeclaration.class, "CO"),
022
023    /**
024     * Used for the 'Elements' - which <I>must be located</I> inside an Annotation Definition - but 
025     * <I>are not always required or mandatory</I>.  Only an <CODE>&#64;interface</CODE>
026     * ({@code Annotation}) may have "Annotation Elements".
027     */
028    ANNOTATION_ELEM(AnnotationElem.class, AnnotationMemberDeclaration.class, "AE"),
029
030    /** Used for the Enumerated-Constants which may only be found inside a Java {@code 'enum'} */
031    ENUM_CONSTANT(EnumConstant.class, EnumConstantDeclaration.class, "EC"),
032
033    /**
034     * Denotes Static inner-class(es), inner-interface(s), inner-enums, etc.
035     * 
036     * <BR /><BR /><B STYLE='color: red;'>NOTE:</B> The Type-Mirror Fields for the {@code enum}
037     * constant {@code INNER_CLASS} are set to null.  Inner classes are types themselves, and the
038     * 'Type-Mirror' for an inner-class would be {@code java.lang.Class.class} itself!
039     */
040    INNER_CLASS(NestedType.class, TypeDeclaration.class, "NT");
041
042
043    // ********************************************************************************************
044    // ********************************************************************************************
045    // Reflection / Type java.lang.Class public constants
046    // ********************************************************************************************
047    // ********************************************************************************************
048
049
050    /**
051     * <EMBED CLASS='external-html' DATA-FILE-ID=ENTITYFIELD>
052     * 
053     * <BR /><BR />The <CODE>Class&lt;? extends {@link Declaration}&gt;</CODE> instance stored in
054     * this <B>'Type Mirror'</B> field is just the actual <B>{@code java.lang.class}</B> of one of
055     * the five CIET-Types.  Specifically this field will always evaluate to one of the following 
056     * values:
057     * 
058     * <BR /><BR /><UL CLASS=JDUL>
059     * <LI>{@code Method.class}</LI>
060     * <LI>{@code Constructor.class}</LI>
061     * <LI>{@code Field.class}</LI>
062     * <LI>{@code EnumConstant.class}</LI>
063     * <LI>{@code AnnotationElem.class}</LI>
064     * <LI>{@code null} - for the {@code INNER_CLASS} constant</LI>
065     * </UL>
066     */
067    public final Class<? extends Declaration> upgraderReflectionClass;
068
069    /**
070     * <EMBED CLASS='external-html' DATA-FILE-ID=ENTITYFIELD>
071     * 
072     * <BR /><BR />The {@code Class<? extends Node>} instance stored in this <B>'Type Mirror'</B>
073     * field is the actual <B>{@code java.lang.Class}</B> of the Java Parser Node that is used to
074     * build this kind of {@code Entity}.  Specifically, this field will always evaluate to one of
075     * the following <B>Java Parser {@code com.github.javaparser.ast.body.*}</B> values:
076     * 
077     * <BR /><BR /><UL CLASS=JDUL>
078     * <LI>{@code MethodDeclaration.class}</LI>
079     * <LI>{@code ConstructorDeclaration.class}</LI>
080     * <LI>{@code VariableDeclarator.class}</LI>
081     * <LI>{@code EnumConstantDeclaration.class}</LI>
082     * <LI>{@code AnnotationMemberDeclaration.class}</LI>
083     * <LI>{@code null} - for the {@code INNER_CLASS} constant</LI>
084     * </UL>
085     */
086    public final Class<? extends Node> javaParserReflectionClass;
087
088    /** Two character abbreviation-string for this {@code Entity}, usefull for CSS ID's */
089    public final String abbrev;
090
091    // Private constructor
092    private Entity(
093            Class<? extends Declaration> upgraderReflectionClass,
094            Class<? extends Node> javaParserReflectionClass,
095            String abbrev
096        )
097    {
098        this.upgraderReflectionClass    = upgraderReflectionClass;
099        this.javaParserReflectionClass  = javaParserReflectionClass;
100        this.abbrev                     = abbrev; 
101    }
102}