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

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

  private static final org.apache.thrift.protocol.TField DATABASE_FIELD_DESC = new org.apache.thrift.protocol.TField("database", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField SPACE_LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("spaceLimit", org.apache.thrift.protocol.TType.STRUCT, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.util.List database; // required
  public @org.apache.thrift.annotation.Nullable TSpaceQuota spaceLimit; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    DATABASE((short)1, "database"),
    SPACE_LIMIT((short)2, "spaceLimit");

    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: // DATABASE
          return DATABASE;
        case 2: // SPACE_LIMIT
          return SPACE_LIMIT;
        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
  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.DATABASE, new org.apache.thrift.meta_data.FieldMetaData("database", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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))));
    tmpMap.put(_Fields.SPACE_LIMIT, new org.apache.thrift.meta_data.FieldMetaData("spaceLimit", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSpaceQuota.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSetSpaceQuotaReq.class, metaDataMap);
  }

  public TSetSpaceQuotaReq() {
  }

  public TSetSpaceQuotaReq(
    java.util.List database,
    TSpaceQuota spaceLimit)
  {
    this();
    this.database = database;
    this.spaceLimit = spaceLimit;
  }

  /**
   * Performs a deep copy on other.
   */
  public TSetSpaceQuotaReq(TSetSpaceQuotaReq other) {
    if (other.isSetDatabase()) {
      java.util.List __this__database = new java.util.ArrayList(other.database);
      this.database = __this__database;
    }
    if (other.isSetSpaceLimit()) {
      this.spaceLimit = new TSpaceQuota(other.spaceLimit);
    }
  }

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

  @Override
  public void clear() {
    this.database = null;
    this.spaceLimit = null;
  }

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

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

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

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

  public TSetSpaceQuotaReq setDatabase(@org.apache.thrift.annotation.Nullable java.util.List database) {
    this.database = database;
    return this;
  }

  public void unsetDatabase() {
    this.database = null;
  }

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

  public void setDatabaseIsSet(boolean value) {
    if (!value) {
      this.database = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TSpaceQuota getSpaceLimit() {
    return this.spaceLimit;
  }

  public TSetSpaceQuotaReq setSpaceLimit(@org.apache.thrift.annotation.Nullable TSpaceQuota spaceLimit) {
    this.spaceLimit = spaceLimit;
    return this;
  }

  public void unsetSpaceLimit() {
    this.spaceLimit = null;
  }

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

  public void setSpaceLimitIsSet(boolean value) {
    if (!value) {
      this.spaceLimit = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case DATABASE:
      if (value == null) {
        unsetDatabase();
      } else {
        setDatabase((java.util.List)value);
      }
      break;

    case SPACE_LIMIT:
      if (value == null) {
        unsetSpaceLimit();
      } else {
        setSpaceLimit((TSpaceQuota)value);
      }
      break;

    }
  }

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

    case SPACE_LIMIT:
      return getSpaceLimit();

    }
    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 DATABASE:
      return isSetDatabase();
    case SPACE_LIMIT:
      return isSetSpaceLimit();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_database = true && this.isSetDatabase();
    boolean that_present_database = true && that.isSetDatabase();
    if (this_present_database || that_present_database) {
      if (!(this_present_database && that_present_database))
        return false;
      if (!this.database.equals(that.database))
        return false;
    }

    boolean this_present_spaceLimit = true && this.isSetSpaceLimit();
    boolean that_present_spaceLimit = true && that.isSetSpaceLimit();
    if (this_present_spaceLimit || that_present_spaceLimit) {
      if (!(this_present_spaceLimit && that_present_spaceLimit))
        return false;
      if (!this.spaceLimit.equals(that.spaceLimit))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetDatabase()) ? 131071 : 524287);
    if (isSetDatabase())
      hashCode = hashCode * 8191 + database.hashCode();

    hashCode = hashCode * 8191 + ((isSetSpaceLimit()) ? 131071 : 524287);
    if (isSetSpaceLimit())
      hashCode = hashCode * 8191 + spaceLimit.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetDatabase(), other.isSetDatabase());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDatabase()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.database, other.database);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSpaceLimit(), other.isSetSpaceLimit());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpaceLimit()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spaceLimit, other.spaceLimit);
      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("TSetSpaceQuotaReq(");
    boolean first = true;

    sb.append("database:");
    if (this.database == null) {
      sb.append("null");
    } else {
      sb.append(this.database);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("spaceLimit:");
    if (this.spaceLimit == null) {
      sb.append("null");
    } else {
      sb.append(this.spaceLimit);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (database == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'database' was not present! Struct: " + toString());
    }
    if (spaceLimit == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'spaceLimit' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (spaceLimit != null) {
      spaceLimit.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 {
      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 TSetSpaceQuotaReqStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSetSpaceQuotaReqStandardScheme getScheme() {
      return new TSetSpaceQuotaReqStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSetSpaceQuotaReq 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: // DATABASE
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list76 = iprot.readListBegin();
                struct.database = new java.util.ArrayList(_list76.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem77;
                for (int _i78 = 0; _i78 < _list76.size; ++_i78)
                {
                  _elem77 = iprot.readString();
                  struct.database.add(_elem77);
                }
                iprot.readListEnd();
              }
              struct.setDatabaseIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SPACE_LIMIT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.spaceLimit = new TSpaceQuota();
              struct.spaceLimit.read(iprot);
              struct.setSpaceLimitIsSet(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, TSetSpaceQuotaReq struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.database != null) {
        oprot.writeFieldBegin(DATABASE_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.database.size()));
          for (java.lang.String _iter79 : struct.database)
          {
            oprot.writeString(_iter79);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.spaceLimit != null) {
        oprot.writeFieldBegin(SPACE_LIMIT_FIELD_DESC);
        struct.spaceLimit.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSetSpaceQuotaReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.database.size());
        for (java.lang.String _iter80 : struct.database)
        {
          oprot.writeString(_iter80);
        }
      }
      struct.spaceLimit.write(oprot);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSetSpaceQuotaReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list81 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
        struct.database = new java.util.ArrayList(_list81.size);
        @org.apache.thrift.annotation.Nullable java.lang.String _elem82;
        for (int _i83 = 0; _i83 < _list81.size; ++_i83)
        {
          _elem82 = iprot.readString();
          struct.database.add(_elem82);
        }
      }
      struct.setDatabaseIsSet(true);
      struct.spaceLimit = new TSpaceQuota();
      struct.spaceLimit.read(iprot);
      struct.setSpaceLimitIsSet(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