public class OrderedKeyProtoSerde<T extends com.google.protobuf.Message> extends Object implements OrderedKeyUberSerde<T>
MAGIC_BYTE_ORDERED_KEY, MAGIC_BYTE_PROTOBUF, MAGIC_BYTE_STRING
Constructor and Description |
---|
OrderedKeyProtoSerde(T instance,
com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this deserializer.
|
void |
configure(Map<String,?> configs,
boolean isKey)
Configure this class, which will configure the underlying serializer and deserializer.
|
static <T extends com.google.protobuf.Message> |
create(T instance,
int... fieldNumbers) |
org.apache.kafka.common.utils.Bytes |
deserialize(byte[] bytes) |
org.apache.kafka.common.utils.Bytes |
deserialize(String topic,
byte[] data) |
org.apache.kafka.common.serialization.Deserializer<org.apache.kafka.common.utils.Bytes> |
deserializer() |
static void |
encodeEnum(ByteBuffer buffer,
int enumVal) |
byte[] |
fromJson(String json) |
static int |
getMaxSerializedBytes(com.google.protobuf.Message message,
com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields) |
static <T extends com.google.protobuf.Message> |
jsonToProto(String json,
T instance) |
org.apache.kafka.common.utils.Bytes |
key(T message) |
int |
numFields() |
OrderedKeyUberSerde<T> |
prefixKeySerde(int numFields) |
static <T extends com.google.protobuf.Message> |
protoToJson(T message) |
static void |
readMagicByte(ByteBuffer buffer) |
static <T extends com.google.protobuf.Message> |
readProto(ByteBuffer buffer,
T instance,
com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields) |
byte[] |
serialize(org.apache.kafka.common.utils.Bytes bytes) |
byte[] |
serialize(String topic,
org.apache.kafka.common.utils.Bytes data) |
org.apache.kafka.common.serialization.Serializer<org.apache.kafka.common.utils.Bytes> |
serializer() |
String |
toHexString(org.apache.kafka.common.utils.Bytes key) |
String |
toJson(org.apache.kafka.common.utils.Bytes bytes) |
T |
toProto(org.apache.kafka.common.utils.Bytes key) |
Class<org.apache.kafka.common.utils.Bytes> |
type() |
static void |
writeMagicByte(ByteBuffer buffer) |
static void |
writeProto(ByteBuffer buffer,
com.google.protobuf.Message message,
com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields,
int numFields) |
public OrderedKeyProtoSerde(T instance, com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields)
public static <T extends com.google.protobuf.Message> OrderedKeyProtoSerde<T> create(T instance, int... fieldNumbers)
public static void readMagicByte(ByteBuffer buffer)
public static <T extends com.google.protobuf.Message> T readProto(ByteBuffer buffer, T instance, com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields)
public static void writeMagicByte(ByteBuffer buffer)
public static void writeProto(ByteBuffer buffer, com.google.protobuf.Message message, com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields, int numFields)
public static void encodeEnum(ByteBuffer buffer, int enumVal)
public static int getMaxSerializedBytes(com.google.protobuf.Message message, com.google.common.collect.ImmutableList<com.google.protobuf.Descriptors.FieldDescriptor> fields)
public static <T extends com.google.protobuf.Message> T jsonToProto(String json, T instance)
public static <T extends com.google.protobuf.Message> String protoToJson(T message)
public Class<org.apache.kafka.common.utils.Bytes> type()
public byte[] serialize(org.apache.kafka.common.utils.Bytes bytes)
serialize
in interface SerdeWithJson<org.apache.kafka.common.utils.Bytes>
public byte[] serialize(String topic, org.apache.kafka.common.utils.Bytes data)
serialize
in interface org.apache.kafka.common.serialization.Serializer<org.apache.kafka.common.utils.Bytes>
public org.apache.kafka.common.utils.Bytes deserialize(String topic, byte[] data)
deserialize
in interface org.apache.kafka.common.serialization.Deserializer<org.apache.kafka.common.utils.Bytes>
public org.apache.kafka.common.utils.Bytes deserialize(byte[] bytes)
deserialize
in interface SerdeWithJson<org.apache.kafka.common.utils.Bytes>
public void configure(Map<String,?> configs, boolean isKey)
UberSerde
configure
in interface UberSerde<org.apache.kafka.common.utils.Bytes>
configure
in interface org.apache.kafka.common.serialization.Deserializer<org.apache.kafka.common.utils.Bytes>
configure
in interface org.apache.kafka.common.serialization.Serde<org.apache.kafka.common.utils.Bytes>
configure
in interface org.apache.kafka.common.serialization.Serializer<org.apache.kafka.common.utils.Bytes>
configs
- configs in key/value pairsisKey
- whether is for key or valuepublic void close()
UberSerde
This method must be idempotent as it may be called multiple times.
close
in interface UberSerde<org.apache.kafka.common.utils.Bytes>
close
in interface Closeable
close
in interface AutoCloseable
close
in interface org.apache.kafka.common.serialization.Deserializer<org.apache.kafka.common.utils.Bytes>
close
in interface org.apache.kafka.common.serialization.Serde<org.apache.kafka.common.utils.Bytes>
close
in interface org.apache.kafka.common.serialization.Serializer<org.apache.kafka.common.utils.Bytes>
public org.apache.kafka.common.serialization.Serializer<org.apache.kafka.common.utils.Bytes> serializer()
serializer
in interface org.apache.kafka.common.serialization.Serde<org.apache.kafka.common.utils.Bytes>
public org.apache.kafka.common.serialization.Deserializer<org.apache.kafka.common.utils.Bytes> deserializer()
deserializer
in interface org.apache.kafka.common.serialization.Serde<org.apache.kafka.common.utils.Bytes>
public byte[] fromJson(String json)
fromJson
in interface SerdeWithJson<org.apache.kafka.common.utils.Bytes>
public String toJson(org.apache.kafka.common.utils.Bytes bytes)
toJson
in interface SerdeWithJson<org.apache.kafka.common.utils.Bytes>
public OrderedKeyUberSerde<T> prefixKeySerde(int numFields)
prefixKeySerde
in interface OrderedKeyUberSerde<T extends com.google.protobuf.Message>
public int numFields()
numFields
in interface OrderedKeyUberSerde<T extends com.google.protobuf.Message>
public org.apache.kafka.common.utils.Bytes key(T message)
key
in interface OrderedKeyUberSerde<T extends com.google.protobuf.Message>
public T toProto(org.apache.kafka.common.utils.Bytes key)
toProto
in interface OrderedKeyUberSerde<T extends com.google.protobuf.Message>
public String toHexString(org.apache.kafka.common.utils.Bytes key)
toHexString
in interface OrderedKeyUberSerde<T extends com.google.protobuf.Message>