T
- The type of entity described by this modelpublic interface EntityModel<T>
T
. The
entity may be child entity or an aggregate root.Modifier and Type | Method and Description |
---|---|
default MessageHandlingMember<? super T> |
commandHandler(String commandName)
Get the
MessageHandlingMember capable of handling commands with given commandName (see CommandMessage.getCommandName() ). |
Map<String,MessageHandlingMember<? super T>> |
commandHandlers()
Get a mapping of
MessageHandlingMember to command name (obtained via CommandMessage.getCommandName() ). |
Class<? extends T> |
entityClass()
Returns the class this model describes
|
Object |
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(EventMessage<?> message,
T target)
Publish given event
message on the given target entity. |
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.
|
Object getIdentifier(T target)
target
entity.target
- The entity instanceString routingKey()
void publish(EventMessage<?> message, T target)
message
on the given target
entity.message
- The event message to publishtarget
- The target entity for the eventMap<String,MessageHandlingMember<? super T>> commandHandlers()
MessageHandlingMember
to command name (obtained via CommandMessage.getCommandName()
).default MessageHandlingMember<? super T> commandHandler(String commandName)
MessageHandlingMember
capable of handling commands with given commandName
(see CommandMessage.getCommandName()
). If the entity is not capable of handling
such commands an exception is raised.commandName
- The name of the commandNoHandlerForCommandException
- In case the entity is not capable of handling commands of given name<C> EntityModel<C> modelOf(Class<? extends C> childEntityType)
childEntityType
in case it is the child of the modeled entity.C
- the type of the child entitychildEntityType
- The class instance of the child entity typeCopyright © 2010–2017. All rights reserved.