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 Details

    • GetterEvolverChildEntityFieldDefinition

      public GetterEvolverChildEntityFieldDefinition(@Nonnull Function<P,F> getter, @Nonnull BiFunction<P,F,P> evolver)
      Creates a new ChildEntityFieldDefinition that 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

      @Nonnull public P evolveParentBasedOnChildInput(@Nonnull P parentEntity, @Nonnull F childInput)
      Description copied from interface: ChildEntityFieldDefinition
      Evolves 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:
      evolveParentBasedOnChildInput in interface ChildEntityFieldDefinition<P,F>
      Parameters:
      parentEntity - The parent entity to evolve.
      childInput - The child entity to use for evolution.
      Returns:
      The evolved parent entity.
    • getChildValue

      public F getChildValue(@Nonnull P parentEntity)
      Description copied from interface: ChildEntityFieldDefinition
      Returns the type of the field.
      Specified by:
      getChildValue in interface ChildEntityFieldDefinition<P,F>
      Parameters:
      parentEntity - The parent entity to get the child entities from.
      Returns:
      The type of the field.