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

org.apache.iotdb.common.rpc.thrift.TFlushReq 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 TFlushReq 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("TFlushReq");

  private static final org.apache.thrift.protocol.TField IS_SEQ_FIELD_DESC = new org.apache.thrift.protocol.TField("isSeq", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField STORAGE_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("storageGroups", org.apache.thrift.protocol.TType.LIST, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String isSeq; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List storageGroups; // 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 {
    IS_SEQ((short)1, "isSeq"),
    STORAGE_GROUPS((short)2, "storageGroups");

    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: // IS_SEQ
          return IS_SEQ;
        case 2: // STORAGE_GROUPS
          return STORAGE_GROUPS;
        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 _Fields optionals[] = {_Fields.IS_SEQ,_Fields.STORAGE_GROUPS};
  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.IS_SEQ, new org.apache.thrift.meta_data.FieldMetaData("isSeq", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.STORAGE_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("storageGroups", 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.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TFlushReq.class, metaDataMap);
  }

  public TFlushReq() {
  }

  /**
   * Performs a deep copy on other.
   */
  public TFlushReq(TFlushReq other) {
    if (other.isSetIsSeq()) {
      this.isSeq = other.isSeq;
    }
    if (other.isSetStorageGroups()) {
      java.util.List __this__storageGroups = new java.util.ArrayList(other.storageGroups);
      this.storageGroups = __this__storageGroups;
    }
  }

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

  @Override
  public void clear() {
    this.isSeq = null;
    this.storageGroups = null;
  }

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

  public TFlushReq setIsSeq(@org.apache.thrift.annotation.Nullable java.lang.String isSeq) {
    this.isSeq = isSeq;
    return this;
  }

  public void unsetIsSeq() {
    this.isSeq = null;
  }

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

  public void setIsSeqIsSet(boolean value) {
    if (!value) {
      this.isSeq = null;
    }
  }

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

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

  public void addToStorageGroups(java.lang.String elem) {
    if (this.storageGroups == null) {
      this.storageGroups = new java.util.ArrayList();
    }
    this.storageGroups.add(elem);
  }

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

  public TFlushReq setStorageGroups(@org.apache.thrift.annotation.Nullable java.util.List storageGroups) {
    this.storageGroups = storageGroups;
    return this;
  }

  public void unsetStorageGroups() {
    this.storageGroups = null;
  }

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

  public void setStorageGroupsIsSet(boolean value) {
    if (!value) {
      this.storageGroups = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case IS_SEQ:
      if (value == null) {
        unsetIsSeq();
      } else {
        setIsSeq((java.lang.String)value);
      }
      break;

    case STORAGE_GROUPS:
      if (value == null) {
        unsetStorageGroups();
      } else {
        setStorageGroups((java.util.List)value);
      }
      break;

    }
  }

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

    case STORAGE_GROUPS:
      return getStorageGroups();

    }
    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 IS_SEQ:
      return isSetIsSeq();
    case STORAGE_GROUPS:
      return isSetStorageGroups();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_isSeq = true && this.isSetIsSeq();
    boolean that_present_isSeq = true && that.isSetIsSeq();
    if (this_present_isSeq || that_present_isSeq) {
      if (!(this_present_isSeq && that_present_isSeq))
        return false;
      if (!this.isSeq.equals(that.isSeq))
        return false;
    }

    boolean this_present_storageGroups = true && this.isSetStorageGroups();
    boolean that_present_storageGroups = true && that.isSetStorageGroups();
    if (this_present_storageGroups || that_present_storageGroups) {
      if (!(this_present_storageGroups && that_present_storageGroups))
        return false;
      if (!this.storageGroups.equals(that.storageGroups))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetIsSeq()) ? 131071 : 524287);
    if (isSetIsSeq())
      hashCode = hashCode * 8191 + isSeq.hashCode();

    hashCode = hashCode * 8191 + ((isSetStorageGroups()) ? 131071 : 524287);
    if (isSetStorageGroups())
      hashCode = hashCode * 8191 + storageGroups.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetIsSeq(), other.isSetIsSeq());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsSeq()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isSeq, other.isSeq);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStorageGroups(), other.isSetStorageGroups());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStorageGroups()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storageGroups, other.storageGroups);
      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("TFlushReq(");
    boolean first = true;

    if (isSetIsSeq()) {
      sb.append("isSeq:");
      if (this.isSeq == null) {
        sb.append("null");
      } else {
        sb.append(this.isSeq);
      }
      first = false;
    }
    if (isSetStorageGroups()) {
      if (!first) sb.append(", ");
      sb.append("storageGroups:");
      if (this.storageGroups == null) {
        sb.append("null");
      } else {
        sb.append(this.storageGroups);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // 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 {
      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 TFlushReqStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TFlushReqStandardScheme getScheme() {
      return new TFlushReqStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, TFlushReq 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: // IS_SEQ
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.isSeq = iprot.readString();
              struct.setIsSeqIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STORAGE_GROUPS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
                struct.storageGroups = new java.util.ArrayList(_list16.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem17;
                for (int _i18 = 0; _i18 < _list16.size; ++_i18)
                {
                  _elem17 = iprot.readString();
                  struct.storageGroups.add(_elem17);
                }
                iprot.readListEnd();
              }
              struct.setStorageGroupsIsSet(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
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSeq != null) {
        if (struct.isSetIsSeq()) {
          oprot.writeFieldBegin(IS_SEQ_FIELD_DESC);
          oprot.writeString(struct.isSeq);
          oprot.writeFieldEnd();
        }
      }
      if (struct.storageGroups != null) {
        if (struct.isSetStorageGroups()) {
          oprot.writeFieldBegin(STORAGE_GROUPS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.storageGroups.size()));
            for (java.lang.String _iter19 : struct.storageGroups)
            {
              oprot.writeString(_iter19);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TFlushReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetIsSeq()) {
        optionals.set(0);
      }
      if (struct.isSetStorageGroups()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetIsSeq()) {
        oprot.writeString(struct.isSeq);
      }
      if (struct.isSetStorageGroups()) {
        {
          oprot.writeI32(struct.storageGroups.size());
          for (java.lang.String _iter20 : struct.storageGroups)
          {
            oprot.writeString(_iter20);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TFlushReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.isSeq = iprot.readString();
        struct.setIsSeqIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list21 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
          struct.storageGroups = new java.util.ArrayList(_list21.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _elem22;
          for (int _i23 = 0; _i23 < _list21.size; ++_i23)
          {
            _elem22 = iprot.readString();
            struct.storageGroups.add(_elem22);
          }
        }
        struct.setStorageGroupsIsSet(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