Class SingleEntityChildModelDefinition
java.lang.Object
org.axonframework.modelling.entity.annotation.AbstractEntityChildModelDefinition
org.axonframework.modelling.entity.annotation.SingleEntityChildModelDefinition
- All Implemented Interfaces:
EntityChildModelDefinition
EntityChildModelDefinition that creates EntityChildMetamodel instances for child entities that are
represented as a single entity (not iterable). It resolves the child type from the member's type and creates a
SingleEntityChildMetamodel accordingly.
Before version 5.0.0, this class was known as the
org.axonframework.modelling.command.inspection.AggregateMemberAnnotatedChildEntityDefinition. The class has
been renamed to better fit the new entity modeling.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <C,P> EntityChildMetamodel <C, P> doCreate(Class<P> parentClass, EntityMetamodel<C> entityMetamodel, String fieldName, EventTargetMatcher<C> eventTargetMatcher, CommandTargetResolver<C> commandTargetResolver) Creates a newEntityChildMetamodelfor the given parent class and child metamodel.protected Class<?> getChildTypeFromMember(Member member) Returns the actual child type.protected booleanisMemberTypeSupported(Class<?> memberType) Check if the given member type supports this definition.Methods inherited from class org.axonframework.modelling.entity.annotation.AbstractEntityChildModelDefinition
createChildDefinition
-
Constructor Details
-
SingleEntityChildModelDefinition
public SingleEntityChildModelDefinition()
-
-
Method Details
-
isMemberTypeSupported
Description copied from class:AbstractEntityChildModelDefinitionCheck if the given member type supports this definition. Returningtruefrom this method implies that theAbstractEntityChildModelDefinition.getChildTypeFromMember(Member)andAbstractEntityChildModelDefinition.doCreate(Class, EntityMetamodel, String, EventTargetMatcher, CommandTargetResolver)methods will be called.- Specified by:
isMemberTypeSupportedin classAbstractEntityChildModelDefinition- Parameters:
memberType- The type of the member to check.- Returns:
- Should return
trueif the member type is supported,falseotherwise.
-
getChildTypeFromMember
Description copied from class:AbstractEntityChildModelDefinitionReturns the actual child type. If it needs to be retrieved from a generic, this method should do so. This is used to construct the childEntityMetamodelusing theAnnotatedEntityMetamodelFactorysupplied by the parent entity metamodel.- Specified by:
getChildTypeFromMemberin classAbstractEntityChildModelDefinition- Parameters:
member- The member to retrieve the child type from.- Returns:
- The child type.
-
doCreate
@Nonnull protected <C,P> EntityChildMetamodel<C,P> doCreate(@Nonnull Class<P> parentClass, @Nonnull EntityMetamodel<C> entityMetamodel, @Nonnull String fieldName, @Nonnull EventTargetMatcher<C> eventTargetMatcher, @Nonnull CommandTargetResolver<C> commandTargetResolver) Description copied from class:AbstractEntityChildModelDefinitionCreates a newEntityChildMetamodelfor the given parent class and child metamodel. This method will be called if theAbstractEntityChildModelDefinition.isMemberTypeSupported(Class)returnstruefor the given member type.- Specified by:
doCreatein classAbstractEntityChildModelDefinition- Type Parameters:
C- The type of the child entity.P- The type of the parent entity.- Parameters:
parentClass- The class of the parent entity.entityMetamodel- TheEntityMetamodelto use for the child entity.fieldName- The name of the field to use for the child entity. If the member is a field, this will be the field name. If it is a method, the supposed field name will be the method name without the "get", "set" or "is" prefix and starting with a lowercase character.eventTargetMatcher- TheEventTargetMatcherto use for the child entity.commandTargetResolver- TheCommandTargetResolverto use for the child entity.- Returns:
- A new
EntityChildMetamodelfor the given parent class and child metamodel.
-