T
- The type of aggregate this factory createspublic class GenericAggregateFactory<T extends EventSourcedAggregateRoot> extends AbstractAggregateFactory<T>
Constructor and Description |
---|
GenericAggregateFactory(Class<T> aggregateType)
Initialize the AggregateFactory for creating instances of the given
aggregateType . |
Modifier and Type | Method and Description |
---|---|
protected T |
doCreateAggregate(Object aggregateIdentifier,
DomainEventMessage firstEvent)
Create an uninitialized Aggregate instance with the given
aggregateIdentifier . |
Class<T> |
getAggregateType()
Returns the type of aggregate this factory creates.
|
String |
getTypeIdentifier()
Returns the type identifier for this aggregate factory.
|
createAggregate, 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.protected T doCreateAggregate(Object 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 extends EventSourcedAggregateRoot>
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.public String getTypeIdentifier()
AggregateFactory
public Class<T> getAggregateType()
AggregateFactory
instanceOf
this type.Copyright © 2010-2014. All Rights Reserved.