001package Torello.JavaDoc.Annotations;
002
003import Torello.JavaDoc.Entity;
004
005import java.util.regex.Pattern;
006import java.util.function.Predicate;
007
008import java.lang.annotation.Retention;
009import java.lang.annotation.Target;
010import java.lang.annotation.Repeatable;
011
012import static java.lang.annotation.RetentionPolicy.SOURCE;
013import static java.lang.annotation.ElementType.*;
014
015// EXPORTS:
016// 
017//     public String    handle();
018//     public String    typeName()      default "";
019//     public Entity    entity();
020//     public String    name();
021//     public byte      paramCount()    default -1;
022//     public String[]  paramNames()    default { };
023//     public String[]  paramTypesJOW() default { };
024// 
025// 
026// The following files are relatedf to this Annotation-Mirror Data-Class:
027// 
028// package Torello.JDUInternal.Features.LINK_JAVA_SOURCE
029//      This package does the "vast majority" of the work that is needed process a User's
030//      Annotation-Placement.  The classes in the packages in this class look for, and load, all 
031//      of the External '.java'-Files which have been specified by the programmer's annotation
032//      uses.  These classes also perform the Source-Code HiLiting, and save the output to the
033//      appropriate packge's '[pkg-javadoc]/ljs-hilite-files/' directory.  They finally, also,
034//      generate the appropriate "HREF=..." so that an appropriate '<A HREF...>' link may be
035//      inserted
036
037/** <EMBED CLASS='external-html' DATA-FILE-ID=LJS_TOP_EXAMPLE> */
038@Retention(SOURCE)
039@Target({TYPE, FIELD, CONSTRUCTOR, METHOD})
040@Repeatable(Torello.JavaDoc.Annotations.hidden.LJSRepeatable.class)
041public @interface LinkJavaSource
042{
043    /**
044     * The {@code String}-Value which is provided to this element specifies which HiLited 
045     * Source-Code File to use for the URL-Link in this {@code <A HREF>}-Button.
046     * 
047     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_HANDLE>
048     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_HANDLE_EX>
049     */
050    public String handle();
051
052
053    // The "handle" Annotation-Element is Mandatory, Not Optional.  (No Default value
054    // is provided in the @LinkJavaSource Annotation-Class).  It is supposed to contain
055    // "a pointer" or "File-Name Nick-Name" (a handle!) to a file that has been listed
056    // inside the File: 
057    //       "../upgrade-files/json-config/ExtraJavaHiLiting.json"
058    // 
059    // Every one of the '.java' Source-Files listed inside that '.json' files must
060    // contain:
061    //      1) A Valid '.java' File-Name
062    //      2) A handle for referencing that File-Name with the @LinkJavaSource
063    //         Annotation
064
065    /**
066     * This {@code String} may be used to specify an '<B>Inner-Type</B>', '<B>Nested-Type</B>' or
067     * possibly an '<B>Auxilliary-Class</B>'.
068     * 
069     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_TYPE_NAME>
070     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_TYPE_NAME_EX>
071     */
072    public String typeName() default "";
073
074
075    // It is altogether possible for the User to have requested that '.java' File be
076    // Hi-Lited which contains a class that actually has one or more inner-types,
077    // inner-interfaces or even auxiliary classes!
078    // 
079    // If the user would like the "name()" that he has provided to actually
080    // reference something other than the primary Class, Interface, Enum or Record,
081    // (such as an Inner-Type or an Auxiliary-Type), he must provided the exact,
082    // Full-Package, name of the Class or Type inside that file that he is intending
083    // to reference.
084    // 
085    // He may do this by passing a valid Full-Package Java Class or Type-Name to this
086    // Optional Annotation-Element.
087    // 
088    // This Annotation-Element is Optional, and has a default value (assigned by the
089    // 'javac' Annotations-Processor equal to the Empty-String)
090
091    /**
092     * When specifying a Line-Number to use for the link, identifies which kind of {@link Entity}
093     * is being linked.
094     * 
095     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_ENTITY>
096     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_ENTITY_EX>
097     */
098    public Entity entity() default Entity.METHOD;
099
100    /**
101     * When specifying a Line-Number to use, identifies the {@link Entity} or "Member" Name.
102     * 
103     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_NAME>
104     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_NAME_EX>
105     */
106    public String name() default "";
107
108
109    // The "name()" Annotation-Element should contain the name of the Member/Entity
110    // contained by the Class/Interface/Type (CIET) which is specified by "handle()"
111    // 
112    // "name()" is allowed to be optional in the case that the user is specifying a
113    // constructor.  If so, he must provide either a paramNames(), a paramTypesJOW or a
114    // paramCount().
115    // 
116    // Specifically: "name" should be the name of a Field, Method,
117    //               Constructor (Optional) or Enum-Constant from the CIET/Type named
118    //               by "handle()"
119
120    /**
121     * When specifying the Line-Number of either a {@link Entity#METHOD Method} or a
122     * {@link Entity#CONSTRUCTOR Constructor}, identifies the number of parameters contained by 
123     * the Method or Constructor Signature.
124     * 
125     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_COUNT>
126     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_COUNT_EX>
127     */
128    public byte paramCount() default -1;
129
130    /**
131     * When specifying the Line-Number of either a {@link Entity#METHOD Method} or a
132     * {@link Entity#CONSTRUCTOR Constructor}, identifies the names of the parameters accepted by 
133     * the Method or Constructor.
134     * 
135     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_NAMES>
136     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_NAMES_EX>
137     */
138    public String[] paramNames() default { };
139
140    /**
141     * When specifying the Line-Number of either a {@link Entity#METHOD Method} or a
142     * {@link Entity#CONSTRUCTOR Constructor}, identifies the Single-Word-Names for the 
143     * <B>{@code 'types'}</B> of the Method's or Constructor's parameters.
144     * 
145     * <BR /><BR />For example, if a method such as {@code boolean equals(Object other)} were 
146     * needing to be linked, the "Single Word Name" would be
147     * <B STYLE='color: red;'>{@code String}</B>, rather than {@code 'java.lang.String'}
148     * 
149     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_TYPES_JOW>
150     * <EMBED CLASS='external-html' DATA-FILE-ID=LJS_PARAM_T_JOW_EX>
151     */
152    public String[] paramTypesJOW() default { };
153}