@PublicSpi public interface ExtensionsMerger
How best to merge two maps is hard to know up front. Should it be a shallow clone or a deep one,
should keys be replaced or not and should lists of value be combined? The ExtensionsMerger
is the
interface asked to do this.
This interface will be called repeatedly for each change that has been added to the ExtensionsBuilder
and it is expected to merge the two maps as it sees fit
Modifier and Type | Field and Description |
---|---|
static ExtensionsMerger |
DEFAULT
A default implementation will do the following
It will deep merge the maps
It concatenate lists when they occur under the same key
It will add any keys from the right hand side map that are not present in the left
If a key is in both the left and right side, it will prefer the right hand side
It will try to maintain key order if the maps are ordered
|
Modifier and Type | Method and Description |
---|---|
@NotNull java.util.Map<java.lang.Object,java.lang.Object> |
merge(@NotNull java.util.Map<java.lang.Object,java.lang.Object> leftMap,
@NotNull java.util.Map<java.lang.Object,java.lang.Object> rightMap)
Called to merge the map on the left with the map on the right according to whatever code strategy some-one might envisage
|
static final ExtensionsMerger DEFAULT
@NotNull @NotNull java.util.Map<java.lang.Object,java.lang.Object> merge(@NotNull @NotNull java.util.Map<java.lang.Object,java.lang.Object> leftMap, @NotNull @NotNull java.util.Map<java.lang.Object,java.lang.Object> rightMap)
The map on the left is guaranteed to have been encountered before the map on the right
leftMap
- the map on the leftrightMap
- the map on the right