Class SpecificJsonSerdes<T>
- java.lang.Object
-
- io.streamthoughts.azkarra.http.serialization.json.SpecificJsonSerdes<T>
-
- All Implemented Interfaces:
Configurable
,Serdes<T>
,Closeable
,AutoCloseable
public final class SpecificJsonSerdes<T> extends Object implements Serdes<T>
-
-
Constructor Summary
Constructors Constructor Description SpecificJsonSerdes(Json json, Class<T> type)
Creates a newSpecificJsonSerdes
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
contentType()
Get the content-type attached to thisSerdes
.T
deserialize(byte[] data)
Deserialize data from a byte array into a value or object.byte[]
serialize(Object object)
Serialize a data object into a byte array.
-
-
-
Constructor Detail
-
SpecificJsonSerdes
public SpecificJsonSerdes(Json json, Class<T> type)
Creates a newSpecificJsonSerdes
instance.- Parameters:
json
- theJson
object.
-
-
Method Detail
-
contentType
public String contentType()
Get the content-type attached to thisSerdes
.- Specified by:
contentType
in interfaceSerdes<T>
- Returns:
- a string representing the content-type.
-
serialize
public byte[] serialize(Object object) throws SerializationException
Serialize a data object into a byte array.- Specified by:
serialize
in interfaceSerdes<T>
- Parameters:
object
- the data object to convert; may be null.- Returns:
- the serialized data byte array; may be null
- Throws:
SerializationException
-
deserialize
public T deserialize(byte[] data) throws SerializationException
Deserialize data from a byte array into a value or object.- Specified by:
deserialize
in interfaceSerdes<T>
- Parameters:
data
- the data byte array to deserialize; may be null.- Returns:
- the deserialized typed data; may be null
- Throws:
SerializationException
-
-