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

scray.service.qmodel.thriftjava.ScrayTQueryInfo 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 ScrayTQueryInfo implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ScrayTQueryInfo");

  private static final TField QUERY_ID_FIELD_DESC = new TField("queryId", TType.STRUCT, (short)1);
  private static final TField QUERY_SPACE_FIELD_DESC = new TField("querySpace", TType.STRING, (short)2);
  private static final TField TABLE_INFO_FIELD_DESC = new TField("tableInfo", TType.STRUCT, (short)3);
  private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)4);
  private static final TField PAGESIZE_FIELD_DESC = new TField("pagesize", TType.I32, (short)5);
  private static final TField EXPIRES_FIELD_DESC = new TField("expires", TType.I64, (short)6);


  public ScrayUUID queryId;
  public String querySpace;
  public ScrayTTableInfo tableInfo;
  public List columns;
  public int pagesize;
  public long expires;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    QUERY_ID((short)1, "queryId"),
    QUERY_SPACE((short)2, "querySpace"),
    TABLE_INFO((short)3, "tableInfo"),
    COLUMNS((short)4, "columns"),
    PAGESIZE((short)5, "pagesize"),
    EXPIRES((short)6, "expires");
  
    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: // QUERY_ID
          return QUERY_ID;
        case 2: // QUERY_SPACE
          return QUERY_SPACE;
        case 3: // TABLE_INFO
          return TABLE_INFO;
        case 4: // COLUMNS
          return COLUMNS;
        case 5: // PAGESIZE
          return PAGESIZE;
        case 6: // EXPIRES
          return EXPIRES;
        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
  private static final int __PAGESIZE_ISSET_ID = 0;
  private static final int __EXPIRES_ISSET_ID = 1;
  private BitSet __isset_bit_vector = new BitSet(2);

  public static final Map<_Fields, FieldMetaData> metaDataMap;
  static {
    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUERY_ID, new FieldMetaData("queryId", TFieldRequirementType.OPTIONAL,
      new StructMetaData(TType.STRUCT, ScrayUUID.class)));
    tmpMap.put(_Fields.QUERY_SPACE, new FieldMetaData("querySpace", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.TABLE_INFO, new FieldMetaData("tableInfo", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, ScrayTTableInfo.class)));
    tmpMap.put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
      new ListMetaData(TType.LIST,
                new StructMetaData(TType.STRUCT, ScrayTColumnInfo.class))));
    tmpMap.put(_Fields.PAGESIZE, new FieldMetaData("pagesize", TFieldRequirementType.OPTIONAL,
      new FieldValueMetaData(TType.I32)));
    tmpMap.put(_Fields.EXPIRES, new FieldMetaData("expires", TFieldRequirementType.OPTIONAL,
      new FieldValueMetaData(TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(ScrayTQueryInfo.class, metaDataMap);
  }


  public ScrayTQueryInfo() {
  }

  public ScrayTQueryInfo(
    String querySpace,
    ScrayTTableInfo tableInfo,
    List columns)
  {
    this();
    this.querySpace = querySpace;
    this.tableInfo = tableInfo;
    this.columns = columns;
  }

  /**
   * Performs a deep copy on other.
   */
  public ScrayTQueryInfo(ScrayTQueryInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetQueryId()) {
      this.queryId = new ScrayUUID(other.queryId);
    }
    if (other.isSetQuerySpace()) {
      this.querySpace = other.querySpace;
    }
    if (other.isSetTableInfo()) {
      this.tableInfo = new ScrayTTableInfo(other.tableInfo);
    }
    if (other.isSetColumns()) {
      List __this__columns = new ArrayList();
      for (ScrayTColumnInfo other_element : other.columns) {
        __this__columns.add(new ScrayTColumnInfo(other_element));
      }
      this.columns = __this__columns;
    }
    this.pagesize = other.pagesize;
    this.expires = other.expires;
  }

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

  @java.lang.Override
  public void clear() {
    this.queryId = null;
    this.querySpace = null;
    this.tableInfo = null;
    this.columns = null;
    setPagesizeIsSet(false);
    this.pagesize = 0;
    setExpiresIsSet(false);
    this.expires = 0;
  }

  public ScrayUUID getQueryId() {
    return this.queryId;
  }

  public ScrayTQueryInfo setQueryId(ScrayUUID queryId) {
    this.queryId = queryId;
    
    return this;
  }

  public void unsetQueryId() {
    this.queryId = null;
  }

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

  public void setQueryIdIsSet(boolean value) {
    if (!value) {
      this.queryId = null;
    }
  }

  public String getQuerySpace() {
    return this.querySpace;
  }

  public ScrayTQueryInfo setQuerySpace(String querySpace) {
    this.querySpace = querySpace;
    
    return this;
  }

  public void unsetQuerySpace() {
    this.querySpace = null;
  }

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

  public void setQuerySpaceIsSet(boolean value) {
    if (!value) {
      this.querySpace = null;
    }
  }

  public ScrayTTableInfo getTableInfo() {
    return this.tableInfo;
  }

  public ScrayTQueryInfo setTableInfo(ScrayTTableInfo tableInfo) {
    this.tableInfo = tableInfo;
    
    return this;
  }

  public void unsetTableInfo() {
    this.tableInfo = null;
  }

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

  public void setTableInfoIsSet(boolean value) {
    if (!value) {
      this.tableInfo = null;
    }
  }

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

  public java.util.Iterator getColumnsIterator() {
    return (this.columns == null) ? null : this.columns.iterator();
  }

  public void addToColumns(ScrayTColumnInfo elem) {
    if (this.columns == null) {
      this.columns = new ArrayList();
    }
    this.columns.add(elem);
  }

  public List getColumns() {
    return this.columns;
  }

  public ScrayTQueryInfo setColumns(List columns) {
    this.columns = columns;
    
    return this;
  }

  public void unsetColumns() {
    this.columns = null;
  }

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

  public void setColumnsIsSet(boolean value) {
    if (!value) {
      this.columns = null;
    }
  }

  public int getPagesize() {
    return this.pagesize;
  }

  public ScrayTQueryInfo setPagesize(int pagesize) {
    this.pagesize = pagesize;
    setPagesizeIsSet(true);

    return this;
  }

  public void unsetPagesize() {
  __isset_bit_vector.clear(__PAGESIZE_ISSET_ID);
  }

  /** Returns true if field pagesize is set (has been asigned a value) and false otherwise */
  public boolean isSetPagesize() {
    return __isset_bit_vector.get(__PAGESIZE_ISSET_ID);
  }

  public void setPagesizeIsSet(boolean value) {
    __isset_bit_vector.set(__PAGESIZE_ISSET_ID, value);
  }

  public long getExpires() {
    return this.expires;
  }

  public ScrayTQueryInfo setExpires(long expires) {
    this.expires = expires;
    setExpiresIsSet(true);

    return this;
  }

  public void unsetExpires() {
  __isset_bit_vector.clear(__EXPIRES_ISSET_ID);
  }

  /** Returns true if field expires is set (has been asigned a value) and false otherwise */
  public boolean isSetExpires() {
    return __isset_bit_vector.get(__EXPIRES_ISSET_ID);
  }

  public void setExpiresIsSet(boolean value) {
    __isset_bit_vector.set(__EXPIRES_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((ScrayUUID)value);
      }
      break;
    case QUERY_SPACE:
      if (value == null) {
        unsetQuerySpace();
      } else {
        setQuerySpace((String)value);
      }
      break;
    case TABLE_INFO:
      if (value == null) {
        unsetTableInfo();
      } else {
        setTableInfo((ScrayTTableInfo)value);
      }
      break;
    case COLUMNS:
      if (value == null) {
        unsetColumns();
      } else {
        setColumns((List)value);
      }
      break;
    case PAGESIZE:
      if (value == null) {
        unsetPagesize();
      } else {
        setPagesize((Integer)value);
      }
      break;
    case EXPIRES:
      if (value == null) {
        unsetExpires();
      } else {
        setExpires((Long)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY_ID:
      return getQueryId();
    case QUERY_SPACE:
      return getQuerySpace();
    case TABLE_INFO:
      return getTableInfo();
    case COLUMNS:
      return getColumns();
    case PAGESIZE:
      return new Integer(getPagesize());
    case EXPIRES:
      return new Long(getExpires());
    }
    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 QUERY_ID:
      return isSetQueryId();
    case QUERY_SPACE:
      return isSetQuerySpace();
    case TABLE_INFO:
      return isSetTableInfo();
    case COLUMNS:
      return isSetColumns();
    case PAGESIZE:
      return isSetPagesize();
    case EXPIRES:
      return isSetExpires();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(ScrayTQueryInfo that) {
    if (that == null)
      return false;
    boolean this_present_queryId = true && this.isSetQueryId();
    boolean that_present_queryId = true && that.isSetQueryId();
    if (this_present_queryId || that_present_queryId) {
      if (!(this_present_queryId && that_present_queryId))
        return false;
      if (!this.queryId.equals(that.queryId))
        return false;
    }
    boolean this_present_querySpace = true && this.isSetQuerySpace();
    boolean that_present_querySpace = true && that.isSetQuerySpace();
    if (this_present_querySpace || that_present_querySpace) {
      if (!(this_present_querySpace && that_present_querySpace))
        return false;
      if (!this.querySpace.equals(that.querySpace))
        return false;
    }
    boolean this_present_tableInfo = true && this.isSetTableInfo();
    boolean that_present_tableInfo = true && that.isSetTableInfo();
    if (this_present_tableInfo || that_present_tableInfo) {
      if (!(this_present_tableInfo && that_present_tableInfo))
        return false;
      if (!this.tableInfo.equals(that.tableInfo))
        return false;
    }
    boolean this_present_columns = true && this.isSetColumns();
    boolean that_present_columns = true && that.isSetColumns();
    if (this_present_columns || that_present_columns) {
      if (!(this_present_columns && that_present_columns))
        return false;
      if (!this.columns.equals(that.columns))
        return false;
    }
    boolean this_present_pagesize = true && this.isSetPagesize();
    boolean that_present_pagesize = true && that.isSetPagesize();
    if (this_present_pagesize || that_present_pagesize) {
      if (!(this_present_pagesize && that_present_pagesize))
        return false;
      if (this.pagesize != that.pagesize)
        return false;
    }
    boolean this_present_expires = true && this.isSetExpires();
    boolean that_present_expires = true && that.isSetExpires();
    if (this_present_expires || that_present_expires) {
      if (!(this_present_expires && that_present_expires))
        return false;
      if (this.expires != that.expires)
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_queryId = true && (isSetQueryId());
    builder.append(present_queryId);
    if (present_queryId)
      builder.append(queryId);
    boolean present_querySpace = true && (isSetQuerySpace());
    builder.append(present_querySpace);
    if (present_querySpace)
      builder.append(querySpace);
    boolean present_tableInfo = true && (isSetTableInfo());
    builder.append(present_tableInfo);
    if (present_tableInfo)
      builder.append(tableInfo);
    boolean present_columns = true && (isSetColumns());
    builder.append(present_columns);
    if (present_columns)
      builder.append(columns);
    boolean present_pagesize = true && (isSetPagesize());
    builder.append(present_pagesize);
    if (present_pagesize)
      builder.append(pagesize);
    boolean present_expires = true && (isSetExpires());
    builder.append(present_expires);
    if (present_expires)
      builder.append(expires);
    return builder.toHashCode();
  }

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

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

    lastComparison = Boolean.valueOf(isSetQueryId()).compareTo(typedOther.isSetQueryId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryId()) {
      lastComparison = TBaseHelper.compareTo(this.queryId, typedOther.queryId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQuerySpace()).compareTo(typedOther.isSetQuerySpace());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuerySpace()) {
      lastComparison = TBaseHelper.compareTo(this.querySpace, typedOther.querySpace);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTableInfo()).compareTo(typedOther.isSetTableInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTableInfo()) {
      lastComparison = TBaseHelper.compareTo(this.tableInfo, typedOther.tableInfo);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumns()) {
      lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPagesize()).compareTo(typedOther.isSetPagesize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPagesize()) {
      lastComparison = TBaseHelper.compareTo(this.pagesize, typedOther.pagesize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpires()).compareTo(typedOther.isSetExpires());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpires()) {
      lastComparison = TBaseHelper.compareTo(this.expires, typedOther.expires);
      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: // QUERY_ID
          if (field.type == TType.STRUCT) {
            this.queryId = new ScrayUUID();
            this.queryId.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // QUERY_SPACE
          if (field.type == TType.STRING) {
            this.querySpace = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TABLE_INFO
          if (field.type == TType.STRUCT) {
            this.tableInfo = new ScrayTTableInfo();
            this.tableInfo.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // COLUMNS
          if (field.type == TType.LIST) {
            {
            TList _list0 = iprot.readListBegin();
            this.columns = new ArrayList(_list0.size);
            for (int _i1 = 0; _i1 < _list0.size; ++_i1)
            {
              ScrayTColumnInfo _elem2;
              _elem2 = new ScrayTColumnInfo();
              _elem2.read(iprot);
              this.columns.add(_elem2);
            }
            iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // PAGESIZE
          if (field.type == TType.I32) {
            this.pagesize = iprot.readI32();
            setPagesizeIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // EXPIRES
          if (field.type == TType.I64) {
            this.expires = iprot.readI64();
            setExpiresIsSet(true);
          } 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.queryId != null) {
      if (isSetQueryId()) {
        oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
        this.queryId.write(oprot);
        oprot.writeFieldEnd();
      }
    }
    if (this.querySpace != null) {
      oprot.writeFieldBegin(QUERY_SPACE_FIELD_DESC);
      oprot.writeString(this.querySpace);
      oprot.writeFieldEnd();
    }
    if (this.tableInfo != null) {
      oprot.writeFieldBegin(TABLE_INFO_FIELD_DESC);
      this.tableInfo.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.columns != null) {
      oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
        for (ScrayTColumnInfo _iter3 : this.columns)
        {
          _iter3.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (isSetPagesize()) {
      oprot.writeFieldBegin(PAGESIZE_FIELD_DESC);
      oprot.writeI32(this.pagesize);
      oprot.writeFieldEnd();
    }
    if (isSetExpires()) {
      oprot.writeFieldBegin(EXPIRES_FIELD_DESC);
      oprot.writeI64(this.expires);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ScrayTQueryInfo(");
    boolean first = true;
    if (isSetQueryId()) {
      sb.append("queryId:");
      if (this.queryId == null) {
        sb.append("null");
      } else {
        sb.append(this.queryId);
      }
      first = false;
      }
    if (!first) sb.append(", ");
    sb.append("querySpace:");
    if (this.querySpace == null) {
      sb.append("null");
    } else {
      sb.append(this.querySpace);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("tableInfo:");
    if (this.tableInfo == null) {
      sb.append("null");
    } else {
      sb.append(this.tableInfo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("columns:");
    if (this.columns == null) {
      sb.append("null");
    } else {
      sb.append(this.columns);
    }
    first = false;
    if (isSetPagesize()) {
      if (!first) sb.append(", ");
      sb.append("pagesize:");
      sb.append(this.pagesize);
      first = false;
      }
    if (isSetExpires()) {
      if (!first) sb.append(", ");
      sb.append("expires:");
      sb.append(this.expires);
      first = false;
      }
    sb.append(")");
    return sb.toString();
  }

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy