O
- The Object being built by BI
- B
- The Builder that is building O and is configured by AnnotationConfigurerAdapter
public abstract class AnnotationConfigurerAdapter<O,I,B extends AnnotationBuilder<O>> extends java.lang.Object implements AnnotationConfigurer<O,B>
AnnotationConfigurer
that allows subclasses to only
implement the methods they are interested in. It also provides a mechanism
for using the AnnotationConfigurer
and when done gaining access to the
AnnotationBuilder
that is being configured.Constructor and Description |
---|
AnnotationConfigurerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds an
ObjectPostProcessor to be used for this
AnnotationConfigurerAdapter . |
I |
and()
Return the
AnnotationBuilder when done using the
AnnotationConfigurer . |
void |
configure(B builder)
Configure the
AnnotationBuilder by setting the necessary properties
on the AnnotationBuilder . |
protected B |
getBuilder()
Gets the
AnnotationBuilder . |
void |
init(B builder)
Initialise the
AnnotationBuilder . |
boolean |
isAssignable(AnnotationBuilder<O> builder) |
void |
setBuilder(B builder)
Sets the
AnnotationBuilder to be used. |
public void init(B builder) throws java.lang.Exception
AnnotationConfigurer
AnnotationBuilder
. Here only shared state should be
created and modified, but not properties on the AnnotationBuilder
used for building the object. This ensures that the
AnnotationConfigurer.configure(AnnotationBuilder)
method uses the correct shared
objects when building.init
in interface AnnotationConfigurer<O,B extends AnnotationBuilder<O>>
builder
- the builderjava.lang.Exception
- if error occurredpublic void configure(B builder) throws java.lang.Exception
AnnotationConfigurer
AnnotationBuilder
by setting the necessary properties
on the AnnotationBuilder
.configure
in interface AnnotationConfigurer<O,B extends AnnotationBuilder<O>>
builder
- the builderjava.lang.Exception
- if error occurredpublic I and()
AnnotationBuilder
when done using the
AnnotationConfigurer
. This is useful for method chaining.AnnotationBuilder
protected final B getBuilder()
AnnotationBuilder
. Cannot be null. This method
throws IllegalStateException
if AnnotationBuilder
is null.AnnotationBuilder
public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
ObjectPostProcessor
to be used for this
AnnotationConfigurerAdapter
. The default implementation does
nothing to the object.objectPostProcessor
- the ObjectPostProcessor
to usepublic void setBuilder(B builder)
AnnotationBuilder
to be used. This is automatically set
when using
AbstractConfiguredAnnotationBuilder.apply(AnnotationConfigurerAdapter)
builder
- the AnnotationBuilder
to setpublic boolean isAssignable(AnnotationBuilder<O> builder)
isAssignable
in interface AnnotationConfigurer<O,B extends AnnotationBuilder<O>>