Class AbstractSchema<T>

    • Field Summary

      • Fields inherited from interface 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
    • 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 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.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.pulsar.client.api.Schema

        configureSchemaInfo, decode, decode, decode, encode, getNativeSchema, getSchemaInfo, requireFetchingSchemaInfo, setSchemaInfoProvider, supportSchemaVersioning, validate
    • Constructor Detail

      • AbstractSchema

        public AbstractSchema()
    • Method Detail

      • decode

        public abstract T decode​(io.netty.buffer.ByteBuf byteBuf)
        Decode a byteBuf into an object using the schema definition and deserializer implementation

        Do 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 decode
        schemaVersion - 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:
        clone in interface org.apache.pulsar.client.api.Schema<T>
        Overrides:
        clone in class java.lang.Object
      • atSchemaVersion

        public org.apache.pulsar.client.api.Schema<?> atSchemaVersion​(byte[] schemaVersion)
                                                               throws org.apache.pulsar.client.api.SchemaSerializationException
        Return 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 version
        java.lang.NullPointerException - in case of null schemaVersion and supportSchemaVersioning is true