T
- The type of aggregate generated by this aggregate factorypublic class SpringPrototypeAggregateFactory<T extends EventSourcedAggregateRoot> extends AbstractAggregateFactory<T> implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanNameAware
Constructor and Description |
---|
SpringPrototypeAggregateFactory() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
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.
|
protected T |
postProcessInstance(T aggregate)
Perform any processing that must be done on an aggregate instance that was reconstructed from a Snapshot
Event.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanName(String beanName) |
void |
setParameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the parameter resolver with which parameters of annotated event handlers in the aggregae are resolved.
|
void |
setPrototypeBeanName(String prototypeBeanName)
Sets the name of the prototype bean this repository serves.
|
void |
setTypeIdentifier(String typeIdentifier)
Sets the type identifier of the aggregate served by this repository.
|
createAggregate
public T doCreateAggregate(Object aggregateIdentifier, DomainEventMessage firstEvent)
AbstractAggregateFactory
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 Aggregateprotected T postProcessInstance(T aggregate)
AbstractAggregateFactory
postProcessInstance
in class AbstractAggregateFactory<T extends EventSourcedAggregateRoot>
aggregate
- The aggregate to post-process.public String getTypeIdentifier()
AggregateFactory
getTypeIdentifier
in interface AggregateFactory<T extends EventSourcedAggregateRoot>
public Class<T> getAggregateType()
AggregateFactory
instanceOf
this type.getAggregateType
in interface AggregateFactory<T extends EventSourcedAggregateRoot>
public void setPrototypeBeanName(String prototypeBeanName)
prototypeBeanName
- the name of the prototype bean this repository serves.public void setTypeIdentifier(String typeIdentifier)
typeIdentifier
- the type identifier of the aggregate served by this repository.public void setParameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
parameterResolverFactory
- the factory that provides resolver for parameters.public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public void setBeanName(String beanName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
Copyright © 2010-2014. All Rights Reserved.