Class AbstractConfiguredAnnotationBuilder<O,I,B extends AnnotationBuilder<O>>
java.lang.Object
org.springframework.statemachine.config.common.annotation.AbstractAnnotationBuilder<O>
org.springframework.statemachine.config.common.annotation.AbstractConfiguredAnnotationBuilder<O,I,B>
- Type Parameters:
O- The object that this builder returnsI- The interface of type BB- The type of this builder (that is returned by the base class)
- All Implemented Interfaces:
AnnotationBuilder<O>
- Direct Known Subclasses:
StateMachineConfigBuilder,StateMachineConfigurationBuilder,StateMachineModelBuilder,StateMachineStateBuilder,StateMachineTransitionBuilder
public abstract class AbstractConfiguredAnnotationBuilder<O,I,B extends AnnotationBuilder<O>>
extends AbstractAnnotationBuilder<O>
A base
AnnotationBuilder that allows AnnotationConfigurers to be
applied to it. This makes modifying the AnnotationBuilder a strategy
that can be customised and broken up into a number of
AnnotationConfigurer objects that have more specific goals than that
of the AnnotationBuilder.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates a new annotation builder.protectedAbstractConfiguredAnnotationBuilder(ObjectPostProcessor<Object> objectPostProcessor) Instantiates a new annotation builder.protectedAbstractConfiguredAnnotationBuilder(ObjectPostProcessor<Object> objectPostProcessor, boolean allowConfigurersOfSameType) Instantiates a new annotation builder. -
Method Summary
Modifier and TypeMethodDescription<C extends AnnotationConfigurerAdapter<O,I, B>>
Capply(C configurer) Applies aAnnotationConfigurerAdapterto thisAnnotationBuilderand invokesAnnotationConfigurerAdapter.setBuilder(AnnotationBuilder).protected voidInvoked prior to invoking each mainAnnotationConfigurer.configure(AnnotationBuilder)method.protected voidInvoked prior to invoking each postAnnotationConfigurer.configure(AnnotationBuilder)method.protected voidInvoked prior to invoking eachAnnotationConfigurer.init(AnnotationBuilder)method.protected final OdoBuild()Subclasses should implement this to perform the build.<C extends AnnotationConfigurer<O,B>>
CgetConfigurer(Class<C> clazz) Gets theAnnotationConfigurerby its class name ornullif not found.<C extends AnnotationConfigurer<O,B>>
List<C>getConfigurers(Class<C> clazz) Gets all theAnnotationConfigurerinstances by its class name or an empty List if not found.<C extends AnnotationConfigurerAdapter<O,I, B>>
CgetOrApply(C configurer) Similar toapply(AnnotationConfigurer)but checks the state to determine ifapply(AnnotationConfigurer)needs to be called first.Similar toAbstractAnnotationBuilder.build()andAbstractAnnotationBuilder.getObject()but checks the state to determine ifAbstractAnnotationBuilder.build()needs to be called first.<C> CgetSharedObject(Class<C> sharedType) Gets a shared Object.Gets the shared objects.objectPostProcessor(ObjectPostProcessor<Object> objectPostProcessor) Specifies theObjectPostProcessorto use.protected abstract OSubclasses must implement this method to build the object that is being returned.protected <P> PpostProcess(P object) Performs post processing of an object.<C extends AnnotationConfigurer<O,B>>
CremoveConfigurer(Class<C> clazz) Removes and returns theAnnotationConfigurerby its class name ornullif not found.<C extends AnnotationConfigurer<O,B>>
List<C>removeConfigurers(Class<C> clazz) Removes all theAnnotationConfigurerinstances by its class name or an empty List if not found.<C> voidsetSharedObject(Class<C> sharedType, C object) Sets an object that is shared by multipleAnnotationConfigurer.Methods inherited from class org.springframework.statemachine.config.common.annotation.AbstractAnnotationBuilder
build, getObject
-
Constructor Details
-
AbstractConfiguredAnnotationBuilder
protected AbstractConfiguredAnnotationBuilder()Instantiates a new annotation builder. -
AbstractConfiguredAnnotationBuilder
Instantiates a new annotation builder.- Parameters:
objectPostProcessor- the object post processor
-
AbstractConfiguredAnnotationBuilder
protected AbstractConfiguredAnnotationBuilder(ObjectPostProcessor<Object> objectPostProcessor, boolean allowConfigurersOfSameType) Instantiates a new annotation builder.- Parameters:
objectPostProcessor- the object post processorallowConfigurersOfSameType- the allow configurers of same type
-
-
Method Details
-
doBuild
Description copied from class:AbstractAnnotationBuilderSubclasses should implement this to perform the build.- Specified by:
doBuildin classAbstractAnnotationBuilder<O>- Returns:
- the object that should be returned by
AbstractAnnotationBuilder.build(). - Throws:
Exception- if an error occurs
-
getOrBuild
Similar toAbstractAnnotationBuilder.build()andAbstractAnnotationBuilder.getObject()but checks the state to determine ifAbstractAnnotationBuilder.build()needs to be called first.- Returns:
- the result of
AbstractAnnotationBuilder.build()orAbstractAnnotationBuilder.getObject(). If an error occurs while building, returns null.
-
apply
Applies aAnnotationConfigurerAdapterto thisAnnotationBuilderand invokesAnnotationConfigurerAdapter.setBuilder(AnnotationBuilder).- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
configurer- the configurer- Returns:
- Configurer passed as parameter
- Throws:
Exception- if error occurred
-
getOrApply
Similar toapply(AnnotationConfigurer)but checks the state to determine ifapply(AnnotationConfigurer)needs to be called first.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
configurer- the configurer- Returns:
- Configurer passed as parameter
- Throws:
Exception- if error occurred
-
apply
Applies aAnnotationConfigurerto thisAnnotationBuilderoverriding anyAnnotationConfigurerof the exact same class. Note that object hierarchies are not considered.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
configurer- the configurer- Returns:
- Configurer passed as parameter
- Throws:
Exception- if error occurred
-
getConfigurers
Gets all theAnnotationConfigurerinstances by its class name or an empty List if not found. Note that object hierarchies are not considered.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
clazz- theAnnotationConfigurerclass to look for- Returns:
- All configurers
-
removeConfigurers
Removes all theAnnotationConfigurerinstances by its class name or an empty List if not found. Note that object hierarchies are not considered.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
clazz- theAnnotationConfigurerclass to look for- Returns:
- Empty list of configurers
-
getConfigurer
Gets theAnnotationConfigurerby its class name ornullif not found. Note that object hierarchies are not considered.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
clazz- the configurer class type- Returns:
- Matched configurers
-
removeConfigurer
Removes and returns theAnnotationConfigurerby its class name ornullif not found. Note that object hierarchies are not considered.- Type Parameters:
C- type of AnnotationConfigurer- Parameters:
clazz- the configurer class type- Returns:
- Matched configurers
-
objectPostProcessor
Specifies theObjectPostProcessorto use.- Parameters:
objectPostProcessor- theObjectPostProcessorto use. Cannot be null- Returns:
- the
AnnotationBuilderfor further customizations
-
postProcess
protected <P> P postProcess(P object) Performs post processing of an object. The default is to delegate to theObjectPostProcessor.- Type Parameters:
P- type of processed object- Parameters:
object- the Object to post process- Returns:
- the possibly modified Object to use
-
beforeInit
Invoked prior to invoking eachAnnotationConfigurer.init(AnnotationBuilder)method. Subclasses may override this method to hook into the lifecycle without using aAnnotationConfigurer.- Throws:
Exception- if error occurred
-
beforeConfigureMains
Invoked prior to invoking each mainAnnotationConfigurer.configure(AnnotationBuilder)method. Subclasses may override this method to hook into the lifecycle without using aAnnotationConfigurer.- Throws:
Exception- if error occurred
-
beforeConfigurePosts
Invoked prior to invoking each postAnnotationConfigurer.configure(AnnotationBuilder)method. Subclasses may override this method to hook into the lifecycle without using aAnnotationConfigurer.- Throws:
Exception- if error occurred
-
performBuild
Subclasses must implement this method to build the object that is being returned.- Returns:
- Object build by this builder
- Throws:
Exception- if error occurred
-