T - The type to serialize/deserialize@Prototype public class JsonSerde<T> extends Object implements Serializer<T>, Deserializer<T>, Serde<T>
Serializer and Deserializer for JSON.| Constructor and Description |
|---|
JsonSerde(Class<T> type)
Constructs a new instance for the given arguments.
|
JsonSerde(JacksonObjectSerializer objectSerializer,
Class<T> type)
Constructs a new instance for the given arguments.
|
JsonSerde(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
Class<T> type)
Constructs a new instance for the given arguments.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
configure(Map<String,?> configs,
boolean isKey) |
T |
deserialize(String topic,
byte[] data) |
Deserializer<T> |
deserializer() |
byte[] |
serialize(String topic,
T data) |
Serializer<T> |
serializer() |
String |
toString() |
@Inject public JsonSerde(JacksonObjectSerializer objectSerializer, @Parameter Class<T> type)
objectSerializer - The JacksonObjectSerializertype - The target typepublic JsonSerde(Class<T> type)
ObjectMappertype - The target typepublic T deserialize(String topic, byte[] data)
deserialize in interface Deserializer<T>public void configure(Map<String,?> configs, boolean isKey)
configure in interface Deserializer<T>configure in interface Serde<T>configure in interface Serializer<T>public byte[] serialize(String topic, T data)
serialize in interface Serializer<T>public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface Deserializer<T>close in interface Serde<T>close in interface Serializer<T>public Serializer<T> serializer()
serializer in interface Serde<T>public Deserializer<T> deserializer()
deserializer in interface Serde<T>