Class SerializationUtil
java.lang.Object
de.eldoria.eldoutilities.serialization.SerializationUtil
Class which provides utilities for serialization and deserialization.
- Since:
- 1.0.0
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
U> BiFunction<T, U, String> keyToPrefixedString
(String prefix) static <T,
U> BiFunction<T, U, String> static TypeResolvingMap
Creates a new type resolving map from a map.static <T> void
mapOnObject
(Map<String, Object> objectMap, T obj) Maps objects from a map on an object.static SerializationUtil.Builder
Creates a new serialization map builder.static SerializationUtil.Builder
newBuilder
(Map<String, Object> map) Creates a new serialization map builder based on a map.objectToMap
(Object obj) Converts an Object to a Map.static <T,
U> BiFunction<T, U, Object>
-
Method Details
-
newBuilder
Creates a new serialization map builder.- Returns:
- builder for serialization
-
newBuilder
Creates a new serialization map builder based on a map.- Parameters:
map
- map which should be used to append the new values- Returns:
- builder for serialization
-
keyToString
-
valueOnly
-
keyToPrefixedString
-
mapOf
Creates a new type resolving map from a map.- Parameters:
serialized
- object as map- Returns:
- type resolving map
-
objectToMap
Converts an Object to a Map.This is done by retrieving all fields which are not marked as transient. This will include fields which are defined by a inherited class as well.
the variable names are used as keys.
- Parameters:
obj
- object to map- Returns:
- object as map
- Since:
- 1.1.0
-
mapOnObject
Maps objects from a map on an object.Only fields which are not mapped as transient will be mapped.
Fields are identified by their name. Fields are only set when a key is present in the map.
- Type Parameters:
T
- type of object- Parameters:
objectMap
- mappings of object contentobj
- object to map the objects from map- Since:
- 1.1.0
-