Class PackageElementVisitorProcessor

java.lang.Object
javax.annotation.processing.AbstractProcessor
io.micronaut.annotation.processing.PackageElementVisitorProcessor
All Implemented Interfaces:
Processor
Direct Known Subclasses:
AggregatingPackageElementVisitorProcessor

@SupportedOptions({"micronaut.processing.incremental","micronaut.processing.annotations","micronaut.processing.project.dir","micronaut.processing.group","micronaut.processing.module"}) public sealed class PackageElementVisitorProcessor extends AbstractProcessor permits AggregatingPackageElementVisitorProcessor

The annotation processed used to execute package element visitors.

Since:
4.10
Author:
Denis Stepanov
  • Field Details

    • MICRONAUT_PROCESSING_INCREMENTAL

      protected static final String MICRONAUT_PROCESSING_INCREMENTAL
      Annotation processor option used to activate incremental processing.
      See Also:
    • MICRONAUT_PROCESSING_ANNOTATIONS

      protected static final String MICRONAUT_PROCESSING_ANNOTATIONS
      Annotation processor option used to add additional annotation patterns to process.
      See Also:
    • GRADLE_PROCESSING_AGGREGATING

      protected static final String GRADLE_PROCESSING_AGGREGATING
      Constant for aggregating processor.
      See Also:
    • GRADLE_PROCESSING_ISOLATING

      protected static final String GRADLE_PROCESSING_ISOLATING
      Constant for isolating processor.
      See Also:
    • messager

      protected Messager messager
    • filer

      protected Filer filer
    • elementUtils

      protected Elements elementUtils
    • typeUtils

      protected Types typeUtils
    • modelUtils

      protected ModelUtils modelUtils
    • visitorAttributes

      protected MutableConvertibleValues<Object> visitorAttributes
    • classWriterOutputVisitor

      protected AnnotationProcessingOutputVisitor classWriterOutputVisitor
    • javaVisitorContext

      protected JavaVisitorContext javaVisitorContext
    • postponedTypes

      protected Map<String,Object> postponedTypes
  • Constructor Details

    • PackageElementVisitorProcessor

      public PackageElementVisitorProcessor()
  • Method Details

    • init

      public void init(ProcessingEnvironment processingEnv)
      Specified by:
      init in interface Processor
    • hasVisitors

      protected boolean hasVisitors()
      Does this process have any visitors.
      Returns:
      True if visitors are present.
    • getPackageVisitors

      public List<io.micronaut.annotation.processing.PackageLoadedVisitor> getPackageVisitors()
      Returns:
      The loaded visitors.
    • getIncrementalProcessorKind

      protected TypeElementVisitor.VisitorKind getIncrementalProcessorKind()
      Returns:
      The incremental processor type.
      See Also:
    • getSupportedAnnotationTypes

      public Set<String> getSupportedAnnotationTypes()
      Specified by:
      getSupportedAnnotationTypes in interface Processor
    • process

      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
      Specified by:
      process in interface Processor
      Specified by:
      process in class AbstractProcessor
    • processingGeneratedAnnotation

      protected final boolean processingGeneratedAnnotation(Set<? extends TypeElement> annotations)
    • getSupportedSourceVersion

      public SourceVersion getSupportedSourceVersion()
      Specified by:
      getSupportedSourceVersion in interface Processor
      Overrides:
      getSupportedSourceVersion in class AbstractProcessor
    • getSupportedOptions

      public Set<String> getSupportedOptions()
      Specified by:
      getSupportedOptions in interface Processor
      Overrides:
      getSupportedOptions in class AbstractProcessor
    • getIncrementalProcessorType

      protected String getIncrementalProcessorType()
      Returns:
      The incremental processor type.
      See Also:
    • isProcessedAnnotation

      protected boolean isProcessedAnnotation(String annotationName)
      Return whether the given annotation is processed.
      Parameters:
      annotationName - The annotation name
      Returns:
      True if it is
    • newVisitorContext

      @NonNull protected @NonNull JavaVisitorContext newVisitorContext(@NonNull @NonNull ProcessingEnvironment processingEnv)
      Creates the visitor context.
      Parameters:
      processingEnv - The processing env
      Returns:
      The context
    • getVisitorKind

      @NonNull protected TypeElementVisitor.VisitorKind getVisitorKind()
      obtains the visitor kind.
      Returns:
      The visitor kind
    • error

      protected final void error(Element e, String msg, Object... args)
      Produce a compile error for the given element and message.
      Parameters:
      e - The element
      msg - The message
      args - The string format args
    • error

      protected final void error(String msg, Object... args)
      Produce a compile error for the given message.
      Parameters:
      msg - The message
      args - The string format args
    • warning

      protected final void warning(Element e, String msg, Object... args)
      Produce a compile warning for the given element and message.
      Parameters:
      e - The element
      msg - The message
      args - The string format args
    • warning

      protected final void warning(String msg, Object... args)
      Produce a compile warning for the given message.
      Parameters:
      msg - The message
      args - The string format args
    • note

      protected final void note(Element e, String msg, Object... args)
      Produce a compile note for the given element and message.
      Parameters:
      e - The element
      msg - The message
      args - The string format args
    • note

      protected final void note(String msg, Object... args)
      Produce a compile note for the given element and message.
      Parameters:
      msg - The message
      args - The string format args
    • isIncremental

      protected boolean isIncremental(@NonNull @NonNull ProcessingEnvironment processingEnv)
      Whether incremental compilation is enabled.
      Parameters:
      processingEnv - The processing environment.
      Returns:
      True if it is