O - The object that this builder returnsI - B - The type of this builder (that is returned by the base class)public abstract class AbstractConfiguredAnnotationBuilder<O,I,B extends AnnotationBuilder<O>> extends AbstractAnnotationBuilder<O>
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.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConfiguredAnnotationBuilder()
Instantiates a new annotation builder.
|
protected |
AbstractConfiguredAnnotationBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
Instantiates a new annotation builder.
|
protected |
AbstractConfiguredAnnotationBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor,
boolean allowConfigurersOfSameType)
Instantiates a new annotation builder.
|
| Modifier and Type | Method and Description |
|---|---|
<C extends AnnotationConfigurer<O,B>> |
apply(C configurer)
Applies a
AnnotationConfigurer to this AnnotationBuilder
overriding any AnnotationConfigurer of the exact same class. |
<C extends AnnotationConfigurerAdapter<O,I,B>> |
apply(C configurer)
Applies a
AnnotationConfigurerAdapter to this
AnnotationBuilder and invokes
AnnotationConfigurerAdapter.setBuilder(AnnotationBuilder). |
protected void |
beforeConfigureMains()
Invoked prior to invoking each main
AnnotationConfigurer.configure(AnnotationBuilder) method. |
protected void |
beforeConfigurePosts()
Invoked prior to invoking each post
AnnotationConfigurer.configure(AnnotationBuilder) method. |
protected void |
beforeInit()
Invoked prior to invoking each
AnnotationConfigurer.init(AnnotationBuilder) method. |
protected O |
doBuild()
Subclasses should implement this to perform the build.
|
<C extends AnnotationConfigurer<O,B>> |
getConfigurer(java.lang.Class<C> clazz)
Gets the
AnnotationConfigurer by its class name or
null if not found. |
<C extends AnnotationConfigurer<O,B>> |
getConfigurers(java.lang.Class<C> clazz)
Gets all the
AnnotationConfigurer instances by its class name or an
empty List if not found. |
<C extends AnnotationConfigurerAdapter<O,I,B>> |
getOrApply(C configurer)
Similar to
apply(AnnotationConfigurer) but checks the state
to determine if apply(AnnotationConfigurer) needs to be called first. |
O |
getOrBuild()
Similar to
AbstractAnnotationBuilder.build() and AbstractAnnotationBuilder.getObject() but checks the state
to determine if AbstractAnnotationBuilder.build() needs to be called first. |
<C> C |
getSharedObject(java.lang.Class<C> sharedType)
Gets a shared Object.
|
java.util.Map<java.lang.Class<java.lang.Object>,java.lang.Object> |
getSharedObjects()
Gets the shared objects.
|
O |
objectPostProcessor(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
Specifies the
ObjectPostProcessor to use. |
protected abstract O |
performBuild()
Subclasses must implement this method to build the object that is being returned.
|
protected <P> P |
postProcess(P object)
Performs post processing of an object.
|
<C extends AnnotationConfigurer<O,B>> |
removeConfigurer(java.lang.Class<C> clazz)
Removes and returns the
AnnotationConfigurer by its class name or
null if not found. |
<C extends AnnotationConfigurer<O,B>> |
removeConfigurers(java.lang.Class<C> clazz)
Removes all the
AnnotationConfigurer instances by its class name or an
empty List if not found. |
<C> void |
setSharedObject(java.lang.Class<C> sharedType,
C object)
Sets an object that is shared by multiple
AnnotationConfigurer. |
build, getObjectprotected AbstractConfiguredAnnotationBuilder()
protected AbstractConfiguredAnnotationBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
objectPostProcessor - the object post processorprotected AbstractConfiguredAnnotationBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor, boolean allowConfigurersOfSameType)
objectPostProcessor - the object post processorallowConfigurersOfSameType - the allow configurers of same typeprotected final O doBuild() throws java.lang.Exception
AbstractAnnotationBuilderdoBuild in class AbstractAnnotationBuilder<O>AbstractAnnotationBuilder.build().java.lang.Exception - if an error occurspublic O getOrBuild()
AbstractAnnotationBuilder.build() and AbstractAnnotationBuilder.getObject() but checks the state
to determine if AbstractAnnotationBuilder.build() needs to be called first.AbstractAnnotationBuilder.build() or AbstractAnnotationBuilder.getObject(). If an
error occurs while building, returns null.public <C extends AnnotationConfigurerAdapter<O,I,B>> C apply(C configurer) throws java.lang.Exception
AnnotationConfigurerAdapter to this
AnnotationBuilder and invokes
AnnotationConfigurerAdapter.setBuilder(AnnotationBuilder).configurer - the configurerjava.lang.Exception - if error occurredpublic <C extends AnnotationConfigurerAdapter<O,I,B>> C getOrApply(C configurer) throws java.lang.Exception
apply(AnnotationConfigurer) but checks the state
to determine if apply(AnnotationConfigurer) needs to be called first.configurer - the configurerjava.lang.Exception - if error occurredpublic <C extends AnnotationConfigurer<O,B>> C apply(C configurer) throws java.lang.Exception
AnnotationConfigurer to this AnnotationBuilder
overriding any AnnotationConfigurer of the exact same class. Note
that object hierarchies are not considered.configurer - the configurerjava.lang.Exception - if error occurredpublic <C> void setSharedObject(java.lang.Class<C> sharedType,
C object)
AnnotationConfigurer.sharedType - the Class to key the shared object by.object - the Object to storepublic <C> C getSharedObject(java.lang.Class<C> sharedType)
sharedType - the type of the shared Objectpublic java.util.Map<java.lang.Class<java.lang.Object>,java.lang.Object> getSharedObjects()
public <C extends AnnotationConfigurer<O,B>> java.util.List<C> getConfigurers(java.lang.Class<C> clazz)
AnnotationConfigurer instances by its class name or an
empty List if not found. Note that object hierarchies are not considered.clazz - the AnnotationConfigurer class to look forpublic <C extends AnnotationConfigurer<O,B>> java.util.List<C> removeConfigurers(java.lang.Class<C> clazz)
AnnotationConfigurer instances by its class name or an
empty List if not found. Note that object hierarchies are not considered.clazz - the AnnotationConfigurer class to look forpublic <C extends AnnotationConfigurer<O,B>> C getConfigurer(java.lang.Class<C> clazz)
AnnotationConfigurer by its class name or
null if not found. Note that object hierarchies are not
considered.clazz - the configurer class typepublic <C extends AnnotationConfigurer<O,B>> C removeConfigurer(java.lang.Class<C> clazz)
AnnotationConfigurer by its class name or
null if not found. Note that object hierarchies are not
considered.clazz - the configurer class typepublic O objectPostProcessor(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
ObjectPostProcessor to use.objectPostProcessor - the ObjectPostProcessor to use. Cannot be nullAnnotationBuilder for further customizationsprotected <P> P postProcess(P object)
ObjectPostProcessor.object - the Object to post processprotected void beforeInit()
throws java.lang.Exception
AnnotationConfigurer.init(AnnotationBuilder) method. Subclasses may
override this method to hook into the lifecycle without using a
AnnotationConfigurer.java.lang.Exceptionprotected void beforeConfigureMains()
throws java.lang.Exception
AnnotationConfigurer.configure(AnnotationBuilder) method.
Subclasses may override this method to hook into the lifecycle without
using a AnnotationConfigurer.java.lang.Exceptionprotected void beforeConfigurePosts()
throws java.lang.Exception
AnnotationConfigurer.configure(AnnotationBuilder) method.
Subclasses may override this method to hook into the lifecycle without
using a AnnotationConfigurer.java.lang.Exceptionprotected abstract O performBuild() throws java.lang.Exception
java.lang.Exception