Subversion Repositories SmartDukaan

Rev

Rev 21838 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.inventory;

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;

public class StateInfo implements org.apache.thrift.TBase<StateInfo, StateInfo._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("StateInfo");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField STATE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("stateName", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField VAT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("vatType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField STATE_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("stateCode", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField SHORT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("shortName", org.apache.thrift.protocol.TType.STRING, (short)5);

  private long id; // required
  private String stateName; // required
  private VatType vatType; // required
  private String stateCode; // required
  private String shortName; // 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 {
    ID((short)1, "id"),
    STATE_NAME((short)2, "stateName"),
    /**
     * 
     * @see VatType
     */
    VAT_TYPE((short)3, "vatType"),
    STATE_CODE((short)4, "stateCode"),
    SHORT_NAME((short)5, "shortName");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    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: // ID
          return ID;
        case 2: // STATE_NAME
          return STATE_NAME;
        case 3: // VAT_TYPE
          return VAT_TYPE;
        case 4: // STATE_CODE
          return STATE_CODE;
        case 5: // SHORT_NAME
          return SHORT_NAME;
        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 __ID_ISSET_ID = 0;
  private BitSet __isset_bit_vector = new BitSet(1);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.STATE_NAME, new org.apache.thrift.meta_data.FieldMetaData("stateName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VAT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("vatType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, VatType.class)));
    tmpMap.put(_Fields.STATE_CODE, new org.apache.thrift.meta_data.FieldMetaData("stateCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SHORT_NAME, new org.apache.thrift.meta_data.FieldMetaData("shortName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StateInfo.class, metaDataMap);
  }

  public StateInfo() {
  }

  public StateInfo(
    long id,
    String stateName,
    VatType vatType,
    String stateCode,
    String shortName)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.stateName = stateName;
    this.vatType = vatType;
    this.stateCode = stateCode;
    this.shortName = shortName;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public StateInfo(StateInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetStateName()) {
      this.stateName = other.stateName;
    }
    if (other.isSetVatType()) {
      this.vatType = other.vatType;
    }
    if (other.isSetStateCode()) {
      this.stateCode = other.stateCode;
    }
    if (other.isSetShortName()) {
      this.shortName = other.shortName;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.stateName = null;
    this.vatType = null;
    this.stateCode = null;
    this.shortName = null;
  }

  public long getId() {
    return this.id;
  }

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public String getStateName() {
    return this.stateName;
  }

  public void setStateName(String stateName) {
    this.stateName = stateName;
  }

  public void unsetStateName() {
    this.stateName = null;
  }

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

  public void setStateNameIsSet(boolean value) {
    if (!value) {
      this.stateName = null;
    }
  }

  /**
   * 
   * @see VatType
   */
  public VatType getVatType() {
    return this.vatType;
  }

  /**
   * 
   * @see VatType
   */
  public void setVatType(VatType vatType) {
    this.vatType = vatType;
  }

  public void unsetVatType() {
    this.vatType = null;
  }

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

  public void setVatTypeIsSet(boolean value) {
    if (!value) {
      this.vatType = null;
    }
  }

  public String getStateCode() {
    return this.stateCode;
  }

  public void setStateCode(String stateCode) {
    this.stateCode = stateCode;
  }

  public void unsetStateCode() {
    this.stateCode = null;
  }

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

  public void setStateCodeIsSet(boolean value) {
    if (!value) {
      this.stateCode = null;
    }
  }

  public String getShortName() {
    return this.shortName;
  }

  public void setShortName(String shortName) {
    this.shortName = shortName;
  }

  public void unsetShortName() {
    this.shortName = null;
  }

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

  public void setShortNameIsSet(boolean value) {
    if (!value) {
      this.shortName = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case STATE_NAME:
      if (value == null) {
        unsetStateName();
      } else {
        setStateName((String)value);
      }
      break;

    case VAT_TYPE:
      if (value == null) {
        unsetVatType();
      } else {
        setVatType((VatType)value);
      }
      break;

    case STATE_CODE:
      if (value == null) {
        unsetStateCode();
      } else {
        setStateCode((String)value);
      }
      break;

    case SHORT_NAME:
      if (value == null) {
        unsetShortName();
      } else {
        setShortName((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return Long.valueOf(getId());

    case STATE_NAME:
      return getStateName();

    case VAT_TYPE:
      return getVatType();

    case STATE_CODE:
      return getStateCode();

    case SHORT_NAME:
      return getShortName();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case STATE_NAME:
      return isSetStateName();
    case VAT_TYPE:
      return isSetVatType();
    case STATE_CODE:
      return isSetStateCode();
    case SHORT_NAME:
      return isSetShortName();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(StateInfo that) {
    if (that == null)
      return false;

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_stateName = true && this.isSetStateName();
    boolean that_present_stateName = true && that.isSetStateName();
    if (this_present_stateName || that_present_stateName) {
      if (!(this_present_stateName && that_present_stateName))
        return false;
      if (!this.stateName.equals(that.stateName))
        return false;
    }

    boolean this_present_vatType = true && this.isSetVatType();
    boolean that_present_vatType = true && that.isSetVatType();
    if (this_present_vatType || that_present_vatType) {
      if (!(this_present_vatType && that_present_vatType))
        return false;
      if (!this.vatType.equals(that.vatType))
        return false;
    }

    boolean this_present_stateCode = true && this.isSetStateCode();
    boolean that_present_stateCode = true && that.isSetStateCode();
    if (this_present_stateCode || that_present_stateCode) {
      if (!(this_present_stateCode && that_present_stateCode))
        return false;
      if (!this.stateCode.equals(that.stateCode))
        return false;
    }

    boolean this_present_shortName = true && this.isSetShortName();
    boolean that_present_shortName = true && that.isSetShortName();
    if (this_present_shortName || that_present_shortName) {
      if (!(this_present_shortName && that_present_shortName))
        return false;
      if (!this.shortName.equals(that.shortName))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStateName()).compareTo(typedOther.isSetStateName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStateName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateName, typedOther.stateName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetVatType()).compareTo(typedOther.isSetVatType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVatType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.vatType, typedOther.vatType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStateCode()).compareTo(typedOther.isSetStateCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStateCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stateCode, typedOther.stateCode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShortName()).compareTo(typedOther.isSetShortName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShortName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shortName, typedOther.shortName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // STATE_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.stateName = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // VAT_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.vatType = VatType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // STATE_CODE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.stateCode = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // SHORT_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.shortName = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.stateName != null) {
      oprot.writeFieldBegin(STATE_NAME_FIELD_DESC);
      oprot.writeString(this.stateName);
      oprot.writeFieldEnd();
    }
    if (this.vatType != null) {
      oprot.writeFieldBegin(VAT_TYPE_FIELD_DESC);
      oprot.writeI32(this.vatType.getValue());
      oprot.writeFieldEnd();
    }
    if (this.stateCode != null) {
      oprot.writeFieldBegin(STATE_CODE_FIELD_DESC);
      oprot.writeString(this.stateCode);
      oprot.writeFieldEnd();
    }
    if (this.shortName != null) {
      oprot.writeFieldBegin(SHORT_NAME_FIELD_DESC);
      oprot.writeString(this.shortName);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("StateInfo(");
    boolean first = true;

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("stateName:");
    if (this.stateName == null) {
      sb.append("null");
    } else {
      sb.append(this.stateName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("vatType:");
    if (this.vatType == null) {
      sb.append("null");
    } else {
      sb.append(this.vatType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("stateCode:");
    if (this.stateCode == null) {
      sb.append("null");
    } else {
      sb.append(this.stateCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("shortName:");
    if (this.shortName == null) {
      sb.append("null");
    } else {
      sb.append(this.shortName);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  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, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      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);
    }
  }

}