|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventsourcing.AbstractEventSourcedEntity
public abstract class AbstractEventSourcedEntity
Base class for Event Sourced entities that are not at the root of the aggregate. Instead of keeping track of uncommitted events themselves, these entities refer to their aggregate root to do that for them. A DomainEvent published in any of the entities in an Aggregate is published to all entities in the entire aggregate.
Constructor Summary | |
---|---|
AbstractEventSourcedEntity()
|
Method Summary | |
---|---|
protected void |
apply(Object event)
Apply the provided event. |
protected void |
apply(Object event,
MetaData metaData)
Apply the provided event and attaching the given metaData . |
protected AbstractEventSourcedAggregateRoot |
getAggregateRoot()
Returns the reference to the root of the aggregate this entity is a member of. |
protected abstract Collection<? extends EventSourcedEntity> |
getChildEntities()
Returns a collection of event sourced entities directly referenced by this entity. |
protected abstract void |
handle(DomainEventMessage event)
Apply state changes based on the given event. |
void |
handleRecursively(DomainEventMessage event)
Report the given event for handling in the current instance (this ), as well as all the
entities referenced by this instance. |
void |
registerAggregateRoot(AbstractEventSourcedAggregateRoot aggregateRootToRegister)
Register the aggregate root with this entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractEventSourcedEntity()
Method Detail |
---|
public void registerAggregateRoot(AbstractEventSourcedAggregateRoot aggregateRootToRegister)
EventSourcedEntity
registerAggregateRoot
in interface EventSourcedEntity
aggregateRootToRegister
- the root of the aggregate this entity is part of.public void handleRecursively(DomainEventMessage event)
EventSourcedEntity
event
for handling in the current instance (this
), as well as all the
entities referenced by this instance.
handleRecursively
in interface EventSourcedEntity
event
- The event to handleprotected abstract Collection<? extends EventSourcedEntity> getChildEntities()
protected abstract void handle(DomainEventMessage event)
event
- The event to handleprotected void apply(Object event)
handle(org.axonframework.domain.DomainEventMessage)
event handler method} for processing.
The event is applied on all entities part of this aggregate.
event
- The payload of the event to applyprotected void apply(Object event, MetaData metaData)
metaData
. Applying events means they are added to
the uncommitted event queue and forwarded to the handle(org.axonframework.domain.DomainEventMessage)
event handler method} for processing.
The event is applied on all entities part of this aggregate.
event
- The payload of the event to applymetaData
- any meta-data that must be registered with the Eventprotected AbstractEventSourcedAggregateRoot getAggregateRoot()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |