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 Details

    • GetterSetterChildEntityFieldDefinition

      public GetterSetterChildEntityFieldDefinition(@Nonnull Function<P,F> getter, @Nonnull BiConsumer<P,F> setter)
      Creates a new ChildEntityFieldDefinition that 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

      @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.