Class SerializationUtil.Builder
java.lang.Object
de.eldoria.eldoutilities.serialization.SerializationUtil.Builder
- Enclosing class:
- SerializationUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a enum value.Adds a object.Add a key with a enum constant nameAdda a key with a object.add(String key, Collection<?> collection) Adds a key with a collection which will be wrapped in a list.Add a map to the serialization map<K,V> SerializationUtil.Builder add(Map<K, V> map, BiFunction<K, V, String> keyFunction, BiFunction<K, V, Object> valueFunction) Add a map to the map<T extends Enum<?>>
SerializationUtil.BuilderaddEnum(String key, Collection<T> values) <K,V> SerializationUtil.Builder addMap(String key, Map<K, V> map, BiFunction<K, V, String> keyToString) Serialize a map to a list.build()
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
add
Adda a key with a object.- Parameters:
key- keyvalue- value to add- Returns:
- builder with values changed
-
add
- Type Parameters:
T- type of value- Parameters:
key- keyvalue- value to addtoString- method to convert value to string- Returns:
- builder with values changed
-
add
-
addMap
public <K,V> SerializationUtil.Builder addMap(String key, Map<K, V> map, BiFunction<K, V, String> keyToString) Serialize a map to a list.The entries will be wrapped in a
MapEntrywhich preserves key and value.Serialize via
TypeResolvingMap.getMap(String, BiFunction)- Type Parameters:
K- type of keyV- type of value- Parameters:
key- key for mapmap- map to serializekeyToString- function to map the key or value to a unique key.- Returns:
- builder with values changed
-
add
Add a key with a enum constant name- Parameters:
key- keyenumValue- enum value- Returns:
- builder with values changed
-
add
Adds a key with a collection which will be wrapped in a list.- Parameters:
key- keycollection- collection- Returns:
- builder with values changed
-
add
Adds a object. The key will be computed by the current naming strategy.- Parameters:
value- value to add- Returns:
- builder with values changed
-
add
Adds a enum value. The key will be computed by the current naming strategy.- Parameters:
enumValue- value to add- Returns:
- builder with values changed
-
add
-
add
public <K,V> SerializationUtil.Builder add(Map<K, V> map, BiFunction<K, V, String> keyFunction, BiFunction<K, V, Object> valueFunction) Add a map to the map- Type Parameters:
K- key typeV- value type- Parameters:
map- map to addkeyFunction- function to map key to stringvalueFunction- function to map value to object- Returns:
- builder with values changed
-
addEnum
-
add
Add a map to the serialization map- Parameters:
map- map to add- Returns:
- builder with values changed
-
build
-