public abstract class AggregateLifecycle extends Object
| Constructor and Description | 
|---|
AggregateLifecycle()  | 
| Modifier and Type | Method and Description | 
|---|---|
static ApplyMore | 
apply(Object payload)
Apply a  
DomainEventMessage with given payload without metadata (though interceptors can also be used to
 provide metadata). | 
static ApplyMore | 
apply(Object payload,
     MetaData metaData)
Apply a  
DomainEventMessage with given payload and metadata (metadata from interceptors will be combined
 with the provided metadata). | 
protected abstract <T> ApplyMore | 
doApply(T payload,
       MetaData metaData)
Apply a  
DomainEventMessage with given payload and metadata (metadata from interceptors will be combined
 with the provided metadata). | 
protected abstract void | 
doMarkDeleted()
Marks this aggregate as deleted. 
 | 
protected void | 
execute(Runnable task)
Executes the given task. 
 | 
protected <V> V | 
executeWithResult(Callable<V> task)
Executes the given task and returns the result of the task. 
 | 
protected static AggregateLifecycle | 
getInstance()
Returns the  
AggregateLifecycle for the current aggregate. | 
protected abstract boolean | 
getIsLive()
Indicates whether this Aggregate instance is 'live'. 
 | 
static boolean | 
isLive()
Indicates whether this Aggregate instance is 'live'. 
 | 
static void | 
markDeleted()
Marks this aggregate as deleted, instructing a repository to remove that aggregate at an appropriate time. 
 | 
protected Runnable | 
registerAsCurrent()
Registers the current AggregateLifecycle as the current lifecycle. 
 | 
protected void | 
registerWithUnitOfWork()
Registers this aggregate with the current unit of work if one is started. 
 | 
public static ApplyMore apply(Object payload, MetaData metaData)
DomainEventMessage with given payload and metadata (metadata from interceptors will be combined
 with the provided metadata). Applying events means they are immediately applied (published) to the aggregate and
 scheduled for publication to other event handlers.
 
 The event is applied on all entities part of this aggregate. If the event is applied from an event handler of the
 aggregate and additional events need to be applied that depends on state changes brought about by the first event
 use the returned ApplyMore instance.payload - the payload of the event to applymetaData - any meta-data that must be registered with the EventApplyMorepublic static ApplyMore apply(Object payload)
DomainEventMessage with given payload without metadata (though interceptors can also be used to
 provide metadata). Applying events means they are immediately applied (published) to the aggregate and scheduled
 for publication to other event handlers.
 
 The event is applied on all entities part of this aggregate. If the event is applied from an event handler of the
 aggregate and additional events need to be applied that depends on state changes brought about by the first event
 use the returned ApplyMore instance.payload - the payload of the event to applyApplyMorepublic static boolean isLive()
true if the aggregate is 'live', false if the aggregate is initializing state based on
 historic eventspublic static void markDeleted()
protected static AggregateLifecycle getInstance()
AggregateLifecycle for the current aggregate. If none was defined this method will throw
 an exception.AggregateLifecycle for the current aggregateprotected abstract boolean getIsLive()
true if the aggregate is 'live', false if the aggregate is initializing state based on
 historic eventsprotected abstract void doMarkDeleted()
protected void registerWithUnitOfWork()
protected abstract <T> ApplyMore doApply(T payload, MetaData metaData)
DomainEventMessage with given payload and metadata (metadata from interceptors will be combined
 with the provided metadata). The event should be applied to the aggregate immediately and scheduled for
 publication to other event handlers.
 
 The event should be applied on all entities part of this aggregate. If the event is applied from an event handler
 of the aggregate and additional events need to be applied that depends on state changes brought about by the
 first event the returned ApplyMore instance should allow for additional events to be applied after this
 event.payload - the payload of the event to applymetaData - any meta-data that must be registered with the EventApplyMoreprotected <V> V executeWithResult(Callable<V> task) throws Exception
V - the result of the tasktask - the task to execute on the aggregateException - if executing the task causes an exceptionprotected Runnable registerAsCurrent()
protected void execute(Runnable task)
task - the task to execute on the aggregateCopyright © 2010–2018. All rights reserved.