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 TypeMethodDescriptiondefault Map<Class<?>, List<MessageHandlingMember<? super T>>> Gets all command handler interceptors per type in this aggregate hierarchy.default Map<Class<?>, List<MessageHandlingMember<? super T>>> Gets all command handlers per type in this aggregate hierarchy.default Map<Class<?>, List<MessageHandlingMember<? super T>>> Gets all event handlers per type in this aggregate hierarchy.default List<MessageHandlingMember<? super T>> Deprecated.default Stream<MessageHandlingMember<? super T>> commandHandlerInterceptors(Class<? extends T> type) Gets command handler interceptors for providedtypein this aggregate hierarchy.default List<MessageHandlingMember<? super T>> Deprecated.useallCommandHandlers()orcommandHandlers(Class)insteaddefault Stream<MessageHandlingMember<? super T>> commandHandlers(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(EventMessage<?> message, T target) Publish 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.useallCommandHandlers()orcommandHandlers(Class)insteadGets a mapping ofMessageHandlingMemberto command name (obtained viaCommandMessage.getCommandName()) for thisentityClass().- Returns:
- a map of message handler to command name
-
allCommandHandlers
Gets all command handlers per type in this aggregate hierarchy.- Returns:
- a map of command handlers per type
-
commandHandlers
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.useallCommandHandlerInterceptors()orcommandHandlerInterceptors(Class)insteadGets a list of command handler interceptors for thisentityClass().- Returns:
- list of command handler interceptors
-
allCommandHandlerInterceptors
Gets all command handler interceptors per type in this aggregate hierarchy.- Returns:
- a map of command handler interceptors per type
-
commandHandlerInterceptors
default Stream<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
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