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  AggregateModelof generic typeT, describing the structure of the aggregate theAnnotationCommandHandlerAdapterwill handle. | 
| AggregateAnnotationCommandHandler.Builder<T> | aggregateType(Class<T> aggregateType)Sets the  aggregateTypeas aClass, specifying the type of aggregate anAggregateModelshould be created for. | 
| AggregateAnnotationCommandHandler<T> | build()Initializes a  AggregateAnnotationCommandHandleras specified through this Builder. | 
| AggregateAnnotationCommandHandler.Builder<T> | commandTargetResolver(CommandTargetResolver commandTargetResolver)Sets the  CommandTargetResolverused to resolve the command handling target. | 
| AggregateAnnotationCommandHandler.Builder<T> | creationPolicyAggregateFactory(CreationPolicyAggregateFactory<T> creationPolicyAggregateFactory)Sets the  CreationPolicyAggregateFactoryfor generic typeT. | 
| AggregateAnnotationCommandHandler.Builder<T> | handlerDefinition(HandlerDefinition handlerDefinition)Sets the  HandlerDefinitionused to create concrete handlers for the givenaggregateType. | 
| AggregateAnnotationCommandHandler.Builder<T> | parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)Sets the  ParameterResolverFactoryused to resolve parameters for annotated handlers contained in the
 Aggregate. | 
| AggregateAnnotationCommandHandler.Builder<T> | repository(Repository<T> repository)Sets the  Repositoryused to add and load Aggregate instances of generic typeTupon 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
                          aggregateTypepublic 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.Builder<T> creationPolicyAggregateFactory(CreationPolicyAggregateFactory<T> creationPolicyAggregateFactory)
CreationPolicyAggregateFactory for generic type T.
 
 The aggregate factory must produce a new instance of the aggregate root based on the supplied identifier.
 When dealing with a polymorphic aggregate, the given creationPolicyAggregateFactory will be used for
 every type.
creationPolicyAggregateFactory - The CreationPolicyAggregateFactory the constructs an aggregate
                                       instance based on an identifier.public 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–2025. All rights reserved.