Package com.backpackcloud.zipper
Interface Serializer
-
- All Known Implementing Classes:
SerializerImpl
public interface SerializerInterface that exposes components for serializing different formats of input.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <E> SerializeraddDependency(Class<E> type, E dependency)SerializeraddDependency(String name, Object dependency)<E> Edeserialize(File file, Class<E> type)Deserialize the given file content into an object of the given class.<E> Edeserialize(InputStream input, Class<E> type)Deserialize the given input into an object of the given class.<E> Edeserialize(String input, Class<E> type)Deserialize the given input into an object of the given class.static Serializerjson()Returns the mapper for json data type.Stringserialize(Object object)Serializes the given object into a String.static Serializerusing(com.fasterxml.jackson.databind.ObjectMapper objectMapper)static Serializeryaml()Returns the mapper for the yaml data type.
-
-
-
Method Detail
-
serialize
String serialize(Object object)
Serializes the given object into a String.- Parameters:
object- the object to serialize- Returns:
- the serialized object.
-
deserialize
<E> E deserialize(String input, Class<E> type)
Deserialize the given input into an object of the given class.- Parameters:
input- the input to deserializetype- the type of the result object- Returns:
- the deserialized object.
-
deserialize
<E> E deserialize(File file, Class<E> type)
Deserialize the given file content into an object of the given class.- Parameters:
file- the file containing the input to deserializetype- the type of the result object- Returns:
- the deserialized object.
-
deserialize
<E> E deserialize(InputStream input, Class<E> type)
Deserialize the given input into an object of the given class.- Parameters:
input- the input to deserializetype- the type of the result object- Returns:
- the deserialized object.
-
addDependency
Serializer addDependency(String name, Object dependency)
-
addDependency
<E> Serializer addDependency(Class<E> type, E dependency)
-
json
static Serializer json()
Returns the mapper for json data type.- Returns:
- the mapper for json data type.
-
yaml
static Serializer yaml()
Returns the mapper for the yaml data type.- Returns:
- the mapper for the yaml data type.
-
using
static Serializer using(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-