Class Merger.ForMap<V>

java.lang.Object
org.apache.sis.internal.metadata.Merger.ForMap<V>
All Implemented Interfaces:
BiFunction<V,V,V>
Enclosing class:
Merger

private final class Merger.ForMap<V> extends Object implements BiFunction<V,V,V>
Helper class for merging the content of two maps where values may be other metadata objects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ModifiableMetadata
    Used only in case of non-merged values.
    private final String
    Used only in case of non-merged values.
    private final Map<?,?>
    The map to copy.
    private final Map<?,?>
    Where to write copied or merged values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ForMap(ModifiableMetadata parent, String property, Map<?,?> source, Map<?,?> target)
    Creates a new merger for maps.
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(V oldValue, V newValue)
    Invoked when an entry is about to be written in the target map, but a value already exists for that entry.
    (package private) final boolean
    run(boolean dryRun)
    Executes the merge process between the maps specified at construction time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.BiFunction

    andThen
  • Field Details

    • parent

      private final ModifiableMetadata parent
      Used only in case of non-merged values.
    • property

      private final String property
      Used only in case of non-merged values.
    • source

      private final Map<?,?> source
      The map to copy. Will not be modified.
    • target

      private final Map<?,?> target
      Where to write copied or merged values.
  • Constructor Details

  • Method Details

    • run

      final boolean run(boolean dryRun)
      Executes the merge process between the maps specified at construction time.
      Parameters:
      dryRun - true for verifying if there is a merge conflict instead that performing the actual merge operation.
    • apply

      public V apply(V oldValue, V newValue)
      Invoked when an entry is about to be written in the target map, but a value already exists for that entry.
      Specified by:
      apply in interface BiFunction<V,V,V>
      Parameters:
      oldValue - the metadata value that already exists.
      newValue - the metadata value to copy in the target.
      Returns:
      the value to copy in the target (merged) map.