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