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 TypeMethodDescriptionGets all command handler interceptors per type in this aggregate hierarchy.Gets all command handlers per type in this aggregate hierarchy.Gets all event handlers per type in this aggregate hierarchy.Deprecated.commandHandlerInterceptors(Class<? extends T> type) Gets command handler interceptors for providedtypein this aggregate hierarchy.Deprecated.useallCommandHandlers()orcommandHandlers(Class)insteadcommandHandlers(Class<? extends T> type) Gets command handlers for providedtypein this aggregate hierarchy.Returns the class this model describesgetIdentifier(T target) Get the identifier of the giventargetentity.<C> EntityModel<C>Get the EntityModel of an entity of typechildEntityTypein case it is the child of the modeled entity.voidPublish given eventmessageon the giventargetentity.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
Get the identifier of the giventargetentity.- 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
Publish given eventmessageon the giventargetentity.- Parameters:
message- The event message to publishtarget- The target entity for the event
-
commandHandlers
@Deprecated default List<org.axonframework.messaging.annotation.MessageHandlingMember<? super T>> commandHandlers()Deprecated.useallCommandHandlers()orcommandHandlers(Class)insteadGets a mapping ofMessageHandlingMemberto command name (obtained viaCommandMessage.getCommandName()) for thisentityClass().- 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 providedtypein 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()Deprecated.useallCommandHandlerInterceptors()orcommandHandlerInterceptors(Class)insteadGets a list of command handler interceptors for thisentityClass().- 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 providedtypein 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
Get the EntityModel of an entity of typechildEntityTypein 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
Returns the class this model describes- Returns:
- the class this model describes
-
allCommandHandlerInterceptors()orcommandHandlerInterceptors(Class)instead