T - a generic specifying the Aggregate type contained in this Repository implementationpublic abstract static class AbstractRepository.Builder<T> extends Object
AbstractRepository implementations.
This Builder's main goal is to build an AggregateModel specifying generic T as the aggregate type
to be stored. All aggregates in this repository must be instanceOf this aggregate type. 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.
The SpanFactory defaults to a NoOpSpanFactory.
| Modifier and Type | Field and Description |
|---|---|
protected Class<T> |
aggregateType |
protected Set<Class<? extends T>> |
subtypes |
| Modifier | Constructor and Description |
|---|---|
protected |
Builder(Class<T> aggregateType)
Creates a builder for a Repository for given
aggregateType. |
| Modifier and Type | Method and Description |
|---|---|
AbstractRepository.Builder<T> |
aggregateModel(AggregateModel<T> aggregateModel)
Sets the
AggregateModel of generic type T, describing the structure of the aggregate this
Repository will store. |
protected AggregateModel<T> |
buildAggregateModel()
Instantiate the
AggregateModel of generic type T describing the structure of the Aggregate
this Repository will store. |
AbstractRepository.Builder<T> |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers for the given aggregateType. |
AbstractRepository.Builder<T> |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameters for annotated handlers contained in the
Aggregate. |
AbstractRepository.Builder<T> |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
AbstractRepository.Builder<T> |
subtype(Class<? extends T> subtype)
Sets a subtype of the
aggregate type represented by this Repository. |
AbstractRepository.Builder<T> |
subtypes(Set<Class<? extends T>> subtypes)
Sets the subtypes of the
aggregate type represented by this Repository. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
protected Builder(Class<T> aggregateType)
aggregateType.aggregateType - the aggregateType specifying the type of aggregate this Repository will
storepublic AbstractRepository.Builder<T> parameterResolverFactory(@Nonnull 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 AbstractRepository.Builder<T> handlerDefinition(@Nonnull 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 AbstractRepository.Builder<T> aggregateModel(@Nonnull AggregateModel<T> aggregateModel)
AggregateModel of generic type T, describing the structure of the aggregate this
Repository will store.aggregateModel - the AggregateModel of generic type T of the aggregate this Repository will storepublic AbstractRepository.Builder<T> subtypes(@Nonnull Set<Class<? extends T>> subtypes)
aggregate type represented by this Repository.
Defining subtypes indicates this Repository supports polymorphic aggregate structure.
Only used if the aggregate model is not explicitly set. Defaults to
an empty Set.
subtypes - The subtypes of the aggregate type represented by this
Repository.public AbstractRepository.Builder<T> subtype(@Nonnull Class<? extends T> subtype)
aggregate type represented by this Repository.
Defining a subtype indicates this Repository supports a polymorphic aggregate structure.
Only used if the aggregate model is not explicitly set.
subtype - A subtypes of the aggregate type represented by this
Repository.public AbstractRepository.Builder<T> spanFactory(SpanFactory spanFactory)
SpanFactory implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory by default, which provides no tracing capabilities.spanFactory - The SpanFactory implementationprotected AggregateModel<T> buildAggregateModel()
AggregateModel of generic type T describing the structure of the Aggregate
this Repository will store.AggregateModel of generic type T describing the Aggregate this Repository
will storeprotected void validate()
throws AxonConfigurationException
AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2023. All rights reserved.