Class AbstractSchema<T>
- java.lang.Object
-
- org.apache.pulsar.client.impl.schema.AbstractSchema<T>
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.pulsar.client.api.Schema<T>
- Direct Known Subclasses:
AbstractStructSchema,BooleanSchema,ByteBufferSchema,ByteBufSchema,ByteSchema,BytesSchema,DateSchema,DoubleSchema,FloatSchema,InstantSchema,IntSchema,KeyValueSchemaImpl,LocalDateSchema,LocalDateTimeSchema,LocalTimeSchema,LongSchema,ShortSchema,StringSchema,TimeSchema,TimestampSchema
public abstract class AbstractSchema<T> extends java.lang.Object implements org.apache.pulsar.client.api.Schema<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractSchema()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.apache.pulsar.client.api.Schema<?>atSchemaVersion(byte[] schemaVersion)Return an instance of this schema at the given version.org.apache.pulsar.client.api.Schema<T>clone()abstract 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.
-
-
-
Method Detail
-
decode
public abstract T decode(io.netty.buffer.ByteBuf byteBuf)
Decode 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.
- Parameters:
byteBuf- the byte buffer to decode- Returns:
- the deserialized object
-
decode
public T decode(io.netty.buffer.ByteBuf byteBuf, byte[] schemaVersion)
Decode a byteBuf into an object using a given version.- Parameters:
byteBuf- the byte array to decodeschemaVersion- the schema version to decode the object. null indicates using latest version.- Returns:
- the deserialized object
-
clone
public org.apache.pulsar.client.api.Schema<T> clone()
- Specified by:
clonein interfaceorg.apache.pulsar.client.api.Schema<T>- Overrides:
clonein classjava.lang.Object
-
atSchemaVersion
public org.apache.pulsar.client.api.Schema<?> atSchemaVersion(byte[] schemaVersion) throws org.apache.pulsar.client.api.SchemaSerializationExceptionReturn an instance of this schema at the given version.- Parameters:
schemaVersion- the version- Returns:
- the schema at that specific version
- Throws:
org.apache.pulsar.client.api.SchemaSerializationException- in case of unknown schema versionjava.lang.NullPointerException- in case of null schemaVersion and supportSchemaVersioning is true
-
-