Package com.netflix.spinnaker.kork.test
Class MapUtils
- java.lang.Object
-
- com.netflix.spinnaker.kork.test.MapUtils
-
public class MapUtils extends java.lang.ObjectProvides a standard library of helper functions for Map types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapUtils.IllegalMergeTypeException
-
Constructor Summary
Constructors Constructor Description MapUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.Object>merge(java.util.Map<java.lang.String,java.lang.Object> original, java.util.Map<java.lang.String,java.lang.Object> override)Returns a new map that is the result of deeply merging original and overrides.
-
-
-
Method Detail
-
merge
@Nonnull public static java.util.Map<java.lang.String,java.lang.Object> merge(@Nonnull java.util.Map<java.lang.String,java.lang.Object> original, @Nonnull java.util.Map<java.lang.String,java.lang.Object> override)Returns a new map that is the result of deeply merging original and overrides.Each key in original is merged with the corresponding key in overrides as follows: - an explicitly null entry in overrides removes a key in original - a map in original is merged with a map from overrides (via call to merge) - a non map in overrides results in an IllegalStateException - a collection in original is replaced with a collection in overrides - a non collection in overrides results in an IllegalStateException - the value is taken from overrides
Each remaining key in overrides is then added to the resulting map.
- Parameters:
original- the original Mapoverride- the Map to override/merge into original- Returns:
- a new Map containing the merge of original and overrides (never null)
- Throws:
java.lang.IllegalStateException- if incompatible types exist between original and overrides
-
-