Interface ThriftCodec<T>

Type Parameters:
T - the type this codec supports
All Known Implementing Classes:
AbstractReflectionThriftCodec, BooleanArrayThriftCodec, BooleanThriftCodec, ByteBufferThriftCodec, ByteThriftCodec, CoercionThriftCodec, DelegateCodec, DoubleArrayThriftCodec, DoubleThriftCodec, EnumThriftCodec, IntArrayThriftCodec, IntegerThriftCodec, ListThriftCodec, LongArrayThriftCodec, LongThriftCodec, MapThriftCodec, OptionalDoubleThriftCodec, OptionalIntThriftCodec, OptionalLongThriftCodec, OptionalThriftCodec, ReflectionThriftStructCodec, ReflectionThriftUnionCodec, SetThriftCodec, ShortArrayThriftCodec, ShortThriftCodec, StringThriftCodec, VoidThriftCodec

public interface ThriftCodec<T>

A single type codec for reading and writing in Thrift format. Each codec is symmetric and therefore only supports a single concrete type.

Implementations of this interface are expected to be thread safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    The Thrift type this codec supports.
    default boolean
    isNull(T value)
    If the value is effectively null and should not be written.
    Reads a value from supplied Thrift protocol reader.
    void
    write(T value, TProtocolWriter protocol)
    Writes a value to the supplied Thrift protocol writer.
  • Method Details

    • getType

      ThriftType getType()
      The Thrift type this codec supports. The Thrift type contains the Java generic Type of the codec.
    • read

      T read(TProtocolReader protocol) throws Exception
      Reads a value from supplied Thrift protocol reader.
      Parameters:
      protocol - the protocol to read from
      Returns:
      the value; not null
      Throws:
      Exception - if any problems occurred when reading or coercing the value
    • write

      void write(T value, TProtocolWriter protocol) throws Exception
      Writes a value to the supplied Thrift protocol writer.
      Parameters:
      value - the value to write; not null
      protocol - the protocol to write to
      Throws:
      Exception - if any problems occurred when writing or coercing the value
    • isNull

      default boolean isNull(T value)
      If the value is effectively null and should not be written.
      Parameters:
      value - the value to test
      Returns:
      true if the value should not be written