Class TypeElementVisitorProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- io.micronaut.annotation.processing.TypeElementVisitorProcessor
-
- All Implemented Interfaces:
javax.annotation.processing.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 javax.annotation.processing.AbstractProcessorThe annotation processed used to execute type element visitors.
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationUtilsannotationUtilsprotected AnnotationProcessingOutputVisitorclassWriterOutputVisitorprotected javax.lang.model.util.ElementselementUtilsprotected javax.annotation.processing.Filerfilerprotected GenericUtilsgenericUtilsprotected static java.lang.StringGRADLE_PROCESSING_AGGREGATINGConstant for aggregating processor.protected static java.lang.StringGRADLE_PROCESSING_ISOLATINGConstant for isolating processor.protected JavaVisitorContextjavaVisitorContextprotected javax.annotation.processing.Messagermessagerprotected static java.lang.StringMICRONAUT_PROCESSING_ANNOTATIONSAnnotation processor option used to add additional annotation patterns to process.protected static java.lang.StringMICRONAUT_PROCESSING_INCREMENTALAnnotation processor option used to activate incremental processing.protected ModelUtilsmodelUtilsprotected javax.lang.model.util.TypestypeUtilsprotected io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>visitorAttributes
-
Constructor Summary
Constructors Constructor Description TypeElementVisitorProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiderror(java.lang.String msg, java.lang.Object... args)Produce a compile error for the given message.protected voiderror(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile error for the given element and message.protected java.util.Collection<io.micronaut.inject.visitor.TypeElementVisitor>findTypeElementVisitors()Discovers theTypeElementVisitorinstances that are available.protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKindgetIncrementalProcessorKind()protected java.lang.StringgetIncrementalProcessorType()protected java.util.List<LoadedVisitor>getLoadedVisitors()java.util.Set<java.lang.String>getSupportedAnnotationTypes()java.util.Set<java.lang.String>getSupportedOptions()javax.lang.model.SourceVersiongetSupportedSourceVersion()protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKindgetVisitorKind()obtains the visitor kind.protected booleanhasVisitors()Does this process have any visitors.voidinit(javax.annotation.processing.ProcessingEnvironment processingEnv)protected booleanisIncremental(javax.annotation.processing.ProcessingEnvironment processingEnv)Whether incremental compilation is enabled.protected booleanisProcessedAnnotation(java.lang.String annotationName)Return whether the given annotation is processed.protected JavaVisitorContextnewVisitorContext(javax.annotation.processing.ProcessingEnvironment processingEnv)Creates the visitor context.protected voidnote(java.lang.String msg, java.lang.Object... args)Produce a compile note for the given element and message.protected voidnote(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile note for the given element and message.booleanprocess(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)protected voidwarning(java.lang.String msg, java.lang.Object... args)Produce a compile warning for the given message.protected voidwarning(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile warning for the given element and message.
-
-
-
Field Detail
-
MICRONAUT_PROCESSING_INCREMENTAL
protected static final java.lang.String MICRONAUT_PROCESSING_INCREMENTAL
Annotation processor option used to activate incremental processing.- See Also:
- Constant Field Values
-
MICRONAUT_PROCESSING_ANNOTATIONS
protected static final java.lang.String MICRONAUT_PROCESSING_ANNOTATIONS
Annotation processor option used to add additional annotation patterns to process.- See Also:
- Constant Field Values
-
GRADLE_PROCESSING_AGGREGATING
protected static final java.lang.String GRADLE_PROCESSING_AGGREGATING
Constant for aggregating processor.- See Also:
- Constant Field Values
-
GRADLE_PROCESSING_ISOLATING
protected static final java.lang.String GRADLE_PROCESSING_ISOLATING
Constant for isolating processor.- See Also:
- Constant Field Values
-
messager
protected javax.annotation.processing.Messager messager
-
filer
protected javax.annotation.processing.Filer filer
-
elementUtils
protected javax.lang.model.util.Elements elementUtils
-
typeUtils
protected javax.lang.model.util.Types typeUtils
-
annotationUtils
protected AnnotationUtils annotationUtils
-
genericUtils
protected GenericUtils genericUtils
-
modelUtils
protected ModelUtils modelUtils
-
visitorAttributes
protected io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> visitorAttributes
-
classWriterOutputVisitor
protected AnnotationProcessingOutputVisitor classWriterOutputVisitor
-
javaVisitorContext
protected JavaVisitorContext javaVisitorContext
-
-
Method Detail
-
init
public void init(javax.annotation.processing.ProcessingEnvironment processingEnv)
- Specified by:
initin interfacejavax.annotation.processing.Processor
-
hasVisitors
protected boolean hasVisitors()
Does this process have any visitors.- Returns:
- True if visitors are present.
-
getLoadedVisitors
protected java.util.List<LoadedVisitor> getLoadedVisitors()
- Returns:
- The loaded visitors.
-
getIncrementalProcessorKind
protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getIncrementalProcessorKind()
- Returns:
- The incremental processor type.
- See Also:
GRADLE_PROCESSING_AGGREGATING,GRADLE_PROCESSING_ISOLATING
-
getSupportedAnnotationTypes
public java.util.Set<java.lang.String> getSupportedAnnotationTypes()
- Specified by:
getSupportedAnnotationTypesin interfacejavax.annotation.processing.Processor
-
getSupportedOptions
public java.util.Set<java.lang.String> getSupportedOptions()
- Specified by:
getSupportedOptionsin interfacejavax.annotation.processing.Processor
-
process
public boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)- Specified by:
processin interfacejavax.annotation.processing.Processor- Specified by:
processin classjavax.annotation.processing.AbstractProcessor
-
findTypeElementVisitors
@NonNull protected java.util.Collection<io.micronaut.inject.visitor.TypeElementVisitor> findTypeElementVisitors()
Discovers theTypeElementVisitorinstances that are available.- Returns:
- A collection of type element visitors.
-
getSupportedSourceVersion
public javax.lang.model.SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersionin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedSourceVersionin classjavax.annotation.processing.AbstractProcessor
-
getIncrementalProcessorType
protected java.lang.String getIncrementalProcessorType()
- Returns:
- The incremental processor type.
- See Also:
GRADLE_PROCESSING_AGGREGATING,GRADLE_PROCESSING_ISOLATING
-
isProcessedAnnotation
protected boolean isProcessedAnnotation(java.lang.String annotationName)
Return whether the given annotation is processed.- Parameters:
annotationName- The annotation name- Returns:
- True if it is
-
newVisitorContext
@NonNull protected JavaVisitorContext newVisitorContext(@NonNull javax.annotation.processing.ProcessingEnvironment processingEnv)
Creates the visitor context.- Parameters:
processingEnv- The processing env- Returns:
- The context
-
getVisitorKind
@NonNull protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getVisitorKind()
obtains the visitor kind.- Returns:
- The visitor kind
-
error
protected final void error(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile error for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
error
protected final void error(java.lang.String msg, java.lang.Object... args)Produce a compile error for the given message.- Parameters:
msg- The messageargs- The string format args
-
warning
protected final void warning(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile warning for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
warning
protected final void warning(java.lang.String msg, java.lang.Object... args)Produce a compile warning for the given message.- Parameters:
msg- The messageargs- The string format args
-
note
protected final void note(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)Produce a compile note for the given element and message.- Parameters:
e- The elementmsg- The messageargs- The string format args
-
note
protected final void note(java.lang.String msg, java.lang.Object... args)Produce a compile note for the given element and message.- Parameters:
msg- The messageargs- The string format args
-
isIncremental
protected boolean isIncremental(@NonNull javax.annotation.processing.ProcessingEnvironment processingEnv)Whether incremental compilation is enabled.- Parameters:
processingEnv- The processing environment.- Returns:
- True if it is
-
-