Package org.axonframework.eventsourcing
Class GenericAggregateFactory<T>
java.lang.Object
org.axonframework.eventsourcing.AbstractAggregateFactory<T>
org.axonframework.eventsourcing.GenericAggregateFactory<T>
- Type Parameters:
T- The type of aggregate this factory creates
- All Implemented Interfaces:
AggregateFactory<T>
Aggregate factory that uses a convention to create instances of aggregates. The type must declare a no-arg
constructor accepting.
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.
- Since:
- 0.7
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionGenericAggregateFactory(Class<T> aggregateType) Initialize the AggregateFactory for creating instances of the givenaggregateType.GenericAggregateFactory(AggregateModel<T> aggregateModel) Initialize the AggregateFactory for creating instances of the givenaggregateModel. -
Method Summary
Modifier and TypeMethodDescriptionprotected TdoCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent) Create an uninitialized Aggregate instance with the givenaggregateIdentifier.Methods inherited from class org.axonframework.eventsourcing.AbstractAggregateFactory
aggregateModel, createAggregateRoot, getAggregateType, postProcessInstance
-
Constructor Details
-
GenericAggregateFactory
Initialize the AggregateFactory for creating instances of the givenaggregateType.- Parameters:
aggregateType- The type of aggregate this factory creates instances of.- Throws:
IncompatibleAggregateException- if the aggregate constructor throws an exception, or if the JVM security settings prevent the GenericAggregateFactory from calling the constructor.
-
GenericAggregateFactory
Initialize the AggregateFactory for creating instances of the givenaggregateModel.- Parameters:
aggregateModel- the model of aggregate this factory creates instances of
-
-
Method Details
-
doCreateAggregate
Create an uninitialized Aggregate instance with the givenaggregateIdentifier. The givenfirstEventcan be used to define the requirements of the aggregate to create. The givenfirstEventis never a snapshot event.- Specified by:
doCreateAggregatein classAbstractAggregateFactory<T>- Parameters:
aggregateIdentifier- The identifier of the aggregate to createfirstEvent- The first event in the Event Stream of the Aggregate- Returns:
- The aggregate instance to initialize with the Event Stream
- Throws:
IncompatibleAggregateException- if the aggregate constructor throws an exception, or if the JVM security settings prevent the GenericAggregateFactory from calling the constructor.
-