java.lang.Object
io.helidon.inject.tools.ServicesToProcess
- All Implemented Interfaces:
Resettable
Tracks the services to process, and ingests them to build the codegen model.
The basic flow:
'annotation processor(s)' -> ServicesToProcess -> AbstractCreator
derivative.
Note that the flow might be repeated multiple times since annotation processors by definition are recurrent in nature.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAccessLevel
(TypeName serviceTypeName, AccessModifier access) Introduce the parent superclass for a given service type name.void
addActivatorGenericDecl
(TypeName serviceTypeName, String activatorGenericDecl) Introduce the activator generic portion of the declaration (e.g., the "CB extends MySingletonConfig" portion ofMyService$$injectionActivator<CB extends MySingletonConfig>
).void
addDeclaredRunLevel
(TypeName serviceTypeName, Integer runLevel) Sets the run level for a service type name.void
addDeclaredWeight
(TypeName serviceTypeName, Double weight) Sets the weight of a service type.void
addDependencies
(io.helidon.inject.api.DependenciesInfo dependencies) Introduces a new set of dependencies to the model.void
addExternalRequiredModules
(TypeName serviceTypeName, Collection<String> moduleNames) Introduces the need for external modules.void
addExtraActivatorClassComments
(TypeName serviceTypeName, String codeGen) Adds extra cactivator class level comments.void
addExtraCodeGen
(TypeName serviceTypeName, String codeGen) Adds extra code gen per service type.void
addInterceptorPlanFor
(TypeName serviceTypeName, Optional<io.helidon.inject.tools.InterceptionPlan> plan) Sets theInterceptionPlan
for the given service type.void
addIsAbstract
(TypeName serviceTypeName, boolean isAbstract) Introduce the flag whether the given service type name is abstract (i.e., interface or abstract) and not concrete.static void
addOnDoneRunnable
(Runnable runnable) Called to add a runnable to call when done with all annotation processing.boolean
addParentServiceType
(TypeName serviceTypeName, TypeName parentServiceTypeName) Introduce the parent superclass for a given service type name.boolean
addParentServiceType
(TypeName serviceTypeName, TypeName parentServiceTypeName, Optional<Boolean> lockParent) Introduce the parent superclass for a given service type name.void
addPostConstructMethod
(TypeName serviceTypeName, String postConstructMethodName) Introduces aPostConstruct
method to the model for a given service type.void
addPreDestroyMethod
(TypeName serviceTypeName, String preDestroyMethodName) Introduces aPreDestroy
method to the model for a given service type.void
addProviderFor
(TypeName serviceTypeName, Set<TypeName> providerFor) Establishes the fact that a given service type is aProvider
type for the given provided types.void
addQualifiers
(TypeName serviceTypeName, Set<io.helidon.inject.api.Qualifier> qualifiers) Sets the qualifiers associated with a service type.void
addScopeTypeName
(TypeName serviceTypeName, TypeName scopeTypeName) Adds a scope type name for a service type name.void
addServiceTypeHierarchy
(TypeName serviceTypeName, List<TypeName> serviceTypeHierarchy) Introduce the parent superclass for a given service type name.void
addTypeForContract
(TypeName serviceTypeName, TypeName contractTypeName, boolean isExternal) Introduces a contract associated with a service type.void
Clears out just the interceptor plans.void
Clears the module name.static ServicesToProcess
create()
Creates a new instance, apart from the current global singleton instance exposed fromservicesInstance()
.void
defaultConstructor
(TypeName serviceType, String constructor) Use a custom default constructor code.Fetches the set of known service type names being code generated in this batch.void
Sets the service type names being code generated in this batch.boolean
hasContractsFor
(TypeName serviceTypeName) Checks whether the service type has an established set of contracts that are known for it.boolean
hasHierarchyFor
(TypeName serviceTypeName) Checks whether the service type has an established super class hierarchy set.boolean
hasVisitedInterceptorPlanFor
(TypeName serviceTypeName) Checks whether the service type has been evaluated for an interceptor plan.The interception plan for each service type that has a non-null interception plan.void
lastGeneratedPackageName
(String lastGeneratedPackageName) Sets the last generated package name.void
lastKnownModuleInfoDescriptor
(io.helidon.inject.tools.ModuleInfoDescriptor descriptor) The last known descriptor being processed.void
lastKnownModuleInfoFilePath
(Path lastKnownModuleInfoFile) The last known file path location for the module-info descriptor being processed.void
lastKnownSourcePathBeingProcessed
(Path lastKnownSourcePathBeingProcessed) Sets the last known source path being processed.void
lastKnownTypeSuffix
(String typeSuffix) Sets the last known type suffix (e.g., "test").This module name.void
moduleName
(String moduleName) Sets this module name.static void
onBeginProcessing
(Messager processor, Set<?> annotations, RoundEnvironment roundEnv) Called to signal the beginning of an annotation processing phase.static void
onEndProcessing
(Messager processor, Set<?> annotations, RoundEnvironment roundEnv) Called to signal the end of an annotation processing phase.boolean
reset
(boolean ignoredDeep) Resets the state of this object.Fetches the map of service types to their run levels.Fetches the map of service types to their scope type names.static ServicesToProcess
The current services to process instance.Fetches the set of known service type names being processed in this batch.Fetches the map of service types to their priorities.
-
Method Details
-
servicesInstance
The current services to process instance.- Returns:
- the current services to process instance
-
create
Creates a new instance, apart from the current global singleton instance exposed fromservicesInstance()
.- Returns:
- the new instance
- See Also:
-
onBeginProcessing
public static void onBeginProcessing(Messager processor, Set<?> annotations, RoundEnvironment roundEnv) Called to signal the beginning of an annotation processing phase.- Parameters:
processor
- the processor runningannotations
- the annotations being processedroundEnv
- the round env
-
addOnDoneRunnable
Called to add a runnable to call when done with all annotation processing.- Parameters:
runnable
- the runnable to call
-
onEndProcessing
public static void onEndProcessing(Messager processor, Set<?> annotations, RoundEnvironment roundEnv) Called to signal the end of an annotation processing phase.- Parameters:
processor
- the processor runningannotations
- the annotations being processedroundEnv
- the round env
-
reset
public boolean reset(boolean ignoredDeep) Description copied from interface:Resettable
Resets the state of this object.- Specified by:
reset
in interfaceResettable
- Parameters:
ignoredDeep
- true to iterate over any contained objects, to reflect the reset into the retained object- Returns:
- returns true if the state was changed
-
addParentServiceType
Introduce the parent superclass for a given service type name.- Parameters:
serviceTypeName
- the service type nameparentServiceTypeName
- the parent for this service type name- Returns:
- flag indicating whether the parent was accepted
-
addParentServiceType
public boolean addParentServiceType(TypeName serviceTypeName, TypeName parentServiceTypeName, Optional<Boolean> lockParent) Introduce the parent superclass for a given service type name.- Parameters:
serviceTypeName
- the service type nameparentServiceTypeName
- the parent for this service type namelockParent
- flag indicating whether the parent should be locked- Returns:
- flag indicating whether the parent was accepted
-
addActivatorGenericDecl
Introduce the activator generic portion of the declaration (e.g., the "CB extends MySingletonConfig" portion ofMyService$$injectionActivator<CB extends MySingletonConfig>
).- Parameters:
serviceTypeName
- the service type nameactivatorGenericDecl
- the generics portion of the class decl
-
addAccessLevel
Introduce the parent superclass for a given service type name.- Parameters:
serviceTypeName
- the service type nameaccess
- the access level for the service type name- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addIsAbstract
Introduce the flag whether the given service type name is abstract (i.e., interface or abstract) and not concrete.- Parameters:
serviceTypeName
- the service type nameisAbstract
- whether the service type name is abstract (i.e., interface or abstract)
-
addServiceTypeHierarchy
Introduce the parent superclass for a given service type name.- Parameters:
serviceTypeName
- the service type nameserviceTypeHierarchy
- the list of superclasses (where this service type is the last in the list)- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
hasHierarchyFor
Checks whether the service type has an established super class hierarchy set.- Parameters:
serviceTypeName
- the service type name- Returns:
- true if the hierarchy is known for this service type
-
hasContractsFor
Checks whether the service type has an established set of contracts that are known for it.- Parameters:
serviceTypeName
- the service type name- Returns:
- true if contracts are known about this service type
-
hasVisitedInterceptorPlanFor
Checks whether the service type has been evaluated for an interceptor plan.- Parameters:
serviceTypeName
- the service type name- Returns:
- true if this service type has already been considered for interceptors
-
addInterceptorPlanFor
public void addInterceptorPlanFor(TypeName serviceTypeName, Optional<io.helidon.inject.tools.InterceptionPlan> plan) Sets theInterceptionPlan
for the given service type.- Parameters:
serviceTypeName
- the service type nameplan
- the interceptor plan- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
interceptorPlans
The interception plan for each service type that has a non-null interception plan.- Returns:
- the interception plan for each service type
-
clearInterceptorPlans
public void clearInterceptorPlans()Clears out just the interceptor plans. -
addExtraCodeGen
Adds extra code gen per service type.- Parameters:
serviceTypeName
- the service type namecodeGen
- the extra code gen to tack onto the activator implementation
-
addExtraActivatorClassComments
Adds extra cactivator class level comments.- Parameters:
serviceTypeName
- the service type namecodeGen
- the extra comments tack onto the activator implementation
-
addTypeForContract
public void addTypeForContract(TypeName serviceTypeName, TypeName contractTypeName, boolean isExternal) Introduces a contract associated with a service type.- Parameters:
serviceTypeName
- the service type namecontractTypeName
- the contract type nameisExternal
- whether the contract is external
-
addDependencies
public void addDependencies(io.helidon.inject.api.DependenciesInfo dependencies) Introduces a new set of dependencies to the model.- Parameters:
dependencies
- the dependencies
-
addPreDestroyMethod
Introduces aPreDestroy
method to the model for a given service type.- Parameters:
serviceTypeName
- the service type namepreDestroyMethodName
- the method name- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addPostConstructMethod
Introduces aPostConstruct
method to the model for a given service type.- Parameters:
serviceTypeName
- the service type namepostConstructMethodName
- the method name- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addDeclaredWeight
Sets the weight of a service type.- Parameters:
serviceTypeName
- the service type nameweight
- the weight priority- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addDeclaredRunLevel
Sets the run level for a service type name.- Parameters:
serviceTypeName
- the service type namerunLevel
- its run level- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addScopeTypeName
Adds a scope type name for a service type name.- Parameters:
serviceTypeName
- the service type namescopeTypeName
- its scope type name
-
addProviderFor
Establishes the fact that a given service type is aProvider
type for the given provided types.- Parameters:
serviceTypeName
- the service type nameproviderFor
- the types that it provides- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
addQualifiers
public void addQualifiers(TypeName serviceTypeName, Set<io.helidon.inject.api.Qualifier> qualifiers) Sets the qualifiers associated with a service type.- Parameters:
serviceTypeName
- the service type namequalifiers
- its qualifiers- Throws:
IllegalStateException
- thrown if internal state inconsistencies are found
-
serviceTypeNames
Fetches the set of known service type names being processed in this batch.- Returns:
- the list of known service type names being processed
-
generatedServiceTypeNames
Fetches the set of known service type names being code generated in this batch.- Returns:
- the list of known service type names being code generated
-
generatedServiceTypeNames
Sets the service type names being code generated in this batch.- Parameters:
coll
- the collection of services to be code generated
-
weightedPriorities
Fetches the map of service types to their priorities.- Returns:
- the map of service types to their priorities
-
runLevels
Fetches the map of service types to their run levels.- Returns:
- the map of service types to their run levels
-
scopeTypeNames
Fetches the map of service types to their scope type names.- Returns:
- the map of service types to their scope type names
-
addExternalRequiredModules
Introduces the need for external modules.- Parameters:
serviceTypeName
- the service type namemoduleNames
- the required module names to support known external contracts
-
moduleName
Sets this module name.- Parameters:
moduleName
- the module name
-
clearModuleName
public void clearModuleName()Clears the module name. -
moduleName
This module name.- Returns:
- this module name
-
lastKnownModuleInfoDescriptor
public void lastKnownModuleInfoDescriptor(io.helidon.inject.tools.ModuleInfoDescriptor descriptor) The last known descriptor being processed.- Parameters:
descriptor
- the descriptor
-
lastKnownModuleInfoFilePath
The last known file path location for the module-info descriptor being processed.- Parameters:
lastKnownModuleInfoFile
- the file path location for the descriptor
-
lastKnownSourcePathBeingProcessed
Sets the last known source path being processed.- Parameters:
lastKnownSourcePathBeingProcessed
- the last source path being processed
-
lastKnownTypeSuffix
Sets the last known type suffix (e.g., "test").- Parameters:
typeSuffix
- the optional type suffix
-
lastGeneratedPackageName
Sets the last generated package name.- Parameters:
lastGeneratedPackageName
- the package name
-
defaultConstructor
Use a custom default constructor code.- Parameters:
serviceType
- type of serviceconstructor
- constructor generated code
-