public class KeyValueSchemaImpl<K,V> extends AbstractSchema<KeyValue<K,V>> implements KeyValueSchema<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected SchemaInfoProvider |
schemaInfoProvider |
BOOL, BYTEBUFFER, BYTES, DATE, DOUBLE, FLOAT, INSTANT, INT16, INT32, INT64, INT8, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, STRING, TIME, TIMESTAMP| Modifier and Type | Method and Description |
|---|---|
Schema<?> |
atSchemaVersion(byte[] schemaVersion)
Return an instance of this schema at the given version.
|
Schema<KeyValue<K,V>> |
clone() |
void |
configureSchemaInfo(String topicName,
String componentName,
SchemaInfo schemaInfo) |
KeyValue<K,V> |
decode(byte[] bytes) |
KeyValue<K,V> |
decode(byte[] bytes,
byte[] schemaVersion) |
KeyValue<K,V> |
decode(byte[] keyBytes,
byte[] valueBytes,
byte[] schemaVersion) |
KeyValue<K,V> |
decode(io.netty.buffer.ByteBuf byteBuf)
Decode a byteBuf into an object using the schema definition and deserializer implementation
|
KeyValue<K,V> |
decode(io.netty.buffer.ByteBuf byteBuf,
byte[] schemaVersion)
Decode a byteBuf into an object using a given version.
|
byte[] |
encode(KeyValue<K,V> message) |
Schema<K> |
getKeySchema()
Get the Schema of the Key.
|
KeyValueEncodingType |
getKeyValueEncodingType()
Get the KeyValueEncodingType.
|
SchemaInfo |
getSchemaInfo() |
Schema<V> |
getValueSchema()
Get the Schema of the Value.
|
static Schema<KeyValue<byte[],byte[]>> |
kvBytes() |
static <K,V> Schema<KeyValue<K,V>> |
of(Class<K> key,
Class<V> value,
SchemaType type)
Key Value Schema using passed in schema type, support JSON and AVRO currently.
|
static <K,V> Schema<KeyValue<K,V>> |
of(Schema<K> keySchema,
Schema<V> valueSchema) |
static <K,V> Schema<KeyValue<K,V>> |
of(Schema<K> keySchema,
Schema<V> valueSchema,
KeyValueEncodingType keyValueEncodingType) |
boolean |
requireFetchingSchemaInfo() |
void |
setSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider) |
boolean |
supportSchemaVersioning() |
String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitAUTO_CONSUME, AUTO_PRODUCE_BYTES, AUTO_PRODUCE_BYTES, AUTO, AVRO, AVRO, decode, generic, getNativeSchema, getSchema, JSON, JSON, KeyValue, KeyValue, KeyValue, KeyValue, KV_BYTES, PROTOBUF_NATIVE, PROTOBUF_NATIVE, PROTOBUF, PROTOBUF, validateprotected SchemaInfoProvider schemaInfoProvider
public static <K,V> Schema<KeyValue<K,V>> of(Class<K> key, Class<V> value, SchemaType type)
public static <K,V> Schema<KeyValue<K,V>> of(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType)
public boolean supportSchemaVersioning()
supportSchemaVersioning in interface Schema<KeyValue<K,V>>public KeyValue<K,V> decode(io.netty.buffer.ByteBuf byteBuf)
AbstractSchemaDo not modify reader/writer index of ByteBuf so, it can be reused to access correct data.
decode in class AbstractSchema<KeyValue<K,V>>byteBuf - the byte buffer to decodepublic KeyValue<K,V> decode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion)
AbstractSchemadecode in class AbstractSchema<KeyValue<K,V>>byteBuf - the byte array to decodeschemaVersion - the schema version to decode the object. null indicates using latest version.public SchemaInfo getSchemaInfo()
getSchemaInfo in interface Schema<KeyValue<K,V>>public void setSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider)
setSchemaInfoProvider in interface Schema<KeyValue<K,V>>public boolean requireFetchingSchemaInfo()
requireFetchingSchemaInfo in interface Schema<KeyValue<K,V>>public void configureSchemaInfo(String topicName, String componentName, SchemaInfo schemaInfo)
configureSchemaInfo in interface Schema<KeyValue<K,V>>public Schema<?> atSchemaVersion(byte[] schemaVersion) throws SchemaSerializationException
AbstractSchemaatSchemaVersion in class AbstractSchema<KeyValue<K,V>>schemaVersion - the versionSchemaSerializationException - in case of unknown schema versionpublic Schema<K> getKeySchema()
getKeySchema in interface KeyValueSchema<K,V>public Schema<V> getValueSchema()
getValueSchema in interface KeyValueSchema<K,V>public KeyValueEncodingType getKeyValueEncodingType()
getKeyValueEncodingType in interface KeyValueSchema<K,V>KeyValueEncodingType.INLINE,
KeyValueEncodingType.SEPARATEDCopyright © 2017–2021 Apache Software Foundation. All rights reserved.