T
- The type of aggregate this factory createspublic class GenericAggregateFactory<T> extends AbstractAggregateFactory<T>
If the constructor is not accessible (not public), and the JVM's security setting allow it, the GenericAggregateFactory will try to make it accessible. If that doesn't succeed, an exception is thrown.
Constructor and Description |
---|
GenericAggregateFactory(AggregateModel<T> aggregateModel)
Initialize the AggregateFactory for creating instances of the given
aggregateModel . |
GenericAggregateFactory(Class<T> aggregateType)
Initialize the AggregateFactory for creating instances of the given
aggregateType . |
Modifier and Type | Method and Description |
---|---|
protected T |
doCreateAggregate(String aggregateIdentifier,
DomainEventMessage firstEvent)
Create an uninitialized Aggregate instance with the given
aggregateIdentifier . |
aggregateModel, createAggregateRoot, getAggregateType, postProcessInstance
public GenericAggregateFactory(Class<T> aggregateType)
aggregateType
.aggregateType
- The type of aggregate this factory creates instances of.IncompatibleAggregateException
- if the aggregate constructor throws an exception, or if the JVM security
settings prevent the GenericAggregateFactory from calling the
constructor.public GenericAggregateFactory(AggregateModel<T> aggregateModel)
aggregateModel
.aggregateModel
- the model of aggregate this factory creates instances ofprotected T doCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent)
aggregateIdentifier
. The given firstEvent
can be used to define the requirements of the aggregate to create.
The given firstEvent
is never a snapshot event.
doCreateAggregate
in class AbstractAggregateFactory<T>
aggregateIdentifier
- The identifier of the aggregate to createfirstEvent
- The first event in the Event Stream of the AggregateIncompatibleAggregateException
- if the aggregate constructor throws an exception, or if the JVM security
settings prevent the GenericAggregateFactory from calling the
constructor.Copyright © 2010–2024. All rights reserved.