T
- the type of the POJO being (de)serialized.public class JsonSerdeV2<T> extends java.lang.Object implements Serde<T>
Constructor and Description |
---|
JsonSerdeV2()
Constructs a JsonSerdeV2 that returns a LinkedHashMap<String, Object< upon deserialization.
|
JsonSerdeV2(java.lang.Class<T> clazz)
Constructs a JsonSerdeV2 that (de)serializes POJOs of class
clazz . |
Modifier and Type | Method and Description |
---|---|
T |
fromBytes(byte[] bytes)
Deserializes given serialized object from an array of bytes to its original form.
|
static <T> JsonSerdeV2<T> |
of(java.lang.Class<T> clazz) |
byte[] |
toBytes(T obj)
Serializes given object to an array of bytes.
|
public JsonSerdeV2()
public JsonSerdeV2(java.lang.Class<T> clazz)
clazz
.clazz
- the class of the POJO being (de)serialized.public static <T> JsonSerdeV2<T> of(java.lang.Class<T> clazz)
public byte[] toBytes(T obj)
Serializer
toBytes
in interface Serializer<T>
obj
- Object of specific type to serialize.public T fromBytes(byte[] bytes)
Deserializer
fromBytes
in interface Deserializer<T>
bytes
- Array of bytes representing serialized object.