类 KeyValueSchemaImpl<K,V>
java.lang.Object
org.apache.pulsar.client.impl.schema.AbstractSchema<KeyValue<K,V>>
org.apache.pulsar.client.impl.schema.KeyValueSchemaImpl<K,V>
- 所有已实现的接口:
Cloneable,Schema<KeyValue<K,,V>> KeyValueSchema<K,V>
public class KeyValueSchemaImpl<K,V>
extends AbstractSchema<KeyValue<K,V>>
implements KeyValueSchema<K,V>
[Key, Value] pair schema definition.
-
字段概要
字段从接口继承的字段 org.apache.pulsar.client.api.Schema
BOOL, BYTEBUFFER, BYTES, DATE, DOUBLE, FLOAT, INSTANT, INT16, INT32, INT64, INT8, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, STRING, TIME, TIMESTAMP -
方法概要
修饰符和类型方法说明Schema<?>atSchemaVersion(byte[] schemaVersion) Return an instance of this schema at the given version.clone()voidconfigureSchemaInfo(String topicName, String componentName, SchemaInfo schemaInfo) decode(byte[] bytes) decode(byte[] bytes, byte[] schemaVersion) decode(byte[] keyBytes, byte[] valueBytes, byte[] schemaVersion) decode(io.netty.buffer.ByteBuf byteBuf) Decode a byteBuf into an object using the schema definition and deserializer implementationdecode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion) Decode a byteBuf into an object using a given version.byte[]voidfetchSchemaIfNeeded(String topicName, SchemaVersion schemaVersion) It may happen that the schema is not loaded but we need it, for instance in order to call getSchemaInfo() We cannot call this method in getSchemaInfo.Get the Schema of the Key.Get the KeyValueEncodingType.Get the Schema of the Value.kvBytes()of(Class<K> key, Class<V> value, SchemaType type) Key Value Schema using passed in schema type, support JSON and AVRO currently.of(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) booleanvoidsetSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider) booleantoString()从接口继承的方法 org.apache.pulsar.client.api.Schema
decode, decode, getNativeSchema, validate
-
字段详细资料
-
schemaInfoProvider
-
-
方法详细资料
-
of
Key Value Schema using passed in schema type, support JSON and AVRO currently. -
of
-
of
public static <K,V> Schema<KeyValue<K,V>> of(Schema<K> keySchema, Schema<V> valueSchema, KeyValueEncodingType keyValueEncodingType) -
kvBytes
-
supportSchemaVersioning
public boolean supportSchemaVersioning()- 指定者:
supportSchemaVersioning在接口中Schema<K>
-
encode
-
decode
-
decode
-
decode
从类复制的说明:AbstractSchemaDecode a byteBuf into an object using the schema definition and deserializer implementationDo not modify reader/writer index of ByteBuf so, it can be reused to access correct data.
- 指定者:
decode在类中AbstractSchema<KeyValue<K,V>> - 参数:
byteBuf- the byte buffer to decode- 返回:
- the deserialized object
-
decode
从类复制的说明:AbstractSchemaDecode a byteBuf into an object using a given version.- 覆盖:
decode在类中AbstractSchema<KeyValue<K,V>> - 参数:
byteBuf- the byte array to decodeschemaVersion- the schema version to decode the object. null indicates using latest version.- 返回:
- the deserialized object
-
decode
-
getSchemaInfo
- 指定者:
getSchemaInfo在接口中Schema<K>
-
setSchemaInfoProvider
- 指定者:
setSchemaInfoProvider在接口中Schema<K>
-
requireFetchingSchemaInfo
public boolean requireFetchingSchemaInfo()- 指定者:
requireFetchingSchemaInfo在接口中Schema<K>
-
configureSchemaInfo
- 指定者:
configureSchemaInfo在接口中Schema<K>
-
clone
-
toString
-
atSchemaVersion
从类复制的说明:AbstractSchemaReturn an instance of this schema at the given version.- 覆盖:
atSchemaVersion在类中AbstractSchema<KeyValue<K,V>> - 参数:
schemaVersion- the version- 返回:
- the schema at that specific version
- 抛出:
SchemaSerializationException- in case of unknown schema version
-
getKeySchema
Get the Schema of the Key.- 指定者:
getKeySchema在接口中KeyValueSchema<K,V> - 返回:
- the Schema of the Key
-
getValueSchema
Get the Schema of the Value.- 指定者:
getValueSchema在接口中KeyValueSchema<K,V> - 返回:
- the Schema of the Value
-
getKeyValueEncodingType
Get the KeyValueEncodingType.- 指定者:
getKeyValueEncodingType在接口中KeyValueSchema<K,V> - 返回:
- the KeyValueEncodingType
- 另请参阅:
-
fetchSchemaIfNeeded
public void fetchSchemaIfNeeded(String topicName, SchemaVersion schemaVersion) throws SchemaSerializationException It may happen that the schema is not loaded but we need it, for instance in order to call getSchemaInfo() We cannot call this method in getSchemaInfo.
-