Class AnnotatedChildEntity<P,C>

java.lang.Object
org.axonframework.modelling.command.inspection.AnnotatedChildEntity<P,C>
Type Parameters:
P - the parent entity type
C - the child entity type
All Implemented Interfaces:
ChildEntity<P>

public class AnnotatedChildEntity<P,C> extends Object implements ChildEntity<P>
Implementation of a ChildEntity that uses annotations on a target entity to resolve event and command handlers.
Since:
3.0
Author:
Allard Buijze
  • Constructor Details

    • AnnotatedChildEntity

      public 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.
      Parameters:
      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.
  • Method Details

    • publish

      public void publish(EventMessage<?> msg, P declaringInstance)
      Description copied from interface: ChildEntity
      Publish the given msg to the appropriate handlers on the given declaringInstance.
      Specified by:
      publish in interface ChildEntity<P>
      Parameters:
      msg - the message to publish
      declaringInstance - the instance of this entity to invoke handlers on
    • commandHandlers

      public List<MessageHandlingMember<? super P>> commandHandlers()
      Description copied from interface: ChildEntity
      Returns the command handlers declared in this entity.
      Specified by:
      commandHandlers in interface ChildEntity<P>
      Returns:
      a list of MessageHandlingMembers that are capable of processing command messages