P
- the parent entity type.C
- the child entity type.public 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,
BiFunction<CommandMessage<?>,P,C> commandTargetResolver,
BiFunction<EventMessage<?>,P,Stream<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 |
---|---|
List<MessageHandlingMember<? super P>> |
commandHandlers()
Returns the command handlers declared in this entity
|
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, BiFunction<CommandMessage<?>,P,C> commandTargetResolver, BiFunction<EventMessage<?>,P,Stream<C>> eventTargetResolver)
entityModel
to delegate command
and event handling to an annotated child entity.entityModel
- A EntityModel
describing the entity.forwardCommands
- Flag indicating whether commands should be forwarded to the entity.commandTargetResolver
- Resolver for command handler methods on the target.eventTargetResolver
- Resolver for event handler methods on the target.public 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 List<MessageHandlingMember<? super P>> commandHandlers()
ChildEntity
commandHandlers
in interface ChildEntity<P>
Copyright © 2010–2019. All rights reserved.