Class EventSourcingRepository.Builder<T>

Type Parameters:
T - a generic specifying the Aggregate type contained in this Repository implementation
Enclosing class:
EventSourcingRepository<T>

public static class EventSourcingRepository.Builder<T> extends LockingRepository.Builder<T>
Builder class to instantiate a EventSourcingRepository. Can also be used to instantiate a CachingEventSourcingRepository. This Builder will check whether a Cache is provided. If this holds, the build() function returns a CachingEventSourcingRepository instead of an EventSourcingRepository.

The LockFactory is defaulted to an PessimisticLockFactory, RepositorySpanFactory is defaulted to a DefaultRepositorySpanFactory backed by a NoOpSpanFactory and the SnapshotTriggerDefinition to a NoSnapshotTriggerDefinition implementation. 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. The same criteria holds for the AggregateFactory. Either the AggregateFactory can be set directly or it will be instantiated internally based on the aggregateType. Hence, one of both is a hard requirement.

Additionally, the EventStore is a hard requirement and as such should be provided.