T
- a generic specifying the Aggregate type contained in this Repository
implementationprotected abstract static class LockingRepository.Builder<T> extends AbstractRepository.Builder<T>
LockingRepository
implementations.
The LockFactory
is defaulted to a pessimistic locking strategy, implemented in the
PessimisticLockFactory
. The SpanFactory
is defaulted to a
NoOpSpanFactory
. A goal of this Builder goal is to create 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.
aggregateType, 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 |
---|---|
LockingRepository.Builder<T> |
aggregateModel(AggregateModel<T> aggregateModel)
Sets the
AggregateModel of generic type T , describing the structure of the aggregate this
Repository will store. |
LockingRepository.Builder<T> |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers for the given aggregateType . |
LockingRepository.Builder<T> |
lockFactory(LockFactory lockFactory)
Sets the
LockFactory used to lock an aggregate. |
LockingRepository.Builder<T> |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameters for annotated handlers contained in the
Aggregate. |
LockingRepository.Builder<T> |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
LockingRepository.Builder<T> |
subtype(Class<? extends T> subtype)
Sets a subtype of the
aggregate type represented by this Repository . |
LockingRepository.Builder<T> |
subtypes(Set<Class<? extends T>> subtypes)
Sets the subtypes of the
aggregate type represented by this Repository . |
buildAggregateModel, validate
protected Builder(Class<T> aggregateType)
aggregateType
.aggregateType
- the aggregateType
specifying the type of aggregate this Repository
will
storepublic LockingRepository.Builder<T> parameterResolverFactory(@Nonnull ParameterResolverFactory parameterResolverFactory)
AbstractRepository.Builder
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
in class AbstractRepository.Builder<T>
parameterResolverFactory
- a ParameterResolverFactory
used to resolve parameters for annotated
handlers contained in the Aggregatepublic LockingRepository.Builder<T> handlerDefinition(@Nonnull HandlerDefinition handlerDefinition)
AbstractRepository.Builder
HandlerDefinition
used to create concrete handlers for the given aggregateType
. Only
used if the aggregateType
approach is selected to create an AggregateModel
.handlerDefinition
in class AbstractRepository.Builder<T>
handlerDefinition
- a HandlerDefinition
used to create concrete handlers for the given aggregateType
.public LockingRepository.Builder<T> aggregateModel(@Nonnull AggregateModel<T> aggregateModel)
AbstractRepository.Builder
AggregateModel
of generic type T
, describing the structure of the aggregate this
Repository
will store.aggregateModel
in class AbstractRepository.Builder<T>
aggregateModel
- the AggregateModel
of generic type T
of the aggregate this Repository
will storepublic LockingRepository.Builder<T> subtypes(@Nonnull Set<Class<? extends T>> subtypes)
AbstractRepository.Builder
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
in class AbstractRepository.Builder<T>
subtypes
- The subtypes of the aggregate type
represented by this
Repository
.public LockingRepository.Builder<T> subtype(@Nonnull Class<? extends T> subtype)
AbstractRepository.Builder
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
in class AbstractRepository.Builder<T>
subtype
- A subtypes of the aggregate type
represented by this
Repository
.public LockingRepository.Builder<T> spanFactory(SpanFactory spanFactory)
AbstractRepository.Builder
SpanFactory
implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory
by default, which provides no tracing capabilities.spanFactory
in class AbstractRepository.Builder<T>
spanFactory
- The SpanFactory
implementationpublic LockingRepository.Builder<T> lockFactory(LockFactory lockFactory)
LockFactory
used to lock an aggregate. Defaults to a pessimistic locking strategy,
implemented in the PessimisticLockFactory
.lockFactory
- a LockFactory
used to lock an aggregateCopyright © 2010–2023. All rights reserved.