public abstract class StructSchema<T> extends AbstractSchema<T>
Currently Pulsar supports 3 `Struct` types -
SchemaType.AVRO,
SchemaType.JSON,
and SchemaType.PROTOBUF.
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
LOG |
protected SchemaReader<T> |
reader |
protected org.apache.avro.Schema |
schema |
protected SchemaInfo |
schemaInfo |
protected SchemaInfoProvider |
schemaInfoProvider |
protected SchemaWriter<T> |
writer |
| Modifier | Constructor and Description |
|---|---|
protected |
StructSchema(SchemaInfo schemaInfo) |
| Modifier and Type | Method and Description |
|---|---|
protected static org.apache.avro.Schema |
createAvroSchema(SchemaDefinition schemaDefinition) |
T |
decode(byte[] bytes) |
T |
decode(byte[] bytes,
byte[] schemaVersion) |
T |
decode(io.netty.buffer.ByteBuf byteBuf)
Decode a byteBuf into an object using the schema definition and deserializer implementation
|
T |
decode(io.netty.buffer.ByteBuf byteBuf,
byte[] schemaVersion)
Decode a byteBuf into an object using a given version.
|
byte[] |
encode(T message) |
protected static org.apache.avro.Schema |
extractAvroSchema(SchemaDefinition schemaDefinition,
Class pojo) |
org.apache.avro.Schema |
getAvroSchema() |
protected SchemaReader<T> |
getReader() |
SchemaInfo |
getSchemaInfo() |
protected SchemaInfo |
getSchemaInfoByVersion(byte[] schemaVersion)
TODO: think about how to make this async
|
protected abstract SchemaReader<T> |
loadReader(BytesSchemaVersion schemaVersion)
Load the schema reader for reading messages encoded by the given schema version.
|
protected static org.apache.avro.Schema |
parseAvroSchema(String schemaJson) |
static <T> SchemaInfo |
parseSchemaInfo(SchemaDefinition<T> schemaDefinition,
SchemaType schemaType) |
protected void |
setReader(SchemaReader<T> reader) |
void |
setSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider) |
protected void |
setWriter(SchemaWriter<T> writer) |
cloneequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitAUTO_CONSUME, AUTO_PRODUCE_BYTES, AUTO_PRODUCE_BYTES, AUTO, AVRO, AVRO, configureSchemaInfo, generic, getSchema, JSON, JSON, KeyValue, KeyValue, KeyValue, KeyValue, KV_BYTES, PROTOBUF, PROTOBUF, requireFetchingSchemaInfo, supportSchemaVersioning, validateprotected static final org.slf4j.Logger LOG
protected final org.apache.avro.Schema schema
protected final SchemaInfo schemaInfo
protected SchemaReader<T> reader
protected SchemaWriter<T> writer
protected SchemaInfoProvider schemaInfoProvider
protected StructSchema(SchemaInfo schemaInfo)
public org.apache.avro.Schema getAvroSchema()
public byte[] encode(T message)
public T decode(byte[] bytes)
public T decode(byte[] bytes, byte[] schemaVersion)
public T decode(io.netty.buffer.ByteBuf byteBuf)
AbstractSchemadecode in class AbstractSchema<T>byteBuf - the byte buffer to decodepublic T decode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion)
AbstractSchemadecode in class AbstractSchema<T>byteBuf - the byte array to decodeschemaVersion - the schema version to decode the object. null indicates using latest version.public SchemaInfo getSchemaInfo()
protected static org.apache.avro.Schema createAvroSchema(SchemaDefinition schemaDefinition)
protected static org.apache.avro.Schema extractAvroSchema(SchemaDefinition schemaDefinition, Class pojo)
protected static org.apache.avro.Schema parseAvroSchema(String schemaJson)
public static <T> SchemaInfo parseSchemaInfo(SchemaDefinition<T> schemaDefinition, SchemaType schemaType)
public void setSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider)
protected abstract SchemaReader<T> loadReader(BytesSchemaVersion schemaVersion)
schemaVersion - the provided schema versionprotected SchemaInfo getSchemaInfoByVersion(byte[] schemaVersion)
protected void setWriter(SchemaWriter<T> writer)
protected void setReader(SchemaReader<T> reader)
protected SchemaReader<T> getReader()
Copyright © 2017–2020 Apache Software Foundation. All rights reserved.