Module io.helidon.inject.processor
Package io.helidon.inject.processor
Class InjectionAnnotationProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
io.helidon.inject.processor.InjectionAnnotationProcessor
- All Implemented Interfaces:
Processor
- Direct Known Subclasses:
ConfigDrivenProcessor
An annotation processor that will find everything needing to be processed related to core code generation.
-
Field Summary
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDeprecated.this is a Java ServiceLoader implementation and the constructor should not be used directlyprotected
InjectionAnnotationProcessor
(boolean disableBaseProcessing) Any overriding APT processor can optionally passfalse
in order to prevent duplicate base processing. -
Method Summary
Modifier and TypeMethodDescriptionprotected ActivatorCreator
Returns the activator creator in use.protected void
doFiler
(ServicesToProcess services) Code generate theseActivator
's adModuleComponent
's.void
init
(ProcessingEnvironment processingEnv) interceptAndValidate
(Collection<TypeInfo> typesToCreateActivatorsFor) Provides a means for anyone to validate and intercept the collection of types to process.protected void
process
(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Called to process a single service that will eventually be code generated.final boolean
process
(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) protected void
processBasics
(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Processes the basic Injection service type - its contracts, run level, weight, dependencies, etc.protected void
processExtensions
(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Process any extensions (e.g., config-driven) requiring extra processing or any modifications toServicesToProcess
.The set of annotations that define the service.The annotation types we handle that will be advertised as contracts.The annotation types we expect to see on method and field type elements.The annotation types we handle that will trigger activator creation.protected void
validate
(Collection<TypedElementInfo> elementsOfInterest) These are all of the elements (methods, constructors, methods) that are "interesting" (i.e., has@Inject
, etc.).Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedOptions, isInitialized
-
Constructor Details
-
InjectionAnnotationProcessor
Deprecated.this is a Java ServiceLoader implementation and the constructor should not be used directlyService loader based constructor. -
InjectionAnnotationProcessor
protected InjectionAnnotationProcessor(boolean disableBaseProcessing) Any overriding APT processor can optionally passfalse
in order to prevent duplicate base processing.- Parameters:
disableBaseProcessing
- set to true to disable base processing
-
-
Method Details
-
getSupportedAnnotationTypes
- Specified by:
getSupportedAnnotationTypes
in interfaceProcessor
-
init
-
process
- Specified by:
process
in interfaceProcessor
- Specified by:
process
in classAbstractProcessor
-
activatorCreator
Returns the activator creator in use.- Returns:
- the activator creator in use
-
supportedServiceClassTargetAnnotations
The annotation types we handle that will trigger activator creation.- Returns:
- annotation types we handle on services
-
supportedContractClassTargetAnnotations
The annotation types we handle that will be advertised as contracts.- Returns:
- annotation types we handle on contracts
-
supportedElementTargetAnnotations
The annotation types we expect to see on method and field type elements.- Returns:
- annotation types we handle on elements
-
doFiler
Code generate theseActivator
's adModuleComponent
's.- Parameters:
services
- the services to code generate- Throws:
ToolsException
- if there is problem code generating sources or resources
-
validate
These are all of the elements (methods, constructors, methods) that are "interesting" (i.e., has@Inject
, etc.).- Parameters:
elementsOfInterest
- the elements that are eligible for some form of Injection processing
-
interceptAndValidate
Provides a means for anyone to validate and intercept the collection of types to process.- Parameters:
typesToCreateActivatorsFor
- the map of types to process (where key is the proposed generated name)- Returns:
- the (possibly revised) set of types to process
-
process
protected void process(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Called to process a single service that will eventually be code generated. The default implementation will take the provided serviceTypeInfo
and translate that into theServicesToProcess
instance. Eventually, theServicesToProcess
instance will be fed as request inputs to one or more of the creators (e.g.,ActivatorCreator
,InterceptorCreator
, etc.).- Parameters:
services
- the services to process builderservice
- the service type info to process right nowserviceTypeNamesToCodeGenerate
- the entire set of types that are planned to be code-generatedallElementsOfInterest
- all of the elements of interest that injection services "knows" about
-
processBasics
protected void processBasics(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Processes the basic Injection service type - its contracts, run level, weight, dependencies, etc.- Parameters:
services
- the services to process builderservice
- the service type info to process right nowserviceTypeNamesToCodeGenerate
- the entire set of types that are planned to be code-generatedallElementsOfInterest
- all of the elements of interest that injection "knows" about
-
serviceDefiningAnnotations
The set of annotations that define the service.- Returns:
- the set of annotations that define the service
-
processExtensions
protected void processExtensions(ServicesToProcess services, TypeInfo service, Set<TypeName> serviceTypeNamesToCodeGenerate, Collection<TypedElementInfo> allElementsOfInterest) Process any extensions (e.g., config-driven) requiring extra processing or any modifications toServicesToProcess
.- Parameters:
services
- the services to process builderservice
- the service type info to process right nowserviceTypeNamesToCodeGenerate
- the entire set of types that are planned to be code-generatedallElementsOfInterest
- all of the elements of interest that injection "knows" about
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersion
in interfaceProcessor
- Overrides:
getSupportedSourceVersion
in classAbstractProcessor
-