Package Torello.JavaDoc.Annotations
Class JDUAnnotationProcessorDispatch
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- Torello.JavaDoc.Annotations.JDUAnnotationProcessorDispatch
-
- All Implemented Interfaces:
javax.annotation.processing.Processor
public class JDUAnnotationProcessorDispatch extends javax.annotation.processing.AbstractProcessor
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/Annotations/JDUAnnotationProcessorDispatch.java
- Open New Browser-Tab: Torello/JavaDoc/Annotations/JDUAnnotationProcessorDispatch.java
File Size: 9,383 Bytes Line Count: 201 '\n' Characters Found
-
-
Constructor Summary
Constructors Constructor JDUAnnotationProcessorDispatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Set<String>getSupportedAnnotationTypes()javax.lang.model.SourceVersiongetSupportedSourceVersion()voidinit(javax.annotation.processing.ProcessingEnvironment env)booleanprocess(Set<? extends javax.lang.model.element.TypeElement> set, javax.annotation.processing.RoundEnvironment roundEnv)
-
-
-
Constructor Detail
-
JDUAnnotationProcessorDispatch
public JDUAnnotationProcessorDispatch()
-
-
Method Detail
-
init
public void init(javax.annotation.processing.ProcessingEnvironment env)
Method that is requuired by the'AbstractProcessor'interface that allows this processor to initialize & receive the necessary environment variables.- Specified by:
initin interfacejavax.annotation.processing.Processor- Overrides:
initin classjavax.annotation.processing.AbstractProcessor- Parameters:
env- This provides the instance-reference to the messaging-output tool.- Code:
- Exact Method Body:
this.messager = env.getMessager(); this.filer = env.getFiler();
-
getSupportedAnnotationTypes
public java.util.Set<java.lang.String> getSupportedAnnotationTypes()
Method required byAbstractProcessor- Specified by:
getSupportedAnnotationTypesin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedAnnotationTypesin classjavax.annotation.processing.AbstractProcessor- Returns:
- The set of annotations supported by this processor. The
Setthat is returned contains just the name of theStaticFunctionalclass-name. - Code:
- Exact Method Body:
TreeSet<String> ret = new TreeSet<>(); ret.add(StaticFunctional.class.getCanonicalName()); ret.add(JDHeaderBackgroundImg.class.getCanonicalName()); ret.add(CSSLinks.class.getCanonicalName()); ret.add(JavaScriptImport.class.getCanonicalName()); ret.add(IntoHTMLTable.class.getCanonicalName()); ret.add(LinkJavaSource.class.getCanonicalName()); ret.add(LJSRepeatable.class.getCanonicalName()); // DO I NEED THIS? //ret.add(LJSRepeatable.class.getCanonicalName()); return ret;
-
getSupportedSourceVersion
public javax.lang.model.SourceVersion getSupportedSourceVersion()
Method required byAbstractProcessor- Specified by:
getSupportedSourceVersionin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedSourceVersionin classjavax.annotation.processing.AbstractProcessor- Returns:
- the Java version supported
- Code:
- Exact Method Body:
return SourceVersion.latestSupported();
-
process
public boolean process (java.util.Set<? extends javax.lang.model.element.TypeElement> set, javax.annotation.processing.RoundEnvironment roundEnv)
This implements the processing for the Annotation @StaticFunctional. It does a lot of validity checks on the parameter input.- Specified by:
processin interfacejavax.annotation.processing.Processor- Specified by:
processin classjavax.annotation.processing.AbstractProcessor- Code:
- Exact Method Body:
boolean errors = false; // REMEMBER: There are **THREE** different classes/types for an Annotation: // // 1) The actual Annotation itself - which is the one the end-user is supposed to use. // // 2) The Processor (which is now three classes - to keep it all separated out) // // 3) The Annotation-Mirror (which is now one class - to keep it all together), which the // JavaDoc Upgrader uses to retrieve the values of the Elements that the user provided // so that it can react accordingly during the upgrader processing // // Annotations just feel like one giant Spaghetti Mess. I think they should have allowed // all three of these concepts to reside INSIDE THE SAME CLASS: The processor, the mirror // and the annotation itself... They should be on simple/single class, but Java will not // allow it. // // Because they are so messy, Java-HTML doesn't use a lot of annotations. As of October // 2022, there are only two in the entire JAR Library... Although "StaticFunctional" is // used on almost every '.class' in the entire JAR. // // NOTE: AGAIN, the @StaticFunctional Annotation is really just used to say "This is not // really an Object-Class, it is a standad '.c' File, and doesn't have any data" // // Just about every class in the Java-HTML JAR Library that is not a "Data Class" // has had @StaticFunctional placed on it. // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Processor-Dispatch for @CSSStyleSheets // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // All the classes that are annotated with @CSSStyleSheets for (Element ciet : roundEnv.getElementsAnnotatedWith(CSSLinks.class)) // There may be many annotations on that class (other than @CSSStyleSheets) // This retrieves all of the mirrors on the class, even ones not about @JDHBI... for (AnnotationMirror am : ciet.getAnnotationMirrors()) // If the annotation-mirror on that class (whose-mirrors are being iterated) is // a @CSSStyleSheets data/value mirror (all the values that the user gave // the annotation when he placed it on a class), then-and-only-then should it be // processed. if (am.getAnnotationType().toString().equals ("Torello.JavaDoc.Annotations.CSSLinks")) // Do the @CSSStyleSheets Processing... For readability this has been // placed in a separate-file. All this does is make sure the user didn't // screw-up the values that he (may or may not have) given to the annotation. // If there are no values assigned to the members, this method exists // immediately. errors |= CSSLProcessor.process(ciet, am, filer, this.messager); // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Processor-Dispatch for @JDHeaderBackgroundImg // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // // NOTE: The next set of loops were **ALL** Block Copied from the first loop. This means // that all applicable documentation-explanations are the exact same thing for these // Annotations as well. for (Element ciet : roundEnv.getElementsAnnotatedWith(JDHeaderBackgroundImg.class)) for (AnnotationMirror am : ciet.getAnnotationMirrors()) if (am.getAnnotationType().toString().equals ("Torello.JavaDoc.Annotations.JDHeaderBackgroundImg")) errors |= JDHBIProcessor.process(ciet, am, this.messager); // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Processor-Dispatch for @StaticFunctional // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** for (Element ciet : roundEnv.getElementsAnnotatedWith(StaticFunctional.class)) for (AnnotationMirror am : ciet.getAnnotationMirrors()) if (am.getAnnotationType().toString().equals ("Torello.JavaDoc.Annotations.StaticFunctional")) errors |= SFProcessor.process(ciet, am, this.messager); // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Processor-Dispatch for @LinkJavaSource // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** for (Element ciet : roundEnv.getElementsAnnotatedWith(LinkJavaSource.class)) for (AnnotationMirror am : ciet.getAnnotationMirrors()) if (am.getAnnotationType().toString().equals ("Torello.JavaDoc.Annotations.LinkJavaSource")) errors |= LJSProcessor.process(ciet, am, this.messager); // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Processor-Dispatch for @IntoHTMLTable // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** for (Element ciet : roundEnv.getElementsAnnotatedWith(IntoHTMLTable.class)) for (AnnotationMirror am : ciet.getAnnotationMirrors()) if (am.getAnnotationType().toString().equals ("Torello.JavaDoc.Annotations.IntoHTMLTable")) errors |= IHTProcessor.process(ciet, am, this.messager); return errors;
-
-