Subversion Repositories SmartDukaan

Rev

Blame | 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.catalog;

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 StateCategoryGst implements org.apache.thrift.TBase<StateCategoryGst, StateCategoryGst._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("StateCategoryGst");

  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)1);
  private static final org.apache.thrift.protocol.TField CATEGORY_GST_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("categoryGstMap", org.apache.thrift.protocol.TType.MAP, (short)2);

  private String stateCode; // required
  private Map<Long,CategoryGst> categoryGstMap; // 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 {
    STATE_CODE((short)1, "stateCode"),
    CATEGORY_GST_MAP((short)2, "categoryGstMap");

    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: // STATE_CODE
          return STATE_CODE;
        case 2: // CATEGORY_GST_MAP
          return CATEGORY_GST_MAP;
        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, 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.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.CATEGORY_GST_MAP, new org.apache.thrift.meta_data.FieldMetaData("categoryGstMap", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CategoryGst.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StateCategoryGst.class, metaDataMap);
  }

  public StateCategoryGst() {
  }

  public StateCategoryGst(
    String stateCode,
    Map<Long,CategoryGst> categoryGstMap)
  {
    this();
    this.stateCode = stateCode;
    this.categoryGstMap = categoryGstMap;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public StateCategoryGst(StateCategoryGst other) {
    if (other.isSetStateCode()) {
      this.stateCode = other.stateCode;
    }
    if (other.isSetCategoryGstMap()) {
      Map<Long,CategoryGst> __this__categoryGstMap = new HashMap<Long,CategoryGst>();
      for (Map.Entry<Long, CategoryGst> other_element : other.categoryGstMap.entrySet()) {

        Long other_element_key = other_element.getKey();
        CategoryGst other_element_value = other_element.getValue();

        Long __this__categoryGstMap_copy_key = other_element_key;

        CategoryGst __this__categoryGstMap_copy_value = new CategoryGst(other_element_value);

        __this__categoryGstMap.put(__this__categoryGstMap_copy_key, __this__categoryGstMap_copy_value);
      }
      this.categoryGstMap = __this__categoryGstMap;
    }
  }

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

  @Override
  public void clear() {
    this.stateCode = null;
    this.categoryGstMap = 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 int getCategoryGstMapSize() {
    return (this.categoryGstMap == null) ? 0 : this.categoryGstMap.size();
  }

  public void putToCategoryGstMap(long key, CategoryGst val) {
    if (this.categoryGstMap == null) {
      this.categoryGstMap = new HashMap<Long,CategoryGst>();
    }
    this.categoryGstMap.put(key, val);
  }

  public Map<Long,CategoryGst> getCategoryGstMap() {
    return this.categoryGstMap;
  }

  public void setCategoryGstMap(Map<Long,CategoryGst> categoryGstMap) {
    this.categoryGstMap = categoryGstMap;
  }

  public void unsetCategoryGstMap() {
    this.categoryGstMap = null;
  }

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

  public void setCategoryGstMapIsSet(boolean value) {
    if (!value) {
      this.categoryGstMap = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case STATE_CODE:
      if (value == null) {
        unsetStateCode();
      } else {
        setStateCode((String)value);
      }
      break;

    case CATEGORY_GST_MAP:
      if (value == null) {
        unsetCategoryGstMap();
      } else {
        setCategoryGstMap((Map<Long,CategoryGst>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case STATE_CODE:
      return getStateCode();

    case CATEGORY_GST_MAP:
      return getCategoryGstMap();

    }
    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 STATE_CODE:
      return isSetStateCode();
    case CATEGORY_GST_MAP:
      return isSetCategoryGstMap();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(StateCategoryGst that) {
    if (that == null)
      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_categoryGstMap = true && this.isSetCategoryGstMap();
    boolean that_present_categoryGstMap = true && that.isSetCategoryGstMap();
    if (this_present_categoryGstMap || that_present_categoryGstMap) {
      if (!(this_present_categoryGstMap && that_present_categoryGstMap))
        return false;
      if (!this.categoryGstMap.equals(that.categoryGstMap))
        return false;
    }

    return true;
  }

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

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

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

    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(isSetCategoryGstMap()).compareTo(typedOther.isSetCategoryGstMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCategoryGstMap()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.categoryGstMap, typedOther.categoryGstMap);
      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: // 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 2: // CATEGORY_GST_MAP
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
            {
              org.apache.thrift.protocol.TMap _map17 = iprot.readMapBegin();
              this.categoryGstMap = new HashMap<Long,CategoryGst>(2*_map17.size);
              for (int _i18 = 0; _i18 < _map17.size; ++_i18)
              {
                long _key19; // required
                CategoryGst _val20; // required
                _key19 = iprot.readI64();
                _val20 = new CategoryGst();
                _val20.read(iprot);
                this.categoryGstMap.put(_key19, _val20);
              }
              iprot.readMapEnd();
            }
          } 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);
    if (this.stateCode != null) {
      oprot.writeFieldBegin(STATE_CODE_FIELD_DESC);
      oprot.writeString(this.stateCode);
      oprot.writeFieldEnd();
    }
    if (this.categoryGstMap != null) {
      oprot.writeFieldBegin(CATEGORY_GST_MAP_FIELD_DESC);
      {
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRUCT, this.categoryGstMap.size()));
        for (Map.Entry<Long, CategoryGst> _iter21 : this.categoryGstMap.entrySet())
        {
          oprot.writeI64(_iter21.getKey());
          _iter21.getValue().write(oprot);
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("stateCode:");
    if (this.stateCode == null) {
      sb.append("null");
    } else {
      sb.append(this.stateCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("categoryGstMap:");
    if (this.categoryGstMap == null) {
      sb.append("null");
    } else {
      sb.append(this.categoryGstMap);
    }
    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 {
      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);
    }
  }

}