Interface Mapper.MergeStrategy

Enclosing class:
Mapper

public static interface Mapper.MergeStrategy
An interface for defining merge strategies. Merge strategies are used when the mapping has two or more arguments.
  • Method Details

    • merge

      @Nullable @Nullable Object merge(@Nullable @Nullable Object currentValue, @Nullable @Nullable Object value, @NonNull @NonNull Object valueOwner, @NonNull @NonNull String propertyName, @NonNull @NonNull String mappedPropertyName)
      Merge a single property by returning the value to set the property to. The merge strategy will be called every time a property needs to be set, even for properties of the first argument.

      The property that is returned from the method will be set. For example, if you do not want to update the property, return the currentValue.

      Parameters:
      currentValue - The currently specified value
      value - The newly supplied value
      valueOwner - The owner of the new value
      propertyName - The name of the property to merge
      mappedPropertyName - The name of the property from the owner
      Returns:
      The new value to set