Class GetterEvolverChildEntityFieldDefinition<P,F>
java.lang.Object
org.axonframework.modelling.entity.child.GetterEvolverChildEntityFieldDefinition<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 GetterEvolverChildEntityFieldDefinition<P,F>
extends Object
implements ChildEntityFieldDefinition<P,F>
Implementation of
ChildEntityFieldDefinition that uses a getter and an evolver to get the child entities from
the parent, and to evolve the parent based on the child entities.- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsConstructorDescriptionGetterEvolverChildEntityFieldDefinition(Function<P, F> getter, BiFunction<P, F, P> evolver) Creates a newChildEntityFieldDefinitionthat uses the given getter and evolver to access the child entity and evolve 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
-
GetterEvolverChildEntityFieldDefinition
public GetterEvolverChildEntityFieldDefinition(@Nonnull Function<P, F> getter, @Nonnull BiFunction<P, F, P> evolver) Creates a newChildEntityFieldDefinitionthat uses the given getter and evolver to access the child entity and evolve the parent entity.- Parameters:
getter- the getter to access the child entity.evolver- the evolver to evolve the parent entity based on the child 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.
-