Class AbstractStructSchema<T>
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.AbstractSchema<T>
-
- org.apache.pulsar.client.impl.schema.AbstractStructSchema<T>
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.pulsar.client.api.Schema<T>
- Direct Known Subclasses:
AvroBaseStructSchema,GenericProtobufNativeSchema,ProtobufNativeSchema,StructSchema
public abstract class AbstractStructSchema<T> extends AbstractSchema<T>
minimal abstract StructSchema.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGprotected org.apache.pulsar.client.api.schema.SchemaReader<T>readerprotected org.apache.pulsar.common.schema.SchemaInfoschemaInfoprotected org.apache.pulsar.client.api.schema.SchemaInfoProviderschemaInfoProviderprotected org.apache.pulsar.client.api.schema.SchemaWriter<T>writer
-
Constructor Summary
Constructors Constructor Description AbstractStructSchema(org.apache.pulsar.common.schema.SchemaInfo schemaInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.pulsar.client.api.Schema<T>atSchemaVersion(byte[] schemaVersion)Return an instance of this schema at the given version.Tdecode(byte[] bytes)Tdecode(byte[] bytes, byte[] schemaVersion)Tdecode(io.netty.buffer.ByteBuf byteBuf)Decode a byteBuf into an object using the schema definition and deserializer implementationTdecode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion)Decode a byteBuf into an object using a given version.byte[]encode(T message)protected org.apache.pulsar.client.api.schema.SchemaReader<T>getReader()org.apache.pulsar.common.schema.SchemaInfogetSchemaInfo()protected voidsetReader(org.apache.pulsar.client.api.schema.SchemaReader<T> reader)voidsetSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)protected voidsetWriter(org.apache.pulsar.client.api.schema.SchemaWriter<T> writer)-
Methods inherited from class org.apache.pulsar.client.impl.schema.AbstractSchema
clone
-
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
schemaInfo
protected final org.apache.pulsar.common.schema.SchemaInfo schemaInfo
-
reader
protected org.apache.pulsar.client.api.schema.SchemaReader<T> reader
-
writer
protected org.apache.pulsar.client.api.schema.SchemaWriter<T> writer
-
schemaInfoProvider
protected org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider
-
-
Method Detail
-
encode
public byte[] encode(T message)
-
decode
public T decode(byte[] bytes)
-
decode
public T decode(byte[] bytes, byte[] schemaVersion)
-
decode
public T decode(io.netty.buffer.ByteBuf byteBuf)
Description copied from class: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.
- Specified by:
decodein classAbstractSchema<T>- Parameters:
byteBuf- the byte buffer to decode- Returns:
- the deserialized object
-
decode
public T decode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion)
Description copied from class:AbstractSchemaDecode a byteBuf into an object using a given version.- Overrides:
decodein classAbstractSchema<T>- Parameters:
byteBuf- the byte array to decodeschemaVersion- the schema version to decode the object. null indicates using latest version.- Returns:
- the deserialized object
-
getSchemaInfo
public org.apache.pulsar.common.schema.SchemaInfo getSchemaInfo()
-
setSchemaInfoProvider
public void setSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)
-
atSchemaVersion
public org.apache.pulsar.client.api.Schema<T> atSchemaVersion(byte[] schemaVersion) throws org.apache.pulsar.client.api.SchemaSerializationException
Description copied from class:AbstractSchemaReturn an instance of this schema at the given version.- Overrides:
atSchemaVersionin classAbstractSchema<T>- Parameters:
schemaVersion- the version- Returns:
- the schema at that specific version
- Throws:
org.apache.pulsar.client.api.SchemaSerializationException- in case of unknown schema version
-
setWriter
protected void setWriter(org.apache.pulsar.client.api.schema.SchemaWriter<T> writer)
-
setReader
protected void setReader(org.apache.pulsar.client.api.schema.SchemaReader<T> reader)
-
getReader
protected org.apache.pulsar.client.api.schema.SchemaReader<T> getReader()
-
-