public class Maps
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Maps.Builder<K,V,R,T> |
Modifier and Type | Method and Description |
---|---|
static <K,V,R> Maps.Builder<K,V,R,V> |
builder(java.util.Map<K,V> implementation,
R returnInstance,
java.util.function.Consumer<java.util.Map<K,V>> build)
Create an embeddable map builder instance.
|
static <K,V,R,T> Maps.Builder<K,V,R,T> |
builder(java.util.Map<K,V> implementation,
R returnInstance,
java.util.function.Consumer<java.util.Map<K,V>> build,
java.util.function.Function<T,V> mapper)
Create an embeddable map builder instance, with a value mapper.
|
static java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
flatten(java.util.Map.Entry<java.lang.String,java.lang.Object> entry)
Stream flatMap utility to flatten a map, with "." as the level separator.
|
static <T> java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
flatten(java.util.Map.Entry<java.lang.String,java.lang.Object> entry,
java.lang.Class<T> clazz,
java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.Object>> flatten)
Stream flatMap utility to flatten a map, with "." as the level separator,
and a object mapper (triggered if a configured type is detected within a
nested map).
|
static <T> java.util.Map<java.lang.String,java.lang.Object> |
map(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.Class<T> clazz,
java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.Object>> mapper)
Utility method to sort through a map (including nested maps and collections), and replace
a specific type, with a Map.
|
static <K,V> Maps.Builder<K,V,java.util.Map<K,V>,V> |
of(java.util.Map<K,V> implementation)
Create a Map Builder.
|
static <K,V,T> Maps.Builder<K,V,java.util.Map<K,V>,T> |
of(java.util.Map<K,V> implementation,
java.util.function.Function<T,V> mapper)
Create a Map Builder with a value mapper.
|
static <T> T |
recursiveGet(java.util.Map<java.lang.String,T> map,
java.lang.String path)
Utility method to recurse through levels of nested maps to retrieve a specific object,
at a path (nested maps separated via "." in the path).
|
public static <K,V,R> Maps.Builder<K,V,R,V> builder(java.util.Map<K,V> implementation, R returnInstance, java.util.function.Consumer<java.util.Map<K,V>> build)
K
- Key typeV
- Value typeR
- Return instance typeimplementation
- Map implementation.returnInstance
- Instance returned on build().build
- Logic to perform on build, to store the Map instance somewhere.public static <K,V,R,T> Maps.Builder<K,V,R,T> builder(java.util.Map<K,V> implementation, R returnInstance, java.util.function.Consumer<java.util.Map<K,V>> build, java.util.function.Function<T,V> mapper)
K
- Key typeV
- Value typeR
- Return instance typeT
- Inputted value typeimplementation
- Map implementation.returnInstance
- Instance returned on build().build
- Logic to perform on build, to store the Map instance somewhere.mapper
- Value mapperpublic static <K,V> Maps.Builder<K,V,java.util.Map<K,V>,V> of(java.util.Map<K,V> implementation)
K
- Key typeV
- Value typeimplementation
- Map implementationpublic static <K,V,T> Maps.Builder<K,V,java.util.Map<K,V>,T> of(java.util.Map<K,V> implementation, java.util.function.Function<T,V> mapper)
K
- Key typeV
- Value typeT
- Inputted value typeimplementation
- Map implementationmapper
- Value mapperpublic static java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>> flatten(java.util.Map.Entry<java.lang.String,java.lang.Object> entry)
entry
- Entry to flattenpublic static <T> java.util.stream.Stream<java.util.Map.Entry<java.lang.String,java.lang.Object>> flatten(java.util.Map.Entry<java.lang.String,java.lang.Object> entry, java.lang.Class<T> clazz, java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.Object>> flatten)
T
- Type generic of objectentry
- Entry to flattenclazz
- Class type of object to detectflatten
- Flatten logic for custom object typepublic static <T> java.util.Map<java.lang.String,java.lang.Object> map(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.Class<T> clazz, java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.Object>> mapper)
T
- Type generic of objectmap
- Map to mapclazz
- Class type of object to detectmapper
- Logic to convert object to mappublic static <T> T recursiveGet(java.util.Map<java.lang.String,T> map, java.lang.String path)
T
- Type generic of objectmap
- Map to search throughpath
- Path of object