Subversion Repositories SmartDukaan

Rev

Rev 6389 | Rev 6410 | Go to most recent revision | 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.order;

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

  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 GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField BANK_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("bankId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField TENURE_FIELD_DESC = new org.apache.thrift.protocol.TField("tenure", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField BANK_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("bankName", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField MIN_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("minAmount", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField TENURE_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("tenureDescription", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField CHARGE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("chargeType", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField CHARGE_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("chargeValue", org.apache.thrift.protocol.TType.I64, (short)9);

  private long id; // required
  private long gatewayId; // required
  private long bankId; // required
  private long tenure; // required
  private String bankName; // required
  private long minAmount; // required
  private String tenureDescription; // required
  private EmiChargeType chargeType; // required
  private long chargeValue; // 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"),
    GATEWAY_ID((short)2, "gatewayId"),
    BANK_ID((short)3, "bankId"),
    TENURE((short)4, "tenure"),
    BANK_NAME((short)5, "bankName"),
    MIN_AMOUNT((short)6, "minAmount"),
    TENURE_DESCRIPTION((short)7, "tenureDescription"),
    /**
     * 
     * @see EmiChargeType
     */
    CHARGE_TYPE((short)8, "chargeType"),
    CHARGE_VALUE((short)9, "chargeValue");

    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: // GATEWAY_ID
          return GATEWAY_ID;
        case 3: // BANK_ID
          return BANK_ID;
        case 4: // TENURE
          return TENURE;
        case 5: // BANK_NAME
          return BANK_NAME;
        case 6: // MIN_AMOUNT
          return MIN_AMOUNT;
        case 7: // TENURE_DESCRIPTION
          return TENURE_DESCRIPTION;
        case 8: // CHARGE_TYPE
          return CHARGE_TYPE;
        case 9: // CHARGE_VALUE
          return CHARGE_VALUE;
        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 static final int __GATEWAYID_ISSET_ID = 1;
  private static final int __BANKID_ISSET_ID = 2;
  private static final int __TENURE_ISSET_ID = 3;
  private static final int __MINAMOUNT_ISSET_ID = 4;
  private static final int __CHARGEVALUE_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  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.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BANK_ID, new org.apache.thrift.meta_data.FieldMetaData("bankId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TENURE, new org.apache.thrift.meta_data.FieldMetaData("tenure", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BANK_NAME, new org.apache.thrift.meta_data.FieldMetaData("bankName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MIN_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("minAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TENURE_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("tenureDescription", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CHARGE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("chargeType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, EmiChargeType.class)));
    tmpMap.put(_Fields.CHARGE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("chargeValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EmiScheme.class, metaDataMap);
  }

  public EmiScheme() {
  }

  public EmiScheme(
    long id,
    long gatewayId,
    long bankId,
    long tenure,
    String bankName,
    long minAmount,
    String tenureDescription,
    EmiChargeType chargeType,
    long chargeValue)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
    this.bankId = bankId;
    setBankIdIsSet(true);
    this.tenure = tenure;
    setTenureIsSet(true);
    this.bankName = bankName;
    this.minAmount = minAmount;
    setMinAmountIsSet(true);
    this.tenureDescription = tenureDescription;
    this.chargeType = chargeType;
    this.chargeValue = chargeValue;
    setChargeValueIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public EmiScheme(EmiScheme other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.gatewayId = other.gatewayId;
    this.bankId = other.bankId;
    this.tenure = other.tenure;
    if (other.isSetBankName()) {
      this.bankName = other.bankName;
    }
    this.minAmount = other.minAmount;
    if (other.isSetTenureDescription()) {
      this.tenureDescription = other.tenureDescription;
    }
    if (other.isSetChargeType()) {
      this.chargeType = other.chargeType;
    }
    this.chargeValue = other.chargeValue;
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setGatewayIdIsSet(false);
    this.gatewayId = 0;
    setBankIdIsSet(false);
    this.bankId = 0;
    setTenureIsSet(false);
    this.tenure = 0;
    this.bankName = null;
    setMinAmountIsSet(false);
    this.minAmount = 0;
    this.tenureDescription = null;
    this.chargeType = null;
    setChargeValueIsSet(false);
    this.chargeValue = 0;
  }

  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 long getGatewayId() {
    return this.gatewayId;
  }

  public void setGatewayId(long gatewayId) {
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
  }

  public void unsetGatewayId() {
    __isset_bit_vector.clear(__GATEWAYID_ISSET_ID);
  }

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

  public void setGatewayIdIsSet(boolean value) {
    __isset_bit_vector.set(__GATEWAYID_ISSET_ID, value);
  }

  public long getBankId() {
    return this.bankId;
  }

  public void setBankId(long bankId) {
    this.bankId = bankId;
    setBankIdIsSet(true);
  }

  public void unsetBankId() {
    __isset_bit_vector.clear(__BANKID_ISSET_ID);
  }

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

  public void setBankIdIsSet(boolean value) {
    __isset_bit_vector.set(__BANKID_ISSET_ID, value);
  }

  public long getTenure() {
    return this.tenure;
  }

  public void setTenure(long tenure) {
    this.tenure = tenure;
    setTenureIsSet(true);
  }

  public void unsetTenure() {
    __isset_bit_vector.clear(__TENURE_ISSET_ID);
  }

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

  public void setTenureIsSet(boolean value) {
    __isset_bit_vector.set(__TENURE_ISSET_ID, value);
  }

  public String getBankName() {
    return this.bankName;
  }

  public void setBankName(String bankName) {
    this.bankName = bankName;
  }

  public void unsetBankName() {
    this.bankName = null;
  }

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

  public void setBankNameIsSet(boolean value) {
    if (!value) {
      this.bankName = null;
    }
  }

  public long getMinAmount() {
    return this.minAmount;
  }

  public void setMinAmount(long minAmount) {
    this.minAmount = minAmount;
    setMinAmountIsSet(true);
  }

  public void unsetMinAmount() {
    __isset_bit_vector.clear(__MINAMOUNT_ISSET_ID);
  }

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

  public void setMinAmountIsSet(boolean value) {
    __isset_bit_vector.set(__MINAMOUNT_ISSET_ID, value);
  }

  public String getTenureDescription() {
    return this.tenureDescription;
  }

  public void setTenureDescription(String tenureDescription) {
    this.tenureDescription = tenureDescription;
  }

  public void unsetTenureDescription() {
    this.tenureDescription = null;
  }

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

  public void setTenureDescriptionIsSet(boolean value) {
    if (!value) {
      this.tenureDescription = null;
    }
  }

  /**
   * 
   * @see EmiChargeType
   */
  public EmiChargeType getChargeType() {
    return this.chargeType;
  }

  /**
   * 
   * @see EmiChargeType
   */
  public void setChargeType(EmiChargeType chargeType) {
    this.chargeType = chargeType;
  }

  public void unsetChargeType() {
    this.chargeType = null;
  }

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

  public void setChargeTypeIsSet(boolean value) {
    if (!value) {
      this.chargeType = null;
    }
  }

  public long getChargeValue() {
    return this.chargeValue;
  }

  public void setChargeValue(long chargeValue) {
    this.chargeValue = chargeValue;
    setChargeValueIsSet(true);
  }

  public void unsetChargeValue() {
    __isset_bit_vector.clear(__CHARGEVALUE_ISSET_ID);
  }

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

  public void setChargeValueIsSet(boolean value) {
    __isset_bit_vector.set(__CHARGEVALUE_ISSET_ID, value);
  }

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

    case GATEWAY_ID:
      if (value == null) {
        unsetGatewayId();
      } else {
        setGatewayId((Long)value);
      }
      break;

    case BANK_ID:
      if (value == null) {
        unsetBankId();
      } else {
        setBankId((Long)value);
      }
      break;

    case TENURE:
      if (value == null) {
        unsetTenure();
      } else {
        setTenure((Long)value);
      }
      break;

    case BANK_NAME:
      if (value == null) {
        unsetBankName();
      } else {
        setBankName((String)value);
      }
      break;

    case MIN_AMOUNT:
      if (value == null) {
        unsetMinAmount();
      } else {
        setMinAmount((Long)value);
      }
      break;

    case TENURE_DESCRIPTION:
      if (value == null) {
        unsetTenureDescription();
      } else {
        setTenureDescription((String)value);
      }
      break;

    case CHARGE_TYPE:
      if (value == null) {
        unsetChargeType();
      } else {
        setChargeType((EmiChargeType)value);
      }
      break;

    case CHARGE_VALUE:
      if (value == null) {
        unsetChargeValue();
      } else {
        setChargeValue((Long)value);
      }
      break;

    }
  }

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

    case GATEWAY_ID:
      return Long.valueOf(getGatewayId());

    case BANK_ID:
      return Long.valueOf(getBankId());

    case TENURE:
      return Long.valueOf(getTenure());

    case BANK_NAME:
      return getBankName();

    case MIN_AMOUNT:
      return Long.valueOf(getMinAmount());

    case TENURE_DESCRIPTION:
      return getTenureDescription();

    case CHARGE_TYPE:
      return getChargeType();

    case CHARGE_VALUE:
      return Long.valueOf(getChargeValue());

    }
    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 GATEWAY_ID:
      return isSetGatewayId();
    case BANK_ID:
      return isSetBankId();
    case TENURE:
      return isSetTenure();
    case BANK_NAME:
      return isSetBankName();
    case MIN_AMOUNT:
      return isSetMinAmount();
    case TENURE_DESCRIPTION:
      return isSetTenureDescription();
    case CHARGE_TYPE:
      return isSetChargeType();
    case CHARGE_VALUE:
      return isSetChargeValue();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(EmiScheme 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_gatewayId = true;
    boolean that_present_gatewayId = true;
    if (this_present_gatewayId || that_present_gatewayId) {
      if (!(this_present_gatewayId && that_present_gatewayId))
        return false;
      if (this.gatewayId != that.gatewayId)
        return false;
    }

    boolean this_present_bankId = true;
    boolean that_present_bankId = true;
    if (this_present_bankId || that_present_bankId) {
      if (!(this_present_bankId && that_present_bankId))
        return false;
      if (this.bankId != that.bankId)
        return false;
    }

    boolean this_present_tenure = true;
    boolean that_present_tenure = true;
    if (this_present_tenure || that_present_tenure) {
      if (!(this_present_tenure && that_present_tenure))
        return false;
      if (this.tenure != that.tenure)
        return false;
    }

    boolean this_present_bankName = true && this.isSetBankName();
    boolean that_present_bankName = true && that.isSetBankName();
    if (this_present_bankName || that_present_bankName) {
      if (!(this_present_bankName && that_present_bankName))
        return false;
      if (!this.bankName.equals(that.bankName))
        return false;
    }

    boolean this_present_minAmount = true;
    boolean that_present_minAmount = true;
    if (this_present_minAmount || that_present_minAmount) {
      if (!(this_present_minAmount && that_present_minAmount))
        return false;
      if (this.minAmount != that.minAmount)
        return false;
    }

    boolean this_present_tenureDescription = true && this.isSetTenureDescription();
    boolean that_present_tenureDescription = true && that.isSetTenureDescription();
    if (this_present_tenureDescription || that_present_tenureDescription) {
      if (!(this_present_tenureDescription && that_present_tenureDescription))
        return false;
      if (!this.tenureDescription.equals(that.tenureDescription))
        return false;
    }

    boolean this_present_chargeType = true && this.isSetChargeType();
    boolean that_present_chargeType = true && that.isSetChargeType();
    if (this_present_chargeType || that_present_chargeType) {
      if (!(this_present_chargeType && that_present_chargeType))
        return false;
      if (!this.chargeType.equals(that.chargeType))
        return false;
    }

    boolean this_present_chargeValue = true;
    boolean that_present_chargeValue = true;
    if (this_present_chargeValue || that_present_chargeValue) {
      if (!(this_present_chargeValue && that_present_chargeValue))
        return false;
      if (this.chargeValue != that.chargeValue)
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    EmiScheme typedOther = (EmiScheme)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(isSetGatewayId()).compareTo(typedOther.isSetGatewayId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGatewayId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, typedOther.gatewayId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBankId()).compareTo(typedOther.isSetBankId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBankId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bankId, typedOther.bankId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTenure()).compareTo(typedOther.isSetTenure());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTenure()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenure, typedOther.tenure);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBankName()).compareTo(typedOther.isSetBankName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBankName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bankName, typedOther.bankName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMinAmount()).compareTo(typedOther.isSetMinAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.minAmount, typedOther.minAmount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTenureDescription()).compareTo(typedOther.isSetTenureDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTenureDescription()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenureDescription, typedOther.tenureDescription);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetChargeType()).compareTo(typedOther.isSetChargeType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChargeType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.chargeType, typedOther.chargeType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetChargeValue()).compareTo(typedOther.isSetChargeValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChargeValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.chargeValue, typedOther.chargeValue);
      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: // GATEWAY_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.gatewayId = iprot.readI64();
            setGatewayIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // BANK_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.bankId = iprot.readI64();
            setBankIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // TENURE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.tenure = iprot.readI64();
            setTenureIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // BANK_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.bankName = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // MIN_AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.minAmount = iprot.readI64();
            setMinAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // TENURE_DESCRIPTION
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.tenureDescription = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // CHARGE_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.chargeType = EmiChargeType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // CHARGE_VALUE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.chargeValue = iprot.readI64();
            setChargeValueIsSet(true);
          } 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();
    oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
    oprot.writeI64(this.gatewayId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(BANK_ID_FIELD_DESC);
    oprot.writeI64(this.bankId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TENURE_FIELD_DESC);
    oprot.writeI64(this.tenure);
    oprot.writeFieldEnd();
    if (this.bankName != null) {
      oprot.writeFieldBegin(BANK_NAME_FIELD_DESC);
      oprot.writeString(this.bankName);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(MIN_AMOUNT_FIELD_DESC);
    oprot.writeI64(this.minAmount);
    oprot.writeFieldEnd();
    if (this.tenureDescription != null) {
      oprot.writeFieldBegin(TENURE_DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.tenureDescription);
      oprot.writeFieldEnd();
    }
    if (this.chargeType != null) {
      oprot.writeFieldBegin(CHARGE_TYPE_FIELD_DESC);
      oprot.writeI32(this.chargeType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CHARGE_VALUE_FIELD_DESC);
    oprot.writeI64(this.chargeValue);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("gatewayId:");
    sb.append(this.gatewayId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bankId:");
    sb.append(this.bankId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("tenure:");
    sb.append(this.tenure);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bankName:");
    if (this.bankName == null) {
      sb.append("null");
    } else {
      sb.append(this.bankName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("minAmount:");
    sb.append(this.minAmount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("tenureDescription:");
    if (this.tenureDescription == null) {
      sb.append("null");
    } else {
      sb.append(this.tenureDescription);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("chargeType:");
    if (this.chargeType == null) {
      sb.append("null");
    } else {
      sb.append(this.chargeType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("chargeValue:");
    sb.append(this.chargeValue);
    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);
    }
  }

}