T
- the type of aggregate this AggregateAnnotationCommandHandler
handles commands forpublic static class AggregateAnnotationCommandHandler.Builder<T> extends Object
AggregateAnnotationCommandHandler
.
The CommandTargetResolver
is defaulted to an AnnotationCommandTargetResolver
The Repository
is a hard requirement and as such should be provided.
Next to that, this Builder's goal is to provide an AggregateModel
(describing the structure of a given
aggregate). To instantiate this AggregateModel, either an AggregateModel can be provided directly or an
aggregateType
of type Class
can be used. The latter will internally resolve to an
AggregateModel. Thus, either the AggregateModel or the aggregateType
should be provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AggregateAnnotationCommandHandler.Builder<T> |
aggregateModel(AggregateModel<T> aggregateModel)
Sets the
AggregateModel of generic type T , describing the structure of the aggregate the
AnnotationCommandHandlerAdapter will handle. |
AggregateAnnotationCommandHandler.Builder<T> |
aggregateType(Class<T> aggregateType)
Sets the
aggregateType as a Class , specifying the type of aggregate an AggregateModel
should be created for. |
AggregateAnnotationCommandHandler<T> |
build()
Initializes a
AggregateAnnotationCommandHandler as specified through this Builder. |
AggregateAnnotationCommandHandler.Builder<T> |
commandTargetResolver(CommandTargetResolver commandTargetResolver)
Sets the
CommandTargetResolver used to resolve the command handling target. |
AggregateAnnotationCommandHandler.Builder<T> |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers for the given aggregateType . |
AggregateAnnotationCommandHandler.Builder<T> |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameters for annotated handlers contained in the
Aggregate. |
AggregateAnnotationCommandHandler.Builder<T> |
repository(Repository<T> repository)
Sets the
Repository used to add and load Aggregate instances of generic type T upon handling
commands for it. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public AggregateAnnotationCommandHandler.Builder<T> repository(Repository<T> repository)
Repository
used to add and load Aggregate instances of generic type T
upon handling
commands for it.repository
- a Repository
used to add and load Aggregate instances of generic type T
upon handling commands for itpublic AggregateAnnotationCommandHandler.Builder<T> commandTargetResolver(CommandTargetResolver commandTargetResolver)
CommandTargetResolver
used to resolve the command handling target. Defaults to an
AnnotationCommandTargetResolver
.commandTargetResolver
- a CommandTargetResolver
used to resolve the command handling targetpublic AggregateAnnotationCommandHandler.Builder<T> aggregateType(Class<T> aggregateType)
aggregateType
as a Class
, specifying the type of aggregate an AggregateModel
should be created for. Either this field or the aggregateModel(AggregateModel)
should be provided to
correctly instantiate an AggregateAnnotationCommandHandler
.aggregateType
- the aggregateType
specifying the type of aggregate an AggregateModel
should be instantiated forpublic AggregateAnnotationCommandHandler.Builder<T> parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
ParameterResolverFactory
used to resolve parameters for annotated handlers contained in the
Aggregate. Only used if the aggregateType
approach is selected to create an AggregateModel
.parameterResolverFactory
- a ParameterResolverFactory
used to resolve parameters for annotated
handlers contained in the Aggregatepublic AggregateAnnotationCommandHandler.Builder<T> handlerDefinition(HandlerDefinition handlerDefinition)
HandlerDefinition
used to create concrete handlers for the given aggregateType
.
Only used if the aggregateType
approach is selected to create an AggregateModel
.handlerDefinition
- a HandlerDefinition
used to create concrete handlers for the given
aggregateType
public AggregateAnnotationCommandHandler.Builder<T> aggregateModel(AggregateModel<T> aggregateModel)
AggregateModel
of generic type T
, describing the structure of the aggregate the
AnnotationCommandHandlerAdapter
will handle. Either this field or the aggregateType(Class)
should be provided to correctly instantiate an AggregateAnnotationCommandHandler
.aggregateModel
- the AggregateModel
of generic type T
of the aggregate this
Repository
will storepublic AggregateAnnotationCommandHandler<T> build()
AggregateAnnotationCommandHandler
as specified through this Builder.AggregateAnnotationCommandHandler
as specified through this Builderprotected void validate() throws AxonConfigurationException
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2018. All rights reserved.