Class SingleEntityChildMetamodel.Builder<C,P>
java.lang.Object
org.axonframework.modelling.entity.child.AbstractEntityChildMetamodel.Builder<C,P,SingleEntityChildMetamodel.Builder<C,P>>
org.axonframework.modelling.entity.child.SingleEntityChildMetamodel.Builder<C,P>
- Type Parameters:
C- The type of the child entity.P- The type of the parent entity.
- Enclosing class:
SingleEntityChildMetamodel<C,P>
public static class SingleEntityChildMetamodel.Builder<C,P>
extends AbstractEntityChildMetamodel.Builder<C,P,SingleEntityChildMetamodel.Builder<C,P>>
Builder for creating a
SingleEntityChildMetamodel for the given parent class and child entity metamodel.
The ChildEntityFieldDefinition is required to resolve the child entities from the parent entity and
evolve the parent entity based on the child entities.
The CommandTargetResolver and EventTargetMatcher are defaulted to
CommandTargetResolver.MATCH_ANY() and EventTargetMatcher.MATCH_ANY() respectively, meaning that
the child entity will always match all commands and all events. If you have multiple member fields, and want to
match commands and events to a specific child entity, you can configure the CommandTargetResolver and
EventTargetMatcher to match the child entity based on the command or event.
-
Field Summary
Fields inherited from class org.axonframework.modelling.entity.child.AbstractEntityChildMetamodel.Builder
commandTargetResolver, eventTargetMatcher, metamodel -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newSingleEntityChildMetamodelinstance with the configured properties.childEntityFieldDefinition(ChildEntityFieldDefinition<P, C> fieldDefinition) Sets theChildEntityFieldDefinitionto use for resolving the child entity from the parent entity and evolving the parent entity based on the evolved child entity.Methods inherited from class org.axonframework.modelling.entity.child.AbstractEntityChildMetamodel.Builder
commandTargetResolver, eventTargetMatcher, validate
-
Method Details
-
childEntityFieldDefinition
public SingleEntityChildMetamodel.Builder<C,P> childEntityFieldDefinition(@Nonnull ChildEntityFieldDefinition<P, C> fieldDefinition) Sets theChildEntityFieldDefinitionto use for resolving the child entity from the parent entity and evolving the parent entity based on the evolved child entity.- Parameters:
fieldDefinition- TheChildEntityFieldDefinitionto use for resolving the child entities from the parent entity- Returns:
- This builder instance.
-
build
Builds a newSingleEntityChildMetamodelinstance with the configured properties. TheChildEntityFieldDefinitionis required to be set before calling this method.- Returns:
- A new
SingleEntityChildMetamodelinstance with the configured properties.
-