@Singleton public class JsonObjectSerializer extends Object implements ObjectSerializer
ObjectSerializer interface for Jackson.JDK| Constructor and Description |
|---|
JsonObjectSerializer(JsonMapper jsonMapper) |
| Modifier and Type | Method and Description |
|---|---|
<T> Optional<T> |
deserialize(byte[] bytes,
Argument<T> requiredType)
Deserialize the given object to bytes.
|
<T> Optional<T> |
deserialize(byte[] bytes,
Class<T> requiredType)
Deserialize the given object to bytes.
|
<T> Optional<T> |
deserialize(InputStream inputStream,
Argument<T> requiredType)
Deserialize the given object to bytes.
|
<T> Optional<T> |
deserialize(InputStream inputStream,
Class<T> requiredType)
Deserialize the given object to bytes.
|
Optional<byte[]> |
serialize(Object object)
Serialize the given object to a byte[].
|
void |
serialize(Object object,
OutputStream outputStream)
Serialize the given object to a byte[].
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserializepublic JsonObjectSerializer(JsonMapper jsonMapper)
jsonMapper - To read/write JSONpublic Optional<byte[]> serialize(Object object) throws SerializationException
ObjectSerializerserialize in interface ObjectSerializerobject - The object to serializeSerializationException - if there is a serialization problempublic void serialize(Object object, OutputStream outputStream) throws SerializationException
ObjectSerializerserialize in interface ObjectSerializerobject - The object to serializeoutputStream - The output streamSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(byte[] bytes, Class<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - The required generic typebytes - The byte arrayrequiredType - The required typeOptional of the objectSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(InputStream inputStream, Class<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - The required generic typeinputStream - The input streamrequiredType - The required typeOptional of the objectSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(byte[] bytes, Argument<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - The required generic typebytes - The byte arrayrequiredType - The required typeOptional of the objectSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(InputStream inputStream, Argument<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - The required generic typeinputStream - The input streamrequiredType - The required typeOptional of the objectSerializationException - if there is a serialization problem