public final class AggregateAnnotationInspector extends Object
AggregateIdentifier
and EventSourcedMember
. The inspector can also create MessageHandlerInvoker
instances to invoke EventSourcingHandler
annotated methods.EventSourcingHandler
,
EventHandler
Modifier and Type | Method and Description |
---|---|
MessageHandlerInvoker |
createEventHandlerInvoker(Object instance)
Creates a new MessageHandlerInvoker that invokes methods on the given
instance . |
Collection<EventSourcedEntity> |
getChildEntities(Object instance)
Returns the child entities of given
instance . |
<I> I |
getIdentifier(AbstractAnnotatedAggregateRoot<I> aggregateRoot)
Returns the identifier of the given
aggregateRoot . |
static AggregateAnnotationInspector |
getInspector(Class<?> entityType,
ParameterResolverFactory parameterResolverFactory)
Returns (or creates) an inspector for the given
entityType . |
public static AggregateAnnotationInspector getInspector(Class<?> entityType, ParameterResolverFactory parameterResolverFactory)
entityType
. If an instance is already created for
that type, that instance may be returned. Otherwise, a new inspector is created.entityType
- The type of entity (aggregate root or simple member) to get an inspector forparameterResolverFactory
- The factory providing access to the parameter resolverspublic MessageHandlerInvoker createEventHandlerInvoker(Object instance)
instance
.instance
- The object (typically an entity) to create the MessageHandlerInvoker forinstance
public Collection<EventSourcedEntity> getChildEntities(Object instance)
instance
. Entities are detected if they are contained in fields
annotated with EventSourcedMember
. If the annotated field is a collection, map or array, each member of
that collection, the map's key set, the map's value set or the array that implements the EventSourcedEntity
interface is returned.instance
- The instance to find child entities ininstance
.public <I> I getIdentifier(AbstractAnnotatedAggregateRoot<I> aggregateRoot)
aggregateRoot
. Since only the aggregate root carries the
aggregate's identifier, this method cannot be invoked with any other entity than the aggregate's root.
The field carrying the aggregate identifier must be annotated with AggregateIdentifier
.I
- The type of identifier declared on the aggregate rootaggregateRoot
- The aggregate root to find the aggregate onAggregateIdentifier
Copyright © 2010-2014. All Rights Reserved.