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

org.apache.iotdb.cluster.rpc.thrift.AddNodeResponse Maven / Gradle / Ivy

There is a newer version: 0.13.4
Show 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.cluster.rpc.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2022-07-31")
public class AddNodeResponse 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("AddNodeResponse");

  private static final org.apache.thrift.protocol.TField RESP_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("respNum", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField PARTITION_TABLE_BYTES_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionTableBytes", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField CHECK_STATUS_RESPONSE_FIELD_DESC = new org.apache.thrift.protocol.TField("checkStatusResponse", org.apache.thrift.protocol.TType.STRUCT, (short)3);

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

  public int respNum; // required
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer partitionTableBytes; // optional
  public @org.apache.thrift.annotation.Nullable CheckStatusResponse checkStatusResponse; // 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 {
    RESP_NUM((short)1, "respNum"),
    PARTITION_TABLE_BYTES((short)2, "partitionTableBytes"),
    CHECK_STATUS_RESPONSE((short)3, "checkStatusResponse");

    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: // RESP_NUM
          return RESP_NUM;
        case 2: // PARTITION_TABLE_BYTES
          return PARTITION_TABLE_BYTES;
        case 3: // CHECK_STATUS_RESPONSE
          return CHECK_STATUS_RESPONSE;
        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 __RESPNUM_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.PARTITION_TABLE_BYTES,_Fields.CHECK_STATUS_RESPONSE};
  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.RESP_NUM, new org.apache.thrift.meta_data.FieldMetaData("respNum", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "int")));
    tmpMap.put(_Fields.PARTITION_TABLE_BYTES, new org.apache.thrift.meta_data.FieldMetaData("partitionTableBytes", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.CHECK_STATUS_RESPONSE, new org.apache.thrift.meta_data.FieldMetaData("checkStatusResponse", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "CheckStatusResponse")));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AddNodeResponse.class, metaDataMap);
  }

  public AddNodeResponse() {
  }

  public AddNodeResponse(
    int respNum)
  {
    this();
    this.respNum = respNum;
    setRespNumIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public AddNodeResponse(AddNodeResponse other) {
    __isset_bitfield = other.__isset_bitfield;
    this.respNum = other.respNum;
    if (other.isSetPartitionTableBytes()) {
      this.partitionTableBytes = org.apache.thrift.TBaseHelper.copyBinary(other.partitionTableBytes);
    }
    if (other.isSetCheckStatusResponse()) {
      this.checkStatusResponse = new CheckStatusResponse(other.checkStatusResponse);
    }
  }

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

  @Override
  public void clear() {
    setRespNumIsSet(false);
    this.respNum = 0;
    this.partitionTableBytes = null;
    this.checkStatusResponse = null;
  }

  public int getRespNum() {
    return this.respNum;
  }

  public AddNodeResponse setRespNum(int respNum) {
    this.respNum = respNum;
    setRespNumIsSet(true);
    return this;
  }

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

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

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

  public byte[] getPartitionTableBytes() {
    setPartitionTableBytes(org.apache.thrift.TBaseHelper.rightSize(partitionTableBytes));
    return partitionTableBytes == null ? null : partitionTableBytes.array();
  }

  public java.nio.ByteBuffer bufferForPartitionTableBytes() {
    return org.apache.thrift.TBaseHelper.copyBinary(partitionTableBytes);
  }

  public AddNodeResponse setPartitionTableBytes(byte[] partitionTableBytes) {
    this.partitionTableBytes = partitionTableBytes == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(partitionTableBytes.clone());
    return this;
  }

  public AddNodeResponse setPartitionTableBytes(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer partitionTableBytes) {
    this.partitionTableBytes = org.apache.thrift.TBaseHelper.copyBinary(partitionTableBytes);
    return this;
  }

  public void unsetPartitionTableBytes() {
    this.partitionTableBytes = null;
  }

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

  public void setPartitionTableBytesIsSet(boolean value) {
    if (!value) {
      this.partitionTableBytes = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public CheckStatusResponse getCheckStatusResponse() {
    return this.checkStatusResponse;
  }

  public AddNodeResponse setCheckStatusResponse(@org.apache.thrift.annotation.Nullable CheckStatusResponse checkStatusResponse) {
    this.checkStatusResponse = checkStatusResponse;
    return this;
  }

  public void unsetCheckStatusResponse() {
    this.checkStatusResponse = null;
  }

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

  public void setCheckStatusResponseIsSet(boolean value) {
    if (!value) {
      this.checkStatusResponse = null;
    }
  }

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

    case PARTITION_TABLE_BYTES:
      if (value == null) {
        unsetPartitionTableBytes();
      } else {
        if (value instanceof byte[]) {
          setPartitionTableBytes((byte[])value);
        } else {
          setPartitionTableBytes((java.nio.ByteBuffer)value);
        }
      }
      break;

    case CHECK_STATUS_RESPONSE:
      if (value == null) {
        unsetCheckStatusResponse();
      } else {
        setCheckStatusResponse((CheckStatusResponse)value);
      }
      break;

    }
  }

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

    case PARTITION_TABLE_BYTES:
      return getPartitionTableBytes();

    case CHECK_STATUS_RESPONSE:
      return getCheckStatusResponse();

    }
    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 RESP_NUM:
      return isSetRespNum();
    case PARTITION_TABLE_BYTES:
      return isSetPartitionTableBytes();
    case CHECK_STATUS_RESPONSE:
      return isSetCheckStatusResponse();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_respNum = true;
    boolean that_present_respNum = true;
    if (this_present_respNum || that_present_respNum) {
      if (!(this_present_respNum && that_present_respNum))
        return false;
      if (this.respNum != that.respNum)
        return false;
    }

    boolean this_present_partitionTableBytes = true && this.isSetPartitionTableBytes();
    boolean that_present_partitionTableBytes = true && that.isSetPartitionTableBytes();
    if (this_present_partitionTableBytes || that_present_partitionTableBytes) {
      if (!(this_present_partitionTableBytes && that_present_partitionTableBytes))
        return false;
      if (!this.partitionTableBytes.equals(that.partitionTableBytes))
        return false;
    }

    boolean this_present_checkStatusResponse = true && this.isSetCheckStatusResponse();
    boolean that_present_checkStatusResponse = true && that.isSetCheckStatusResponse();
    if (this_present_checkStatusResponse || that_present_checkStatusResponse) {
      if (!(this_present_checkStatusResponse && that_present_checkStatusResponse))
        return false;
      if (!this.checkStatusResponse.equals(that.checkStatusResponse))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + respNum;

    hashCode = hashCode * 8191 + ((isSetPartitionTableBytes()) ? 131071 : 524287);
    if (isSetPartitionTableBytes())
      hashCode = hashCode * 8191 + partitionTableBytes.hashCode();

    hashCode = hashCode * 8191 + ((isSetCheckStatusResponse()) ? 131071 : 524287);
    if (isSetCheckStatusResponse())
      hashCode = hashCode * 8191 + checkStatusResponse.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetRespNum(), other.isSetRespNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRespNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.respNum, other.respNum);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPartitionTableBytes(), other.isSetPartitionTableBytes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartitionTableBytes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partitionTableBytes, other.partitionTableBytes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetCheckStatusResponse(), other.isSetCheckStatusResponse());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCheckStatusResponse()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.checkStatusResponse, other.checkStatusResponse);
      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("AddNodeResponse(");
    boolean first = true;

    sb.append("respNum:");
    sb.append(this.respNum);
    first = false;
    if (isSetPartitionTableBytes()) {
      if (!first) sb.append(", ");
      sb.append("partitionTableBytes:");
      if (this.partitionTableBytes == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.partitionTableBytes, sb);
      }
      first = false;
    }
    if (isSetCheckStatusResponse()) {
      if (!first) sb.append(", ");
      sb.append("checkStatusResponse:");
      if (this.checkStatusResponse == null) {
        sb.append("null");
      } else {
        sb.append(this.checkStatusResponse);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

  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 AddNodeResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public AddNodeResponseStandardScheme getScheme() {
      return new AddNodeResponseStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, AddNodeResponse 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: // RESP_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.respNum = iprot.readI32();
              struct.setRespNumIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PARTITION_TABLE_BYTES
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.partitionTableBytes = iprot.readBinary();
              struct.setPartitionTableBytesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CHECK_STATUS_RESPONSE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.checkStatusResponse = new CheckStatusResponse();
              struct.checkStatusResponse.read(iprot);
              struct.setCheckStatusResponseIsSet(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.isSetRespNum()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'respNum' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(RESP_NUM_FIELD_DESC);
      oprot.writeI32(struct.respNum);
      oprot.writeFieldEnd();
      if (struct.partitionTableBytes != null) {
        if (struct.isSetPartitionTableBytes()) {
          oprot.writeFieldBegin(PARTITION_TABLE_BYTES_FIELD_DESC);
          oprot.writeBinary(struct.partitionTableBytes);
          oprot.writeFieldEnd();
        }
      }
      if (struct.checkStatusResponse != null) {
        if (struct.isSetCheckStatusResponse()) {
          oprot.writeFieldBegin(CHECK_STATUS_RESPONSE_FIELD_DESC);
          struct.checkStatusResponse.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, AddNodeResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.respNum);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetPartitionTableBytes()) {
        optionals.set(0);
      }
      if (struct.isSetCheckStatusResponse()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetPartitionTableBytes()) {
        oprot.writeBinary(struct.partitionTableBytes);
      }
      if (struct.isSetCheckStatusResponse()) {
        struct.checkStatusResponse.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, AddNodeResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.respNum = iprot.readI32();
      struct.setRespNumIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.partitionTableBytes = iprot.readBinary();
        struct.setPartitionTableBytesIsSet(true);
      }
      if (incoming.get(1)) {
        struct.checkStatusResponse = new CheckStatusResponse();
        struct.checkStatusResponse.read(iprot);
        struct.setCheckStatusResponseIsSet(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 - 2025 Weber Informatics LLC | Privacy Policy