public class MapNormalizer extends Object
| Constructor and Description |
|---|
MapNormalizer(boolean splitDotPaths)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addValueIntoMap(@NotNull Map<String,Object> map,
@NotNull String path,
@NotNull 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 @NotNull Optional<Map<String,Object>> |
createNormalizedMapIfNeeded(@NotNull 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".
|
protected @NotNull Map<String,Object> |
getOrInsertMap(@NotNull Map<String,Object> parentMap,
@NotNull String path)
Returns the nested map in the given
parentMap at the given path, inserting
one if none is yet present. |
protected boolean |
isKeyInvalid(@NotNull Object key) |
@Nullable Map<String,Object> |
normalizeMap(@Nullable Map<Object,Object> loadedMap)
Normalizes the raw map read from a property resource for further use in a property reader.
|
protected boolean |
splitDotPaths() |
public MapNormalizer(boolean splitDotPaths)
splitDotPaths - whether compound keys (keys with ".") should be splitprotected final boolean splitDotPaths()
@Nullable public @Nullable Map<String,Object> normalizeMap(@Nullable @Nullable Map<Object,Object> loadedMap)
loadedMap - the map to normalize@NotNull protected @NotNull Optional<Map<String,Object>> createNormalizedMapIfNeeded(@NotNull @NotNull Object value)
value - the value to processprotected boolean isKeyInvalid(@NotNull
@NotNull Object key)
protected void addValueIntoMap(@NotNull
@NotNull Map<String,Object> map,
@NotNull
@NotNull String path,
@NotNull
@NotNull Object value)
map - the map to add the value topath - the path to store the value undervalue - the value to store@NotNull protected @NotNull Map<String,Object> getOrInsertMap(@NotNull @NotNull Map<String,Object> parentMap, @NotNull @NotNull 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–2023 The AuthMe Team. All rights reserved.