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

scray.service.qmodel.thriftjava.ScrayTTableInfo Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package scray.service.qmodel.thriftjava;

import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;

// No additional import required for struct/union.

public class ScrayTTableInfo implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ScrayTTableInfo");

  private static final TField DB_SYSTEM_FIELD_DESC = new TField("dbSystem", TType.STRING, (short)1);
  private static final TField DB_ID_FIELD_DESC = new TField("dbId", TType.STRING, (short)2);
  private static final TField TABLE_ID_FIELD_DESC = new TField("tableId", TType.STRING, (short)3);
  private static final TField KEY_T_FIELD_DESC = new TField("keyT", TType.STRING, (short)4);


  public String dbSystem;
  public String dbId;
  public String tableId;
  public String keyT;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    DB_SYSTEM((short)1, "dbSystem"),
    DB_ID((short)2, "dbId"),
    TABLE_ID((short)3, "tableId"),
    KEY_T((short)4, "keyT");
  
    private static final Map byName = new HashMap();
  
    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }
  
    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // DB_SYSTEM
          return DB_SYSTEM;
        case 2: // DB_ID
          return DB_ID;
        case 3: // TABLE_ID
          return TABLE_ID;
        case 4: // KEY_T
          return KEY_T;
        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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }
  
    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }
  
    private final short _thriftId;
    private final String _fieldName;
  
    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }
  
    public short getThriftFieldId() {
      return _thriftId;
    }
  
    public String getFieldName() {
      return _fieldName;
    }
  }


  // isset id assignments

  public static final Map<_Fields, FieldMetaData> metaDataMap;
  static {
    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.DB_SYSTEM, new FieldMetaData("dbSystem", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.DB_ID, new FieldMetaData("dbId", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.TABLE_ID, new FieldMetaData("tableId", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.KEY_T, new FieldMetaData("keyT", TFieldRequirementType.OPTIONAL,
      new FieldValueMetaData(TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(ScrayTTableInfo.class, metaDataMap);
  }


  public ScrayTTableInfo() {
  }

  public ScrayTTableInfo(
    String dbSystem,
    String dbId,
    String tableId)
  {
    this();
    this.dbSystem = dbSystem;
    this.dbId = dbId;
    this.tableId = tableId;
  }

  /**
   * Performs a deep copy on other.
   */
  public ScrayTTableInfo(ScrayTTableInfo other) {
    if (other.isSetDbSystem()) {
      this.dbSystem = other.dbSystem;
    }
    if (other.isSetDbId()) {
      this.dbId = other.dbId;
    }
    if (other.isSetTableId()) {
      this.tableId = other.tableId;
    }
    if (other.isSetKeyT()) {
      this.keyT = other.keyT;
    }
  }

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

  @java.lang.Override
  public void clear() {
    this.dbSystem = null;
    this.dbId = null;
    this.tableId = null;
    this.keyT = null;
  }

  public String getDbSystem() {
    return this.dbSystem;
  }

  public ScrayTTableInfo setDbSystem(String dbSystem) {
    this.dbSystem = dbSystem;
    
    return this;
  }

  public void unsetDbSystem() {
    this.dbSystem = null;
  }

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

  public void setDbSystemIsSet(boolean value) {
    if (!value) {
      this.dbSystem = null;
    }
  }

  public String getDbId() {
    return this.dbId;
  }

  public ScrayTTableInfo setDbId(String dbId) {
    this.dbId = dbId;
    
    return this;
  }

  public void unsetDbId() {
    this.dbId = null;
  }

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

  public void setDbIdIsSet(boolean value) {
    if (!value) {
      this.dbId = null;
    }
  }

  public String getTableId() {
    return this.tableId;
  }

  public ScrayTTableInfo setTableId(String tableId) {
    this.tableId = tableId;
    
    return this;
  }

  public void unsetTableId() {
    this.tableId = null;
  }

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

  public void setTableIdIsSet(boolean value) {
    if (!value) {
      this.tableId = null;
    }
  }

  public String getKeyT() {
    return this.keyT;
  }

  public ScrayTTableInfo setKeyT(String keyT) {
    this.keyT = keyT;
    
    return this;
  }

  public void unsetKeyT() {
    this.keyT = null;
  }

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

  public void setKeyTIsSet(boolean value) {
    if (!value) {
      this.keyT = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case DB_SYSTEM:
      if (value == null) {
        unsetDbSystem();
      } else {
        setDbSystem((String)value);
      }
      break;
    case DB_ID:
      if (value == null) {
        unsetDbId();
      } else {
        setDbId((String)value);
      }
      break;
    case TABLE_ID:
      if (value == null) {
        unsetTableId();
      } else {
        setTableId((String)value);
      }
      break;
    case KEY_T:
      if (value == null) {
        unsetKeyT();
      } else {
        setKeyT((String)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case DB_SYSTEM:
      return getDbSystem();
    case DB_ID:
      return getDbId();
    case TABLE_ID:
      return getTableId();
    case KEY_T:
      return getKeyT();
    }
    throw new IllegalStateException();
  }

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

    switch (field) {
    case DB_SYSTEM:
      return isSetDbSystem();
    case DB_ID:
      return isSetDbId();
    case TABLE_ID:
      return isSetTableId();
    case KEY_T:
      return isSetKeyT();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(ScrayTTableInfo that) {
    if (that == null)
      return false;
    boolean this_present_dbSystem = true && this.isSetDbSystem();
    boolean that_present_dbSystem = true && that.isSetDbSystem();
    if (this_present_dbSystem || that_present_dbSystem) {
      if (!(this_present_dbSystem && that_present_dbSystem))
        return false;
      if (!this.dbSystem.equals(that.dbSystem))
        return false;
    }
    boolean this_present_dbId = true && this.isSetDbId();
    boolean that_present_dbId = true && that.isSetDbId();
    if (this_present_dbId || that_present_dbId) {
      if (!(this_present_dbId && that_present_dbId))
        return false;
      if (!this.dbId.equals(that.dbId))
        return false;
    }
    boolean this_present_tableId = true && this.isSetTableId();
    boolean that_present_tableId = true && that.isSetTableId();
    if (this_present_tableId || that_present_tableId) {
      if (!(this_present_tableId && that_present_tableId))
        return false;
      if (!this.tableId.equals(that.tableId))
        return false;
    }
    boolean this_present_keyT = true && this.isSetKeyT();
    boolean that_present_keyT = true && that.isSetKeyT();
    if (this_present_keyT || that_present_keyT) {
      if (!(this_present_keyT && that_present_keyT))
        return false;
      if (!this.keyT.equals(that.keyT))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_dbSystem = true && (isSetDbSystem());
    builder.append(present_dbSystem);
    if (present_dbSystem)
      builder.append(dbSystem);
    boolean present_dbId = true && (isSetDbId());
    builder.append(present_dbId);
    if (present_dbId)
      builder.append(dbId);
    boolean present_tableId = true && (isSetTableId());
    builder.append(present_tableId);
    if (present_tableId)
      builder.append(tableId);
    boolean present_keyT = true && (isSetKeyT());
    builder.append(present_keyT);
    if (present_keyT)
      builder.append(keyT);
    return builder.toHashCode();
  }

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

    int lastComparison = 0;
    ScrayTTableInfo typedOther = (ScrayTTableInfo)other;

    lastComparison = Boolean.valueOf(isSetDbSystem()).compareTo(typedOther.isSetDbSystem());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbSystem()) {
      lastComparison = TBaseHelper.compareTo(this.dbSystem, typedOther.dbSystem);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDbId()).compareTo(typedOther.isSetDbId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDbId()) {
      lastComparison = TBaseHelper.compareTo(this.dbId, typedOther.dbId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTableId()).compareTo(typedOther.isSetTableId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTableId()) {
      lastComparison = TBaseHelper.compareTo(this.tableId, typedOther.tableId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetKeyT()).compareTo(typedOther.isSetKeyT());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKeyT()) {
      lastComparison = TBaseHelper.compareTo(this.keyT, typedOther.keyT);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }


  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // DB_SYSTEM
          if (field.type == TType.STRING) {
            this.dbSystem = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // DB_ID
          if (field.type == TType.STRING) {
            this.dbId = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TABLE_ID
          if (field.type == TType.STRING) {
            this.tableId = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // KEY_T
          if (field.type == TType.STRING) {
            this.keyT = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.dbSystem != null) {
      oprot.writeFieldBegin(DB_SYSTEM_FIELD_DESC);
      oprot.writeString(this.dbSystem);
      oprot.writeFieldEnd();
    }
    if (this.dbId != null) {
      oprot.writeFieldBegin(DB_ID_FIELD_DESC);
      oprot.writeString(this.dbId);
      oprot.writeFieldEnd();
    }
    if (this.tableId != null) {
      oprot.writeFieldBegin(TABLE_ID_FIELD_DESC);
      oprot.writeString(this.tableId);
      oprot.writeFieldEnd();
    }
    if (this.keyT != null) {
      if (isSetKeyT()) {
        oprot.writeFieldBegin(KEY_T_FIELD_DESC);
        oprot.writeString(this.keyT);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ScrayTTableInfo(");
    boolean first = true;
    sb.append("dbSystem:");
    if (this.dbSystem == null) {
      sb.append("null");
    } else {
      sb.append(this.dbSystem);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("dbId:");
    if (this.dbId == null) {
      sb.append("null");
    } else {
      sb.append(this.dbId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("tableId:");
    if (this.tableId == null) {
      sb.append("null");
    } else {
      sb.append(this.tableId);
    }
    first = false;
    if (isSetKeyT()) {
      if (!first) sb.append(", ");
      sb.append("keyT:");
      if (this.keyT == null) {
        sb.append("null");
      } else {
        sb.append(this.keyT);
      }
      first = false;
      }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy