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,
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>
MessageHandlingMember
s that are capable of processing command messagesCopyright © 2010–2024. All rights reserved.