Package org.apache.sis.internal.metadata
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
Helper class for merging the content of two maps where values may be other metadata objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
ConstructorsConstructorDescriptionForMap
(ModifiableMetadata parent, String property, Map<?, ?> source, Map<?, ?> target) Creates a new merger for maps. -
Method Summary
Modifier and TypeMethodDescriptionInvoked 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
Used only in case of non-merged values. -
property
Used only in case of non-merged values. -
source
The map to copy. Will not be modified. -
target
Where to write copied or merged values.
-
-
Constructor Details
-
ForMap
ForMap(ModifiableMetadata parent, String property, Map<?, ?> source, Map<?, ?> target) Creates a new merger for maps.
-
-
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
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 interfaceBiFunction<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.
-