Class GetterSetterChildEntityFieldDefinition<P,F>
java.lang.Object
org.axonframework.modelling.entity.child.GetterSetterChildEntityFieldDefinition<P,F>
- Type Parameters:
P- The type of the parent entity.F- The type of the field. This can be the type of the child entity or a collection of child entities.
- All Implemented Interfaces:
ChildEntityFieldDefinition<P,F>
public class GetterSetterChildEntityFieldDefinition<P,F>
extends Object
implements ChildEntityFieldDefinition<P,F>
Implementation of
ChildEntityFieldDefinition that uses a getter and a setter to get the child entities from
the parent, and to set the evolved child entities on the parent entity.- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsConstructorDescriptionGetterSetterChildEntityFieldDefinition(Function<P, F> getter, BiConsumer<P, F> setter) Creates a newChildEntityFieldDefinitionthat uses the given getter and setter to access the child entity and set the evolved child entities on the parent entity. -
Method Summary
Modifier and TypeMethodDescriptionevolveParentBasedOnChildInput(P parentEntity, F childInput) Evolves the parent entity based on the provided child value.getChildValue(P parentEntity) Returns the type of the field.
-
Constructor Details
-
GetterSetterChildEntityFieldDefinition
public GetterSetterChildEntityFieldDefinition(@Nonnull Function<P, F> getter, @Nonnull BiConsumer<P, F> setter) Creates a newChildEntityFieldDefinitionthat uses the given getter and setter to access the child entity and set the evolved child entities on the parent entity.- Parameters:
getter- the getter to access the child entity.setter- the setter to set the evolved child entity on the parent entity.
-
-
Method Details
-
evolveParentBasedOnChildInput
Description copied from interface:ChildEntityFieldDefinitionEvolves the parent entity based on the provided child value. This can be a single entity, or a collection of entities. The evolver can return a new version of the parent entity, or it can simply set the field on the parent entity.- Specified by:
evolveParentBasedOnChildInputin interfaceChildEntityFieldDefinition<P,F> - Parameters:
parentEntity- The parent entity to evolve.childInput- The child entity to use for evolution.- Returns:
- The evolved parent entity.
-
getChildValue
Description copied from interface:ChildEntityFieldDefinitionReturns the type of the field.- Specified by:
getChildValuein interfaceChildEntityFieldDefinition<P,F> - Parameters:
parentEntity- The parent entity to get the child entities from.- Returns:
- The type of the field.
-