Interface EntityModel<T>

Type Parameters:
T - The type of entity described by this model
All Known Subinterfaces:
AggregateModel<T>

public interface EntityModel<T>
Interface of an entity model that describes the properties and capabilities of an entity of type T. The entity may be child entity or an aggregate root.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>>
    Gets all command handler interceptors per type in this aggregate hierarchy.
    default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>>
    Gets all command handlers per type in this aggregate hierarchy.
    default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>>
    Gets all event handlers per type in this aggregate hierarchy.
    default List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>
    default Stream<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>
    Gets command handler interceptors for provided type in this aggregate hierarchy.
    default List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>
    Deprecated.
    default Stream<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>
    commandHandlers(Class<? extends T> type)
    Gets command handlers for provided type in this aggregate hierarchy.
    Class<? extends T>
    Returns the class this model describes
    getIdentifier(T target)
    Get the identifier of the given target entity.
    <C> EntityModel<C>
    modelOf(Class<? extends C> childEntityType)
    Get the EntityModel of an entity of type childEntityType in case it is the child of the modeled entity.
    void
    publish(org.axonframework.eventhandling.EventMessage<?> message, T target)
    Publish given event message on the given target entity.
    Get the name of the routing key property on commands and events that provides the identifier that should be used to target entities of this kind.
  • Method Details

    • getIdentifier

      Object getIdentifier(T target)
      Get the identifier of the given target entity.
      Parameters:
      target - The entity instance
      Returns:
      The identifier of the given target entity
    • routingKey

      String routingKey()
      Get the name of the routing key property on commands and events that provides the identifier that should be used to target entities of this kind.
      Returns:
      The name of the routing key that holds the identifier used to target this sort of entity
    • publish

      void publish(org.axonframework.eventhandling.EventMessage<?> message, T target)
      Publish given event message on the given target entity.
      Parameters:
      message - The event message to publish
      target - The target entity for the event
    • commandHandlers

      @Deprecated default List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>> commandHandlers()
      Deprecated.
      Gets a mapping of MessageHandlingMember to command name (obtained via CommandMessage.getCommandName()) for this entityClass().
      Returns:
      a map of message handler to command name
    • allCommandHandlers

      default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>> allCommandHandlers()
      Gets all command handlers per type in this aggregate hierarchy.
      Returns:
      a map of command handlers per type
    • commandHandlers

      default Stream<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>> commandHandlers(Class<? extends T> type)
      Gets command handlers for provided type in this aggregate hierarchy.
      Parameters:
      type - the aggregate type in this hierarchy
      Returns:
      a stream of command handlers for provided type
    • commandHandlerInterceptors

      @Deprecated default List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>> commandHandlerInterceptors()
      Gets a list of command handler interceptors for this entityClass().
      Returns:
      list of command handler interceptors
    • allCommandHandlerInterceptors

      default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>> allCommandHandlerInterceptors()
      Gets all command handler interceptors per type in this aggregate hierarchy.
      Returns:
      a map of command handler interceptors per type
    • commandHandlerInterceptors

      default Stream<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>> commandHandlerInterceptors(Class<? extends T> type)
      Gets command handler interceptors for provided type in this aggregate hierarchy.
      Parameters:
      type - the aggregate type in this hierarchy
      Returns:
      a stream of command handler interceptors for provided type
    • allEventHandlers

      default Map<Class<?>,List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>>> allEventHandlers()
      Gets all event handlers per type in this aggregate hierarchy.
      Returns:
      a map of event handlers per type
    • modelOf

      <C> EntityModel<C> modelOf(Class<? extends C> childEntityType)
      Get the EntityModel of an entity of type childEntityType in case it is the child of the modeled entity.
      Type Parameters:
      C - the type of the child entity
      Parameters:
      childEntityType - The class instance of the child entity type
      Returns:
      An EntityModel for the child entity
    • entityClass

      Class<? extends T> entityClass()
      Returns the class this model describes
      Returns:
      the class this model describes