Class SerializeContainer
java.lang.Object
de.eldoria.eldoutilities.serialization.wrapper.SerializeContainer
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ConfigurationSerializable>
TdeserializeFromJson
(String json, Class<T> clazz) Convert a json serialized object to a new object instancestatic SerializeContainer
Create a container from a map which was serialized previouslystatic SerializeContainer
Create a container from a serializable object.static String
Convert a serializable object to a json stringtoJson()
Conversts the underlying map to a json string<T extends ConfigurationSerializable>
TConverts the underlying map to the object
-
Method Details
-
fromObject
Create a container from a serializable object.- Parameters:
obj
- onbect to serialize- Returns:
- container holding the object as a map.
-
fromJson
Create a container from a map which was serialized previously- Parameters:
json
- json string- Returns:
- container holding the string as a map
-
serializeToJson
Convert a serializable object to a json string- Parameters:
obj
- object to serialize- Returns:
- object as string
-
deserializeFromJson
public static <T extends ConfigurationSerializable> T deserializeFromJson(String json, Class<T> clazz) Convert a json serialized object to a new object instance- Type Parameters:
T
- type to return- Parameters:
json
- json to convertclazz
- clazz to determine the return type- Returns:
- a new instance of the serialzied object.
-
toObject
Converts the underlying map to the object- Type Parameters:
T
- type to return- Parameters:
clazz
- clazz to determine the return type- Returns:
- a new instance of the serialzied object.
-
toJson
Conversts the underlying map to a json string- Returns:
- map as json string
-