Class TUnion<T extends TUnion<T,F>,F extends TFieldIdEnum>

java.lang.Object
org.apache.thrift.TUnion<T,F>
All Implemented Interfaces:
Serializable, Comparable<T>, TBase<T,F>, TSerializable

public abstract class TUnion<T extends TUnion<T,F>,F extends TFieldIdEnum> extends Object implements TBase<T,F>
See Also:
  • Field Details

  • Constructor Details

    • TUnion

      protected TUnion()
    • TUnion

      protected TUnion(F setField, Object value)
    • TUnion

      protected TUnion(TUnion<T,F> other)
  • Method Details

    • getSetField

      public F getSetField()
    • getFieldValue

      public Object getFieldValue()
    • getFieldValue

      public Object getFieldValue(F fieldId)
      Description copied from interface: TBase
      Get a field's value by field variable. Primitive types will be wrapped in the appropriate "boxed" types.
      Specified by:
      getFieldValue in interface TBase<T extends TUnion<T,F>,F extends TFieldIdEnum>
      Parameters:
      fieldId - the field whose value is requested.
      Returns:
      the value of the requested field.
    • getFieldValue

      public Object getFieldValue(int fieldId)
    • isSet

      public boolean isSet()
    • isSet

      public boolean isSet(F fieldId)
      Description copied from interface: TBase
      Check if a field is currently set or unset.
      Specified by:
      isSet in interface TBase<T extends TUnion<T,F>,F extends TFieldIdEnum>
      Parameters:
      fieldId - the field to check.
      Returns:
      true if the field is set, false otherwise.
    • isSet

      public boolean isSet(int fieldId)
    • read

      public void read(TProtocol iprot) throws TException
      Description copied from interface: TSerializable
      Reads the TObject from the given input protocol.
      Specified by:
      read in interface TSerializable
      Parameters:
      iprot - Input protocol
      Throws:
      TException - if there is an error reading from iprot
    • setFieldValue

      public void setFieldValue(F fieldId, Object value)
      Description copied from interface: TBase
      Set a field's value by field variable. Primitive types must be "boxed" in the appropriate object wrapper type.
      Specified by:
      setFieldValue in interface TBase<T extends TUnion<T,F>,F extends TFieldIdEnum>
      Parameters:
      fieldId - the field whose value is to be set.
      value - the value to be assigned to field.
    • setFieldValue

      public void setFieldValue(int fieldId, Object value)
    • write

      public void write(TProtocol oprot) throws TException
      Description copied from interface: TSerializable
      Writes the objects out to the protocol
      Specified by:
      write in interface TSerializable
      Parameters:
      oprot - Output protocol
      Throws:
      TException - if there is an error writing to oprot
    • checkType

      protected abstract void checkType(F setField, Object value) throws ClassCastException
      Implementation should be generated so that we can efficiently type check various values.
      Parameters:
      setField - the field to assign value to.
      value - the value to be assigned to setField.
      Throws:
      ClassCastException - if the type of value is incompatible with the type of setField.
    • standardSchemeReadValue

      protected abstract Object standardSchemeReadValue(TProtocol iprot, TField field) throws TException
      Implementation should be generated to read the right stuff from the wire based on the field header.
      Parameters:
      iprot - input protocol from which to read a value.
      field - the field whose value is to be read from iprot.
      Returns:
      read Object based on the field header, as specified by the argument.
      Throws:
      TException - on error during read.
    • standardSchemeWriteValue

      protected abstract void standardSchemeWriteValue(TProtocol oprot) throws TException
      Throws:
      TException
    • tupleSchemeReadValue

      protected abstract Object tupleSchemeReadValue(TProtocol iprot, short fieldID) throws TException
      Throws:
      TException
    • tupleSchemeWriteValue

      protected abstract void tupleSchemeWriteValue(TProtocol oprot) throws TException
      Throws:
      TException
    • getStructDesc

      protected abstract TStruct getStructDesc()
    • getFieldDesc

      protected abstract TField getFieldDesc(F setField)
    • enumForId

      protected abstract F enumForId(short id)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clear

      public final void clear()
      Description copied from interface: TBase
      Return to the state of having just been initialized, as though you had just called the default constructor.
      Specified by:
      clear in interface TBase<T extends TUnion<T,F>,F extends TFieldIdEnum>