public class MapNormalizer extends Object
| Constructor and Description |
|---|
MapNormalizer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addValueIntoMap(Map<String,Object> map,
String path,
Object value)
Adds the provided value into the given map, splitting the path into periods appropriately and keeping
any intermediate nested maps which may already exist.
|
protected Optional<Map<String,Object>> |
createNormalizedMapIfNeeded(Object value)
Processes the given value if it is a Map and returns an Optional with a new Map if the input
value is not in its "normalized form." Recursively visits and replaces nested maps.
|
protected Map<String,Object> |
getOrInsertMap(Map<String,Object> parentMap,
String path)
Returns the nested map in the given
parentMap at the given path, inserting
one if none is yet present. |
protected boolean |
isKeyInvalid(Object key) |
Map<String,Object> |
normalizeMap(Map<Object,Object> loadedMap)
Normalizes the raw map read from a property resource for further use in a property reader.
|
public Map<String,Object> normalizeMap(@Nullable Map<Object,Object> loadedMap)
loadedMap - the map to normalizeprotected Optional<Map<String,Object>> createNormalizedMapIfNeeded(Object value)
value - the value to processprotected boolean isKeyInvalid(Object key)
protected void addValueIntoMap(Map<String,Object> map, String path, Object value)
map - the map to add the value topath - the path to store the value undervalue - the value to storeprotected Map<String,Object> getOrInsertMap(Map<String,Object> parentMap, String path)
parentMap at the given path, inserting
one if none is yet present. Periods in the path argument are not handled by this method.
Note that this method overrides any non-Map values stored at the given path.parentMap - the map to retrieve the nested map frompath - the key with which the value should be looked up from the mapCopyright © 2016–2019 The AuthMe Team. All rights reserved.