P
- the parent entity typeC
- the child entity typepublic class AnnotatedChildEntity<P,C> extends Object implements ChildEntity<P>
ChildEntity
that uses annotations on a target entity to resolve event and command
handlers.Constructor and Description |
---|
AnnotatedChildEntity(EntityModel<C> entityModel,
boolean forwardCommands,
boolean forwardEvents,
BiFunction<CommandMessage<?>,P,C> commandTargetResolver,
BiFunction<EventMessage<?>,P,Iterable<C>> eventTargetResolver)
Initiates a new AnnotatedChildEntity instance that uses the provided
entityModel to delegate command
and event handling to an annotated child entity. |
Modifier and Type | Method and Description |
---|---|
Map<String,MessageHandlingMember<? super P>> |
commandHandlers()
Returns the commands and their respective handler that this entity declares
|
void |
publish(EventMessage<?> msg,
P declaringInstance)
Publish the given
msg to the appropriate handlers on the given declaringInstance |
public AnnotatedChildEntity(EntityModel<C> entityModel, boolean forwardCommands, boolean forwardEvents, BiFunction<CommandMessage<?>,P,C> commandTargetResolver, BiFunction<EventMessage<?>,P,Iterable<C>> eventTargetResolver)
entityModel
to delegate command
and event handling to an annotated child entity.entityModel
- model describing the entityforwardCommands
- flag indicating whether commands should be forwarded to the entityforwardEvents
- flag indicating whether events should be forwarded to the entitycommandTargetResolver
- resolver for command handler methods on the targeteventTargetResolver
- resolver for event handler methods on the targetpublic void publish(EventMessage<?> msg, P declaringInstance)
ChildEntity
msg
to the appropriate handlers on the given declaringInstance
publish
in interface ChildEntity<P>
msg
- The message to publishdeclaringInstance
- The instance of this entity to invoke handlers onpublic Map<String,MessageHandlingMember<? super P>> commandHandlers()
ChildEntity
commandHandlers
in interface ChildEntity<P>
Copyright © 2010–2017. All rights reserved.