Interface EntityChildMetamodel<C,P>
- Type Parameters:
C- the type of the child entityP- the type of the parent entity
- All Superinterfaces:
EntityEvolver<P>
- All Known Implementing Classes:
AbstractEntityChildMetamodel,ListEntityChildMetamodel,MapEntityChildMetamodel,SingleEntityChildMetamodel
Interface describing a child
EntityMetamodel that can be handled in the context of its parent. Handling
commands for this metamodel is done in the context of the parent. This metamodel resolves the child from the given
parent and can then invoke the right child instance to handle the command.- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(CommandMessage message, P parentEntity, ProcessingContext context) Checks if this child can handle the givenCommandMessagefor the given parent entity, and a child entity is available to handle it.Returns theEntityMetamodelof the child entity this metamodel describes.Returns theClassof the child entity this metamodel describes.handle(CommandMessage message, P parentEntity, ProcessingContext context) Handles the givenCommandMessagefor the given child entity, using the provided parent entity.static <C,P> ListEntityChildMetamodel.Builder <C, P> list(Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a list of child entities within the given parent entity type.static <K,C, P> MapEntityChildMetamodel.Builder <K, C, P> map(Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a map of child entities within the given parent entity type.static <C,P> SingleEntityChildMetamodel.Builder <C, P> single(Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a single child entity within the given parent entity type.Returns the set of allQualifiedNamesthat this metamodel supports for command handlers.Methods inherited from interface org.axonframework.modelling.EntityEvolver
evolve
-
Method Details
-
supportedCommands
Set<QualifiedName> supportedCommands()Returns the set of allQualifiedNamesthat this metamodel supports for command handlers.- Returns:
- a set of
QualifiedNameinstances representing the supported command names
-
canHandle
Checks if this child can handle the givenCommandMessagefor the given parent entity, and a child entity is available to handle it.- Parameters:
message- theCommandMessageto checkparentEntity- the parent entity instance to check againstcontext- theProcessingContextfor the command- Returns:
trueif this child can handle the command,falseotherwise
-
handle
MessageStream.Single<CommandResultMessage> handle(CommandMessage message, P parentEntity, ProcessingContext context) Handles the givenCommandMessagefor the given child entity, using the provided parent entity.- Parameters:
message- theCommandMessageto handleparentEntity- the child entity instance to handle the command forcontext- theProcessingContextfor the command- Returns:
- the result of the command handling, which may be a
CommandResultMessageor an error message
-
entityType
Returns theClassof the child entity this metamodel describes.- Returns:
- the
Classof the child entity this metamodel describes
-
entityMetamodel
EntityMetamodel<C> entityMetamodel()Returns theEntityMetamodelof the child entity this metamodel describes.- Returns:
- the
EntityMetamodelof the child entity this metamodel describes
-
single
static <C,P> SingleEntityChildMetamodel.Builder<C,P> single(Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a single child entity within the given parent entity type.- Type Parameters:
C- the type of the child entityP- the type of the parent entity- Parameters:
parentClass- the class of the parent entitymetamodel- theEntityMetamodelof the child entity- Returns:
- a
SingleEntityChildMetamodel.Builderfor the child entity.
-
list
static <C,P> ListEntityChildMetamodel.Builder<C,P> list(Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a list of child entities within the given parent entity type.- Type Parameters:
C- the type of the child entityP- the type of the parent entity- Parameters:
parentClass- the class of the parent entitymetamodel- theEntityMetamodelof the child entity- Returns:
- a
ListEntityChildMetamodel.Builderfor the child entity
-
map
static <K,C, MapEntityChildMetamodel.Builder<K,P> C, mapP> (Class<P> parentClass, EntityMetamodel<C> metamodel) Starts a builder for a map of child entities within the given parent entity type.- Type Parameters:
K- the type of the key of theMapcontaining the child entitiesC- the type of the child entityP- the type of the parent entity- Parameters:
parentClass- the class of the parent entitymetamodel- theEntityMetamodelof the child entity- Returns:
- a
MapEntityChildMetamodel.Builderfor the child entity
-