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

  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 GST_RATES_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("gstRatesMap", org.apache.thrift.protocol.TType.MAP, (short)2);

  private String stateCode; // required
  private Map<String,GstRate> gstRatesMap; // 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"),
    GST_RATES_MAP((short)2, "gstRatesMap");

    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: // GST_RATES_MAP
          return GST_RATES_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.GST_RATES_MAP, new org.apache.thrift.meta_data.FieldMetaData("gstRatesMap", 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.STRING), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, GstRate.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StateGstRates.class, metaDataMap);
  }

  public StateGstRates() {
  }

  public StateGstRates(
    String stateCode,
    Map<String,GstRate> gstRatesMap)
  {
    this();
    this.stateCode = stateCode;
    this.gstRatesMap = gstRatesMap;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public StateGstRates(StateGstRates other) {
    if (other.isSetStateCode()) {
      this.stateCode = other.stateCode;
    }
    if (other.isSetGstRatesMap()) {
      Map<String,GstRate> __this__gstRatesMap = new HashMap<String,GstRate>();
      for (Map.Entry<String, GstRate> other_element : other.gstRatesMap.entrySet()) {

        String other_element_key = other_element.getKey();
        GstRate other_element_value = other_element.getValue();

        String __this__gstRatesMap_copy_key = other_element_key;

        GstRate __this__gstRatesMap_copy_value = new GstRate(other_element_value);

        __this__gstRatesMap.put(__this__gstRatesMap_copy_key, __this__gstRatesMap_copy_value);
      }
      this.gstRatesMap = __this__gstRatesMap;
    }
  }

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

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

  public void putToGstRatesMap(String key, GstRate val) {
    if (this.gstRatesMap == null) {
      this.gstRatesMap = new HashMap<String,GstRate>();
    }
    this.gstRatesMap.put(key, val);
  }

  public Map<String,GstRate> getGstRatesMap() {
    return this.gstRatesMap;
  }

  public void setGstRatesMap(Map<String,GstRate> gstRatesMap) {
    this.gstRatesMap = gstRatesMap;
  }

  public void unsetGstRatesMap() {
    this.gstRatesMap = null;
  }

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

  public void setGstRatesMapIsSet(boolean value) {
    if (!value) {
      this.gstRatesMap = null;
    }
  }

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

    case GST_RATES_MAP:
      if (value == null) {
        unsetGstRatesMap();
      } else {
        setGstRatesMap((Map<String,GstRate>)value);
      }
      break;

    }
  }

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

    case GST_RATES_MAP:
      return getGstRatesMap();

    }
    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 GST_RATES_MAP:
      return isSetGstRatesMap();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(StateGstRates 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_gstRatesMap = true && this.isSetGstRatesMap();
    boolean that_present_gstRatesMap = true && that.isSetGstRatesMap();
    if (this_present_gstRatesMap || that_present_gstRatesMap) {
      if (!(this_present_gstRatesMap && that_present_gstRatesMap))
        return false;
      if (!this.gstRatesMap.equals(that.gstRatesMap))
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    StateGstRates typedOther = (StateGstRates)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(isSetGstRatesMap()).compareTo(typedOther.isSetGstRatesMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGstRatesMap()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gstRatesMap, typedOther.gstRatesMap);
      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: // GST_RATES_MAP
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
            {
              org.apache.thrift.protocol.TMap _map17 = iprot.readMapBegin();
              this.gstRatesMap = new HashMap<String,GstRate>(2*_map17.size);
              for (int _i18 = 0; _i18 < _map17.size; ++_i18)
              {
                String _key19; // required
                GstRate _val20; // required
                _key19 = iprot.readString();
                _val20 = new GstRate();
                _val20.read(iprot);
                this.gstRatesMap.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.gstRatesMap != null) {
      oprot.writeFieldBegin(GST_RATES_MAP_FIELD_DESC);
      {
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, this.gstRatesMap.size()));
        for (Map.Entry<String, GstRate> _iter21 : this.gstRatesMap.entrySet())
        {
          oprot.writeString(_iter21.getKey());
          _iter21.getValue().write(oprot);
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("StateGstRates(");
    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("gstRatesMap:");
    if (this.gstRatesMap == null) {
      sb.append("null");
    } else {
      sb.append(this.gstRatesMap);
    }
    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);
    }
  }

}