All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.iotdb.common.rpc.thrift.TSStatus Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.iotdb.common.rpc.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2024-09-12")
public class TSStatus implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSStatus");

  private static final org.apache.thrift.protocol.TField CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField SUB_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("subStatus", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField REDIRECT_NODE_FIELD_DESC = new org.apache.thrift.protocol.TField("redirectNode", org.apache.thrift.protocol.TType.STRUCT, (short)4);
  private static final org.apache.thrift.protocol.TField NEED_RETRY_FIELD_DESC = new org.apache.thrift.protocol.TField("needRetry", org.apache.thrift.protocol.TType.BOOL, (short)5);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TSStatusStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TSStatusTupleSchemeFactory();

  public int code; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String message; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List subStatus; // optional
  public @org.apache.thrift.annotation.Nullable TEndPoint redirectNode; // optional
  public boolean needRetry; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    CODE((short)1, "code"),
    MESSAGE((short)2, "message"),
    SUB_STATUS((short)3, "subStatus"),
    REDIRECT_NODE((short)4, "redirectNode"),
    NEED_RETRY((short)5, "needRetry");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // CODE
          return CODE;
        case 2: // MESSAGE
          return MESSAGE;
        case 3: // SUB_STATUS
          return SUB_STATUS;
        case 4: // REDIRECT_NODE
          return REDIRECT_NODE;
        case 5: // NEED_RETRY
          return NEED_RETRY;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __CODE_ISSET_ID = 0;
  private static final int __NEEDRETRY_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.MESSAGE,_Fields.SUB_STATUS,_Fields.REDIRECT_NODE,_Fields.NEED_RETRY};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.CODE, new org.apache.thrift.meta_data.FieldMetaData("code", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SUB_STATUS, new org.apache.thrift.meta_data.FieldMetaData("subStatus", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "TSStatus"))));
    tmpMap.put(_Fields.REDIRECT_NODE, new org.apache.thrift.meta_data.FieldMetaData("redirectNode", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TEndPoint.class)));
    tmpMap.put(_Fields.NEED_RETRY, new org.apache.thrift.meta_data.FieldMetaData("needRetry", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSStatus.class, metaDataMap);
  }

  public TSStatus() {
  }

  public TSStatus(
    int code)
  {
    this();
    this.code = code;
    setCodeIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public TSStatus(TSStatus other) {
    __isset_bitfield = other.__isset_bitfield;
    this.code = other.code;
    if (other.isSetMessage()) {
      this.message = other.message;
    }
    if (other.isSetSubStatus()) {
      java.util.List __this__subStatus = new java.util.ArrayList(other.subStatus.size());
      for (TSStatus other_element : other.subStatus) {
        __this__subStatus.add(new TSStatus(other_element));
      }
      this.subStatus = __this__subStatus;
    }
    if (other.isSetRedirectNode()) {
      this.redirectNode = new TEndPoint(other.redirectNode);
    }
    this.needRetry = other.needRetry;
  }

  public TSStatus deepCopy() {
    return new TSStatus(this);
  }

  @Override
  public void clear() {
    setCodeIsSet(false);
    this.code = 0;
    this.message = null;
    this.subStatus = null;
    this.redirectNode = null;
    setNeedRetryIsSet(false);
    this.needRetry = false;
  }

  public int getCode() {
    return this.code;
  }

  public TSStatus setCode(int code) {
    this.code = code;
    setCodeIsSet(true);
    return this;
  }

  public void unsetCode() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CODE_ISSET_ID);
  }

  /** Returns true if field code is set (has been assigned a value) and false otherwise */
  public boolean isSetCode() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CODE_ISSET_ID);
  }

  public void setCodeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CODE_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getMessage() {
    return this.message;
  }

  public TSStatus setMessage(@org.apache.thrift.annotation.Nullable java.lang.String message) {
    this.message = message;
    return this;
  }

  public void unsetMessage() {
    this.message = null;
  }

  /** Returns true if field message is set (has been assigned a value) and false otherwise */
  public boolean isSetMessage() {
    return this.message != null;
  }

  public void setMessageIsSet(boolean value) {
    if (!value) {
      this.message = null;
    }
  }

  public int getSubStatusSize() {
    return (this.subStatus == null) ? 0 : this.subStatus.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator getSubStatusIterator() {
    return (this.subStatus == null) ? null : this.subStatus.iterator();
  }

  public void addToSubStatus(TSStatus elem) {
    if (this.subStatus == null) {
      this.subStatus = new java.util.ArrayList();
    }
    this.subStatus.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List getSubStatus() {
    return this.subStatus;
  }

  public TSStatus setSubStatus(@org.apache.thrift.annotation.Nullable java.util.List subStatus) {
    this.subStatus = subStatus;
    return this;
  }

  public void unsetSubStatus() {
    this.subStatus = null;
  }

  /** Returns true if field subStatus is set (has been assigned a value) and false otherwise */
  public boolean isSetSubStatus() {
    return this.subStatus != null;
  }

  public void setSubStatusIsSet(boolean value) {
    if (!value) {
      this.subStatus = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TEndPoint getRedirectNode() {
    return this.redirectNode;
  }

  public TSStatus setRedirectNode(@org.apache.thrift.annotation.Nullable TEndPoint redirectNode) {
    this.redirectNode = redirectNode;
    return this;
  }

  public void unsetRedirectNode() {
    this.redirectNode = null;
  }

  /** Returns true if field redirectNode is set (has been assigned a value) and false otherwise */
  public boolean isSetRedirectNode() {
    return this.redirectNode != null;
  }

  public void setRedirectNodeIsSet(boolean value) {
    if (!value) {
      this.redirectNode = null;
    }
  }

  public boolean isNeedRetry() {
    return this.needRetry;
  }

  public TSStatus setNeedRetry(boolean needRetry) {
    this.needRetry = needRetry;
    setNeedRetryIsSet(true);
    return this;
  }

  public void unsetNeedRetry() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NEEDRETRY_ISSET_ID);
  }

  /** Returns true if field needRetry is set (has been assigned a value) and false otherwise */
  public boolean isSetNeedRetry() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NEEDRETRY_ISSET_ID);
  }

  public void setNeedRetryIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NEEDRETRY_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CODE:
      if (value == null) {
        unsetCode();
      } else {
        setCode((java.lang.Integer)value);
      }
      break;

    case MESSAGE:
      if (value == null) {
        unsetMessage();
      } else {
        setMessage((java.lang.String)value);
      }
      break;

    case SUB_STATUS:
      if (value == null) {
        unsetSubStatus();
      } else {
        setSubStatus((java.util.List)value);
      }
      break;

    case REDIRECT_NODE:
      if (value == null) {
        unsetRedirectNode();
      } else {
        setRedirectNode((TEndPoint)value);
      }
      break;

    case NEED_RETRY:
      if (value == null) {
        unsetNeedRetry();
      } else {
        setNeedRetry((java.lang.Boolean)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case CODE:
      return getCode();

    case MESSAGE:
      return getMessage();

    case SUB_STATUS:
      return getSubStatus();

    case REDIRECT_NODE:
      return getRedirectNode();

    case NEED_RETRY:
      return isNeedRetry();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case CODE:
      return isSetCode();
    case MESSAGE:
      return isSetMessage();
    case SUB_STATUS:
      return isSetSubStatus();
    case REDIRECT_NODE:
      return isSetRedirectNode();
    case NEED_RETRY:
      return isSetNeedRetry();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TSStatus)
      return this.equals((TSStatus)that);
    return false;
  }

  public boolean equals(TSStatus that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_code = true;
    boolean that_present_code = true;
    if (this_present_code || that_present_code) {
      if (!(this_present_code && that_present_code))
        return false;
      if (this.code != that.code)
        return false;
    }

    boolean this_present_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message))
        return false;
      if (!this.message.equals(that.message))
        return false;
    }

    boolean this_present_subStatus = true && this.isSetSubStatus();
    boolean that_present_subStatus = true && that.isSetSubStatus();
    if (this_present_subStatus || that_present_subStatus) {
      if (!(this_present_subStatus && that_present_subStatus))
        return false;
      if (!this.subStatus.equals(that.subStatus))
        return false;
    }

    boolean this_present_redirectNode = true && this.isSetRedirectNode();
    boolean that_present_redirectNode = true && that.isSetRedirectNode();
    if (this_present_redirectNode || that_present_redirectNode) {
      if (!(this_present_redirectNode && that_present_redirectNode))
        return false;
      if (!this.redirectNode.equals(that.redirectNode))
        return false;
    }

    boolean this_present_needRetry = true && this.isSetNeedRetry();
    boolean that_present_needRetry = true && that.isSetNeedRetry();
    if (this_present_needRetry || that_present_needRetry) {
      if (!(this_present_needRetry && that_present_needRetry))
        return false;
      if (this.needRetry != that.needRetry)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + code;

    hashCode = hashCode * 8191 + ((isSetMessage()) ? 131071 : 524287);
    if (isSetMessage())
      hashCode = hashCode * 8191 + message.hashCode();

    hashCode = hashCode * 8191 + ((isSetSubStatus()) ? 131071 : 524287);
    if (isSetSubStatus())
      hashCode = hashCode * 8191 + subStatus.hashCode();

    hashCode = hashCode * 8191 + ((isSetRedirectNode()) ? 131071 : 524287);
    if (isSetRedirectNode())
      hashCode = hashCode * 8191 + redirectNode.hashCode();

    hashCode = hashCode * 8191 + ((isSetNeedRetry()) ? 131071 : 524287);
    if (isSetNeedRetry())
      hashCode = hashCode * 8191 + ((needRetry) ? 131071 : 524287);

    return hashCode;
  }

  @Override
  public int compareTo(TSStatus other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetCode(), other.isSetCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, other.code);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMessage(), other.isSetMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSubStatus(), other.isSetSubStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSubStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.subStatus, other.subStatus);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRedirectNode(), other.isSetRedirectNode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRedirectNode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.redirectNode, other.redirectNode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNeedRetry(), other.isSetNeedRetry());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNeedRetry()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.needRetry, other.needRetry);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TSStatus(");
    boolean first = true;

    sb.append("code:");
    sb.append(this.code);
    first = false;
    if (isSetMessage()) {
      if (!first) sb.append(", ");
      sb.append("message:");
      if (this.message == null) {
        sb.append("null");
      } else {
        sb.append(this.message);
      }
      first = false;
    }
    if (isSetSubStatus()) {
      if (!first) sb.append(", ");
      sb.append("subStatus:");
      if (this.subStatus == null) {
        sb.append("null");
      } else {
        sb.append(this.subStatus);
      }
      first = false;
    }
    if (isSetRedirectNode()) {
      if (!first) sb.append(", ");
      sb.append("redirectNode:");
      if (this.redirectNode == null) {
        sb.append("null");
      } else {
        sb.append(this.redirectNode);
      }
      first = false;
    }
    if (isSetNeedRetry()) {
      if (!first) sb.append(", ");
      sb.append("needRetry:");
      sb.append(this.needRetry);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'code' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
    if (redirectNode != null) {
      redirectNode.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TSStatusStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSStatusStandardScheme getScheme() {
      return new TSStatusStandardScheme();
    }
  }

  private static class TSStatusStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSStatus struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // CODE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.code = iprot.readI32();
              struct.setCodeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MESSAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.message = iprot.readString();
              struct.setMessageIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SUB_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.subStatus = new java.util.ArrayList(_list0.size);
                @org.apache.thrift.annotation.Nullable TSStatus _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = new TSStatus();
                  _elem1.read(iprot);
                  struct.subStatus.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setSubStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // REDIRECT_NODE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.redirectNode = new TEndPoint();
              struct.redirectNode.read(iprot);
              struct.setRedirectNodeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // NEED_RETRY
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.needRetry = iprot.readBool();
              struct.setNeedRetryIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetCode()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'code' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TSStatus struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(CODE_FIELD_DESC);
      oprot.writeI32(struct.code);
      oprot.writeFieldEnd();
      if (struct.message != null) {
        if (struct.isSetMessage()) {
          oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
          oprot.writeString(struct.message);
          oprot.writeFieldEnd();
        }
      }
      if (struct.subStatus != null) {
        if (struct.isSetSubStatus()) {
          oprot.writeFieldBegin(SUB_STATUS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.subStatus.size()));
            for (TSStatus _iter3 : struct.subStatus)
            {
              _iter3.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.redirectNode != null) {
        if (struct.isSetRedirectNode()) {
          oprot.writeFieldBegin(REDIRECT_NODE_FIELD_DESC);
          struct.redirectNode.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetNeedRetry()) {
        oprot.writeFieldBegin(NEED_RETRY_FIELD_DESC);
        oprot.writeBool(struct.needRetry);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TSStatusTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSStatusTupleScheme getScheme() {
      return new TSStatusTupleScheme();
    }
  }

  private static class TSStatusTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSStatus struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.code);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetMessage()) {
        optionals.set(0);
      }
      if (struct.isSetSubStatus()) {
        optionals.set(1);
      }
      if (struct.isSetRedirectNode()) {
        optionals.set(2);
      }
      if (struct.isSetNeedRetry()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetMessage()) {
        oprot.writeString(struct.message);
      }
      if (struct.isSetSubStatus()) {
        {
          oprot.writeI32(struct.subStatus.size());
          for (TSStatus _iter4 : struct.subStatus)
          {
            _iter4.write(oprot);
          }
        }
      }
      if (struct.isSetRedirectNode()) {
        struct.redirectNode.write(oprot);
      }
      if (struct.isSetNeedRetry()) {
        oprot.writeBool(struct.needRetry);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSStatus struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.code = iprot.readI32();
      struct.setCodeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.message = iprot.readString();
        struct.setMessageIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list5 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.subStatus = new java.util.ArrayList(_list5.size);
          @org.apache.thrift.annotation.Nullable TSStatus _elem6;
          for (int _i7 = 0; _i7 < _list5.size; ++_i7)
          {
            _elem6 = new TSStatus();
            _elem6.read(iprot);
            struct.subStatus.add(_elem6);
          }
        }
        struct.setSubStatusIsSet(true);
      }
      if (incoming.get(2)) {
        struct.redirectNode = new TEndPoint();
        struct.redirectNode.read(iprot);
        struct.setRedirectNodeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.needRetry = iprot.readBool();
        struct.setNeedRetryIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy