org.axonframework.eventsourcing.annotation
Class AbstractAnnotatedEntity

java.lang.Object
  extended by org.axonframework.eventsourcing.AbstractEventSourcedEntity
      extended by org.axonframework.eventsourcing.annotation.AbstractAnnotatedEntity
All Implemented Interfaces:
EventSourcedEntity

public abstract class AbstractAnnotatedEntity
extends AbstractEventSourcedEntity

Convenience super type for entities (other than aggregate roots) that have their event handler methods annotated with the EventHandler annotation.

Note that each entity receives all events applied in the entire aggregate. Entities are responsible for filtering out the actual events to take action on.

If this entity is a child of another AbstractAnnotatedEntity or AbstractAnnotatedAggregateRoot, the field that this entity is stored in should be annotated with EventSourcedMember. Alternatively, the AbstractEventSourcedEntity.getChildEntities() or AbstractEventSourcedAggregateRoot.getChildEntities() should return a collection containing this entity instance.

Since:
0.7
Author:
Allard Buijze

Constructor Summary
protected AbstractAnnotatedEntity()
          Default constructor.
 
Method Summary
protected  ParameterResolverFactory createParameterResolverFactory()
          Creates (or returns) a ParameterResolverFactory which is used by this aggregate root to resolve the parameters for @EventSourcingHandler annotated methods.
protected  Collection<EventSourcedEntity> getChildEntities()
          Returns a collection of event sourced entities directly referenced by this entity.
protected  void handle(DomainEventMessage event)
          Calls the appropriate handler method with the provided event.
 
Methods inherited from class org.axonframework.eventsourcing.AbstractEventSourcedEntity
apply, apply, getAggregateRoot, handleRecursively, registerAggregateRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAnnotatedEntity

protected AbstractAnnotatedEntity()
Default constructor.

Method Detail

handle

protected void handle(DomainEventMessage event)
Calls the appropriate handler method with the provided event.

Specified by:
handle in class AbstractEventSourcedEntity
Parameters:
event - The event to handle
See Also:
EventSourcingHandler, EventHandler

getChildEntities

protected Collection<EventSourcedEntity> getChildEntities()
Description copied from class: AbstractEventSourcedEntity
Returns a collection of event sourced entities directly referenced by this entity. May return null or an empty list to indicate no child entities are available. The collection may also contain null values.

Specified by:
getChildEntities in class AbstractEventSourcedEntity
Returns:
a list of event sourced entities contained in this aggregate

createParameterResolverFactory

protected ParameterResolverFactory createParameterResolverFactory()
Creates (or returns) a ParameterResolverFactory which is used by this aggregate root to resolve the parameters for @EventSourcingHandler annotated methods.

This implementation uses the parameter resolver of the aggregate root. This method may be overridden to alter this behavior.

Returns:
the parameter resolver with which to resolve parameters for event handler methods.


Copyright © 2010-2016. All Rights Reserved.