T
- The type to serialize/deserialize@Prototype
public class JsonSerde<T>
extends java.lang.Object
implements org.apache.kafka.common.serialization.Serializer<T>, org.apache.kafka.common.serialization.Deserializer<T>, org.apache.kafka.common.serialization.Serde<T>
Serializer
and Deserializer
for JSON.Constructor and Description |
---|
JsonSerde(java.lang.Class<T> type)
Constructs a new instance for the given arguments.
|
JsonSerde(io.micronaut.jackson.serialize.JacksonObjectSerializer objectSerializer,
java.lang.Class<T> type)
Constructs a new instance for the given arguments.
|
JsonSerde(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
java.lang.Class<T> type)
Constructs a new instance for the given arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs,
boolean isKey) |
T |
deserialize(java.lang.String topic,
byte[] data) |
org.apache.kafka.common.serialization.Deserializer<T> |
deserializer() |
byte[] |
serialize(java.lang.String topic,
T data) |
org.apache.kafka.common.serialization.Serializer<T> |
serializer() |
java.lang.String |
toString() |
@Inject public JsonSerde(io.micronaut.jackson.serialize.JacksonObjectSerializer objectSerializer, @Parameter java.lang.Class<T> type)
objectSerializer
- The JacksonObjectSerializer
type
- The target typepublic JsonSerde(java.lang.Class<T> type)
ObjectMapper
type
- The target typepublic JsonSerde(com.fasterxml.jackson.databind.ObjectMapper objectMapper, java.lang.Class<T> type)
ObjectMapper
objectMapper
- The object mapper to usetype
- The target typepublic T deserialize(java.lang.String topic, byte[] data)
deserialize
in interface org.apache.kafka.common.serialization.Deserializer<T>
public void configure(java.util.Map<java.lang.String,?> configs, boolean isKey)
public byte[] serialize(java.lang.String topic, T data)
serialize
in interface org.apache.kafka.common.serialization.Serializer<T>
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface org.apache.kafka.common.serialization.Deserializer<T>
close
in interface org.apache.kafka.common.serialization.Serde<T>
close
in interface org.apache.kafka.common.serialization.Serializer<T>
public org.apache.kafka.common.serialization.Serializer<T> serializer()
serializer
in interface org.apache.kafka.common.serialization.Serde<T>
public org.apache.kafka.common.serialization.Deserializer<T> deserializer()
deserializer
in interface org.apache.kafka.common.serialization.Serde<T>
public java.lang.String toString()
toString
in class java.lang.Object