public final class JacksonSerder
extends java.lang.Object
Constructor and Description |
---|
JacksonSerder()
Creates a new JacksonAdapter instance with default mapper settings.
|
Modifier and Type | Method and Description |
---|---|
static JacksonSerder |
createDefault()
maintain singleton instance of the default serializer adapter.
|
<T> T |
deserialize(java.io.InputStream inputStream,
java.lang.reflect.Type type,
SerdeEncoding encoding)
Deserializes a byte[] into a
T object. |
<T> T |
deserialize(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.reflect.Type deserializedHeadersType)
Deserialize the provided headers returned from a REST API to an entity instance declared as the model to hold
'Matching' headers.
|
<T> T |
deserialize(java.lang.String value,
java.lang.reflect.Type type,
SerdeEncoding encoding)
Deserializes a string into a
T object. |
java.lang.String |
serialize(java.lang.Object object,
SerdeEncoding encoding)
Serializes an object into a string.
|
void |
serialize(java.lang.Object object,
SerdeEncoding encoding,
java.io.OutputStream outputStream)
Serializes an object and writes its output into an
OutputStream . |
java.lang.String |
serializeList(java.util.List<?> list,
SerdeCollectionFormat format)
Serializes a list into a string with the delimiter specified with the Swagger collection format joining each
individual serialized items in the list.
|
java.lang.String |
serializeRaw(java.lang.Object object)
Serializes an object into a raw string.
|
public JacksonSerder()
public static JacksonSerder createDefault()
public java.lang.String serialize(java.lang.Object object, SerdeEncoding encoding) throws java.io.IOException
object
- the object to serializeencoding
- the encoding to use for serializationjava.io.IOException
- exception from serializationpublic void serialize(java.lang.Object object, SerdeEncoding encoding, java.io.OutputStream outputStream) throws java.io.IOException
OutputStream
.object
- The object to serialize.encoding
- The encoding to use for serialization.outputStream
- The OutputStream
where the serialized object will be written.java.io.IOException
- exception from serializationpublic java.lang.String serializeRaw(java.lang.Object object)
object
- the object to serializepublic java.lang.String serializeList(java.util.List<?> list, SerdeCollectionFormat format)
list
- the list to serializeformat
- the Swagger collection formatpublic <T> T deserialize(java.lang.String value, java.lang.reflect.Type type, SerdeEncoding encoding) throws java.io.IOException
T
object.T
- the type of the deserialized objectvalue
- the string value to deserializetype
- the type to deserializeencoding
- the encoding used in the serialized valuejava.io.IOException
- exception from reading value to deserializeSerdeParseException
- exception from deserializationpublic <T> T deserialize(java.io.InputStream inputStream, java.lang.reflect.Type type, SerdeEncoding encoding) throws java.io.IOException
T
object.T
- The type of the deserialized object.inputStream
- The InputStream
containing the serialized object data to deserialize.type
- The type to deserialize.encoding
- The encoding used to serialize value.java.io.IOException
- exception from deserializationSerdeParseException
- exception from deserializationpublic <T> T deserialize(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.reflect.Type deserializedHeadersType) throws java.io.IOException
HeaderCollection
annotation applied to
the properties in the entity.T
- the type of the deserialized objectheaders
- the REST API returned headersdeserializedHeadersType
- the type to deserializeheaders
, if header entity model does not
not exists then return nulljava.io.IOException
- If an I/O error occurs