Class JDUAnnotationProcessorDispatch

    • Field Summary

      • Fields inherited from class javax.annotation.processing.AbstractProcessor

        processingEnv
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method
      Set<String> getSupportedAnnotationTypes()
      javax.lang.model.SourceVersion getSupportedSourceVersion()
      void init​(javax.annotation.processing.ProcessingEnvironment env)
      boolean process​(Set<? extends javax.lang.model.element.TypeElement> set, javax.annotation.processing.RoundEnvironment roundEnv)
      • Methods inherited from class javax.annotation.processing.AbstractProcessor

        getCompletions, getSupportedOptions, isInitialized
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        init in interface javax.annotation.processing.Processor
        Overrides:
        init in class javax.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 by AbstractProcessor
        Specified by:
        getSupportedAnnotationTypes in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedAnnotationTypes in class javax.annotation.processing.AbstractProcessor
        Returns:
        The set of annotations supported by this processor. The Set that is returned contains just the name of the StaticFunctional class-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 by AbstractProcessor
        Specified by:
        getSupportedSourceVersion in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedSourceVersion in class javax.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:
        process in interface javax.annotation.processing.Processor
        Specified by:
        process in class javax.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;