Class TypeElementVisitorProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
io.micronaut.annotation.processing.TypeElementVisitorProcessor
- All Implemented Interfaces:
Processor
- Direct Known Subclasses:
AggregatingTypeElementVisitorProcessor
@SupportedOptions({"micronaut.processing.incremental","micronaut.processing.annotations","micronaut.processing.project.dir","micronaut.processing.group","micronaut.processing.module"})
public class TypeElementVisitorProcessor
extends AbstractProcessor
The annotation processed used to execute type element visitors.
- Since:
- 1.0
- Author:
- James Kleeh, graemerocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AnnotationProcessingOutputVisitorprotected Elementsprotected Filerprotected static final StringConstant for aggregating processor.protected static final StringConstant for isolating processor.protected JavaVisitorContextprotected Messagerprotected static final StringAnnotation processor option used to add additional annotation patterns to process.protected static final StringAnnotation processor option used to activate incremental processing.protected ModelUtilsprotected Typesprotected MutableConvertibleValues<Object>Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidProduce a compile error for the given message.protected final voidProduce a compile error for the given element and message.protected @NonNull Collection<? extends TypeElementVisitor<?,?>> Discovers theTypeElementVisitorinstances that are available.protected TypeElementVisitor.VisitorKindprotected Stringprotected List<io.micronaut.annotation.processing.LoadedVisitor>protected TypeElementVisitor.VisitorKindobtains the visitor kind.protected booleanDoes this process have any visitors.voidinit(ProcessingEnvironment processingEnv) protected booleanisIncremental(@NonNull ProcessingEnvironment processingEnv) Whether incremental compilation is enabled.protected booleanisProcessedAnnotation(String annotationName) Return whether the given annotation is processed.protected @NonNull JavaVisitorContextnewVisitorContext(@NonNull ProcessingEnvironment processingEnv) Creates the visitor context.protected final voidProduce a compile note for the given element and message.protected final voidProduce a compile note for the given element and message.booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) protected final booleanprocessingGeneratedAnnotation(Set<? extends TypeElement> annotations) protected final voidProduce a compile warning for the given message.protected final voidProduce a compile warning for the given element and message.Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized
-
Field Details
-
MICRONAUT_PROCESSING_INCREMENTAL
Annotation processor option used to activate incremental processing.- See Also:
-
MICRONAUT_PROCESSING_ANNOTATIONS
Annotation processor option used to add additional annotation patterns to process.- See Also:
-
GRADLE_PROCESSING_AGGREGATING
Constant for aggregating processor.- See Also:
-
GRADLE_PROCESSING_ISOLATING
Constant for isolating processor.- See Also:
-
messager
-
filer
-
elementUtils
-
typeUtils
-
modelUtils
-
visitorAttributes
-
classWriterOutputVisitor
-
javaVisitorContext
-
postponedTypes
-
-
Constructor Details
-
TypeElementVisitorProcessor
public TypeElementVisitorProcessor()
-
-
Method Details
-
init
-
hasVisitors
protected boolean hasVisitors()Does this process have any visitors.- Returns:
- True if visitors are present.
-
getLoadedVisitors
- Returns:
- The loaded visitors.
-
getIncrementalProcessorKind
- Returns:
- The incremental processor type.
- See Also:
-
getSupportedAnnotationTypes
- Specified by:
getSupportedAnnotationTypesin interfaceProcessor
-
getSupportedOptions
- Specified by:
getSupportedOptionsin interfaceProcessor
-
process
@NextMajorVersion("`roundEnv.getRootElements()` should be removed in Micronaut 4. It should not be possible to process elements without at least one annotation present and this call breaks that assumption") public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) - Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
findTypeElementVisitors
Discovers theTypeElementVisitorinstances that are available.- Returns:
- A collection of type element visitors.
-
processingGeneratedAnnotation
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-
getIncrementalProcessorType
- Returns:
- The incremental processor type.
- See Also:
-
isProcessedAnnotation
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
obtains the visitor kind.- Returns:
- The visitor kind
-
error
Produce a compile error for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
error
Produce a compile error for the given message.- Parameters:
msg- The messageargs- The string format args
-
warning
Produce a compile warning for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
warning
Produce a compile warning for the given message.- Parameters:
msg- The messageargs- The string format args
-
note
Produce a compile note for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
note
Produce a compile note for the given element and message.- Parameters:
msg- The messageargs- The string format args
-
isIncremental
Whether incremental compilation is enabled.- Parameters:
processingEnv- The processing environment.- Returns:
- True if it is
-