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

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

  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
  private static final TField COLUMN_T_FIELD_DESC = new TField("columnT", TType.STRING, (short)2);
  private static final TField TABLE_ID_FIELD_DESC = new TField("tableId", TType.STRUCT, (short)3);


  public String name;
  public String columnT;
  public ScrayTTableInfo tableId;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    NAME((short)1, "name"),
    COLUMN_T((short)2, "columnT"),
    TABLE_ID((short)3, "tableId");
  
    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: // NAME
          return NAME;
        case 2: // COLUMN_T
          return COLUMN_T;
        case 3: // TABLE_ID
          return TABLE_ID;
        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.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.COLUMN_T, new FieldMetaData("columnT", TFieldRequirementType.OPTIONAL,
      new FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.TABLE_ID, new FieldMetaData("tableId", TFieldRequirementType.OPTIONAL,
      new StructMetaData(TType.STRUCT, ScrayTTableInfo.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(ScrayTColumnInfo.class, metaDataMap);
  }


  public ScrayTColumnInfo() {
  }

  public ScrayTColumnInfo(
    String name)
  {
    this();
    this.name = name;
  }

  /**
   * Performs a deep copy on other.
   */
  public ScrayTColumnInfo(ScrayTColumnInfo other) {
    if (other.isSetName()) {
      this.name = other.name;
    }
    if (other.isSetColumnT()) {
      this.columnT = other.columnT;
    }
    if (other.isSetTableId()) {
      this.tableId = new ScrayTTableInfo(other.tableId);
    }
  }

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

  @java.lang.Override
  public void clear() {
    this.name = null;
    this.columnT = null;
    this.tableId = null;
  }

  public String getName() {
    return this.name;
  }

  public ScrayTColumnInfo setName(String name) {
    this.name = name;
    
    return this;
  }

  public void unsetName() {
    this.name = null;
  }

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

  public void setNameIsSet(boolean value) {
    if (!value) {
      this.name = null;
    }
  }

  public String getColumnT() {
    return this.columnT;
  }

  public ScrayTColumnInfo setColumnT(String columnT) {
    this.columnT = columnT;
    
    return this;
  }

  public void unsetColumnT() {
    this.columnT = null;
  }

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

  public void setColumnTIsSet(boolean value) {
    if (!value) {
      this.columnT = null;
    }
  }

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

  public ScrayTColumnInfo setTableId(ScrayTTableInfo 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 void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case NAME:
      if (value == null) {
        unsetName();
      } else {
        setName((String)value);
      }
      break;
    case COLUMN_T:
      if (value == null) {
        unsetColumnT();
      } else {
        setColumnT((String)value);
      }
      break;
    case TABLE_ID:
      if (value == null) {
        unsetTableId();
      } else {
        setTableId((ScrayTTableInfo)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case NAME:
      return getName();
    case COLUMN_T:
      return getColumnT();
    case TABLE_ID:
      return getTableId();
    }
    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 NAME:
      return isSetName();
    case COLUMN_T:
      return isSetColumnT();
    case TABLE_ID:
      return isSetTableId();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(ScrayTColumnInfo that) {
    if (that == null)
      return false;
    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name))
        return false;
      if (!this.name.equals(that.name))
        return false;
    }
    boolean this_present_columnT = true && this.isSetColumnT();
    boolean that_present_columnT = true && that.isSetColumnT();
    if (this_present_columnT || that_present_columnT) {
      if (!(this_present_columnT && that_present_columnT))
        return false;
      if (!this.columnT.equals(that.columnT))
        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;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_name = true && (isSetName());
    builder.append(present_name);
    if (present_name)
      builder.append(name);
    boolean present_columnT = true && (isSetColumnT());
    builder.append(present_columnT);
    if (present_columnT)
      builder.append(columnT);
    boolean present_tableId = true && (isSetTableId());
    builder.append(present_tableId);
    if (present_tableId)
      builder.append(tableId);
    return builder.toHashCode();
  }

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

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

    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColumnT()).compareTo(typedOther.isSetColumnT());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumnT()) {
      lastComparison = TBaseHelper.compareTo(this.columnT, typedOther.columnT);
      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;
      }
    }
    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: // NAME
          if (field.type == TType.STRING) {
            this.name = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // COLUMN_T
          if (field.type == TType.STRING) {
            this.columnT = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // TABLE_ID
          if (field.type == TType.STRUCT) {
            this.tableId = new ScrayTTableInfo();
            this.tableId.read(iprot);
          } 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.name != null) {
      oprot.writeFieldBegin(NAME_FIELD_DESC);
      oprot.writeString(this.name);
      oprot.writeFieldEnd();
    }
    if (this.columnT != null) {
      if (isSetColumnT()) {
        oprot.writeFieldBegin(COLUMN_T_FIELD_DESC);
        oprot.writeString(this.columnT);
        oprot.writeFieldEnd();
      }
    }
    if (this.tableId != null) {
      if (isSetTableId()) {
        oprot.writeFieldBegin(TABLE_ID_FIELD_DESC);
        this.tableId.write(oprot);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ScrayTColumnInfo(");
    boolean first = true;
    sb.append("name:");
    if (this.name == null) {
      sb.append("null");
    } else {
      sb.append(this.name);
    }
    first = false;
    if (isSetColumnT()) {
      if (!first) sb.append(", ");
      sb.append("columnT:");
      if (this.columnT == null) {
        sb.append("null");
      } else {
        sb.append(this.columnT);
      }
      first = false;
      }
    if (isSetTableId()) {
      if (!first) sb.append(", ");
      sb.append("tableId:");
      if (this.tableId == null) {
        sb.append("null");
      } else {
        sb.append(this.tableId);
      }
      first = false;
      }
    sb.append(")");
    return sb.toString();
  }

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy