Class ConfigurationPropertyAnnotationProcessor

  • All Implemented Interfaces:
    javax.annotation.processing.Processor

    @SupportedAnnotationTypes("io.microsphere.annotation.ConfigurationProperty")
    public class ConfigurationPropertyAnnotationProcessor
    extends javax.annotation.processing.AbstractProcessor
    The Processor for the ConfigurationProperty annotation

    This class processes the ConfigurationProperty annotations during the compilation phase, collects metadata about annotated elements, and generates a JSON metadata file that contains configuration property information.

    • init(ProcessingEnvironment) initializes required utilities such as the Messager and ResourceProcessor.
    • process(Set, RoundEnvironment) handles each processing round:
      • During normal rounds, it resolves metadata from annotated elements.
      • On the final round, it writes collected metadata into a resource file.
    • resolveMetadata(RoundEnvironment) traverses all root elements to extract configuration property metadata.
    • writeMetadata() writes the generated metadata into a JSON file under "META-INF/microsphere/configuration-properties.json" using a writer.
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    ConfigurationProperty
    • Constructor Detail

      • ConfigurationPropertyAnnotationProcessor

        public ConfigurationPropertyAnnotationProcessor()
    • Method Detail

      • init

        public void init​(javax.annotation.processing.ProcessingEnvironment processingEnv)
        Specified by:
        init in interface javax.annotation.processing.Processor
        Overrides:
        init in class javax.annotation.processing.AbstractProcessor
      • process

        public boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
                               javax.annotation.processing.RoundEnvironment roundEnv)
        Specified by:
        process in interface javax.annotation.processing.Processor
        Specified by:
        process in class javax.annotation.processing.AbstractProcessor
      • getSupportedSourceVersion

        public javax.lang.model.SourceVersion getSupportedSourceVersion()
        Specified by:
        getSupportedSourceVersion in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedSourceVersion in class javax.annotation.processing.AbstractProcessor