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

  private static final org.apache.thrift.protocol.TField OPERATOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("operatorId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField CIRCLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("circleId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField DENOMINATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("denominationType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField VALIDITY_FIELD_DESC = new org.apache.thrift.protocol.TField("validity", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)6);

  private long operatorId; // required
  private long circleId; // required
  private DenominationType denominationType; // required
  private long amount; // required
  private String validity; // required
  private String description; // 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 {
    OPERATOR_ID((short)1, "operatorId"),
    CIRCLE_ID((short)2, "circleId"),
    /**
     * 
     * @see DenominationType
     */
    DENOMINATION_TYPE((short)3, "denominationType"),
    AMOUNT((short)4, "amount"),
    VALIDITY((short)5, "validity"),
    DESCRIPTION((short)6, "description");

    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: // OPERATOR_ID
          return OPERATOR_ID;
        case 2: // CIRCLE_ID
          return CIRCLE_ID;
        case 3: // DENOMINATION_TYPE
          return DENOMINATION_TYPE;
        case 4: // AMOUNT
          return AMOUNT;
        case 5: // VALIDITY
          return VALIDITY;
        case 6: // DESCRIPTION
          return DESCRIPTION;
        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 __OPERATORID_ISSET_ID = 0;
  private static final int __CIRCLEID_ISSET_ID = 1;
  private static final int __AMOUNT_ISSET_ID = 2;
  private BitSet __isset_bit_vector = new BitSet(3);

  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.OPERATOR_ID, new org.apache.thrift.meta_data.FieldMetaData("operatorId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CIRCLE_ID, new org.apache.thrift.meta_data.FieldMetaData("circleId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DENOMINATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("denominationType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DenominationType.class)));
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.VALIDITY, new org.apache.thrift.meta_data.FieldMetaData("validity", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", 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(RechargeDenomination.class, metaDataMap);
  }

  public RechargeDenomination() {
  }

  public RechargeDenomination(
    long operatorId,
    long circleId,
    DenominationType denominationType,
    long amount,
    String validity,
    String description)
  {
    this();
    this.operatorId = operatorId;
    setOperatorIdIsSet(true);
    this.circleId = circleId;
    setCircleIdIsSet(true);
    this.denominationType = denominationType;
    this.amount = amount;
    setAmountIsSet(true);
    this.validity = validity;
    this.description = description;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public RechargeDenomination(RechargeDenomination other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.operatorId = other.operatorId;
    this.circleId = other.circleId;
    if (other.isSetDenominationType()) {
      this.denominationType = other.denominationType;
    }
    this.amount = other.amount;
    if (other.isSetValidity()) {
      this.validity = other.validity;
    }
    if (other.isSetDescription()) {
      this.description = other.description;
    }
  }

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

  @Override
  public void clear() {
    setOperatorIdIsSet(false);
    this.operatorId = 0;
    setCircleIdIsSet(false);
    this.circleId = 0;
    this.denominationType = null;
    setAmountIsSet(false);
    this.amount = 0;
    this.validity = null;
    this.description = null;
  }

  public long getOperatorId() {
    return this.operatorId;
  }

  public void setOperatorId(long operatorId) {
    this.operatorId = operatorId;
    setOperatorIdIsSet(true);
  }

  public void unsetOperatorId() {
    __isset_bit_vector.clear(__OPERATORID_ISSET_ID);
  }

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

  public void setOperatorIdIsSet(boolean value) {
    __isset_bit_vector.set(__OPERATORID_ISSET_ID, value);
  }

  public long getCircleId() {
    return this.circleId;
  }

  public void setCircleId(long circleId) {
    this.circleId = circleId;
    setCircleIdIsSet(true);
  }

  public void unsetCircleId() {
    __isset_bit_vector.clear(__CIRCLEID_ISSET_ID);
  }

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

  public void setCircleIdIsSet(boolean value) {
    __isset_bit_vector.set(__CIRCLEID_ISSET_ID, value);
  }

  /**
   * 
   * @see DenominationType
   */
  public DenominationType getDenominationType() {
    return this.denominationType;
  }

  /**
   * 
   * @see DenominationType
   */
  public void setDenominationType(DenominationType denominationType) {
    this.denominationType = denominationType;
  }

  public void unsetDenominationType() {
    this.denominationType = null;
  }

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

  public void setDenominationTypeIsSet(boolean value) {
    if (!value) {
      this.denominationType = null;
    }
  }

  public long getAmount() {
    return this.amount;
  }

  public void setAmount(long amount) {
    this.amount = amount;
    setAmountIsSet(true);
  }

  public void unsetAmount() {
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
  }

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

  public void setAmountIsSet(boolean value) {
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
  }

  public String getValidity() {
    return this.validity;
  }

  public void setValidity(String validity) {
    this.validity = validity;
  }

  public void unsetValidity() {
    this.validity = null;
  }

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

  public void setValidityIsSet(boolean value) {
    if (!value) {
      this.validity = null;
    }
  }

  public String getDescription() {
    return this.description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case OPERATOR_ID:
      if (value == null) {
        unsetOperatorId();
      } else {
        setOperatorId((Long)value);
      }
      break;

    case CIRCLE_ID:
      if (value == null) {
        unsetCircleId();
      } else {
        setCircleId((Long)value);
      }
      break;

    case DENOMINATION_TYPE:
      if (value == null) {
        unsetDenominationType();
      } else {
        setDenominationType((DenominationType)value);
      }
      break;

    case AMOUNT:
      if (value == null) {
        unsetAmount();
      } else {
        setAmount((Long)value);
      }
      break;

    case VALIDITY:
      if (value == null) {
        unsetValidity();
      } else {
        setValidity((String)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    }
  }

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

    case CIRCLE_ID:
      return Long.valueOf(getCircleId());

    case DENOMINATION_TYPE:
      return getDenominationType();

    case AMOUNT:
      return Long.valueOf(getAmount());

    case VALIDITY:
      return getValidity();

    case DESCRIPTION:
      return getDescription();

    }
    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 OPERATOR_ID:
      return isSetOperatorId();
    case CIRCLE_ID:
      return isSetCircleId();
    case DENOMINATION_TYPE:
      return isSetDenominationType();
    case AMOUNT:
      return isSetAmount();
    case VALIDITY:
      return isSetValidity();
    case DESCRIPTION:
      return isSetDescription();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_operatorId = true;
    boolean that_present_operatorId = true;
    if (this_present_operatorId || that_present_operatorId) {
      if (!(this_present_operatorId && that_present_operatorId))
        return false;
      if (this.operatorId != that.operatorId)
        return false;
    }

    boolean this_present_circleId = true;
    boolean that_present_circleId = true;
    if (this_present_circleId || that_present_circleId) {
      if (!(this_present_circleId && that_present_circleId))
        return false;
      if (this.circleId != that.circleId)
        return false;
    }

    boolean this_present_denominationType = true && this.isSetDenominationType();
    boolean that_present_denominationType = true && that.isSetDenominationType();
    if (this_present_denominationType || that_present_denominationType) {
      if (!(this_present_denominationType && that_present_denominationType))
        return false;
      if (!this.denominationType.equals(that.denominationType))
        return false;
    }

    boolean this_present_amount = true;
    boolean that_present_amount = true;
    if (this_present_amount || that_present_amount) {
      if (!(this_present_amount && that_present_amount))
        return false;
      if (this.amount != that.amount)
        return false;
    }

    boolean this_present_validity = true && this.isSetValidity();
    boolean that_present_validity = true && that.isSetValidity();
    if (this_present_validity || that_present_validity) {
      if (!(this_present_validity && that_present_validity))
        return false;
      if (!this.validity.equals(that.validity))
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetOperatorId()).compareTo(typedOther.isSetOperatorId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOperatorId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operatorId, typedOther.operatorId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCircleId()).compareTo(typedOther.isSetCircleId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCircleId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.circleId, typedOther.circleId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDenominationType()).compareTo(typedOther.isSetDenominationType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDenominationType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.denominationType, typedOther.denominationType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValidity()).compareTo(typedOther.isSetValidity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValidity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validity, typedOther.validity);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(typedOther.isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, typedOther.description);
      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: // OPERATOR_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.operatorId = iprot.readI64();
            setOperatorIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // CIRCLE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.circleId = iprot.readI64();
            setCircleIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // DENOMINATION_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.denominationType = DenominationType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.amount = iprot.readI64();
            setAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // VALIDITY
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.validity = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // DESCRIPTION
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.description = 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(OPERATOR_ID_FIELD_DESC);
    oprot.writeI64(this.operatorId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CIRCLE_ID_FIELD_DESC);
    oprot.writeI64(this.circleId);
    oprot.writeFieldEnd();
    if (this.denominationType != null) {
      oprot.writeFieldBegin(DENOMINATION_TYPE_FIELD_DESC);
      oprot.writeI32(this.denominationType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeI64(this.amount);
    oprot.writeFieldEnd();
    if (this.validity != null) {
      oprot.writeFieldBegin(VALIDITY_FIELD_DESC);
      oprot.writeString(this.validity);
      oprot.writeFieldEnd();
    }
    if (this.description != null) {
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.description);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("operatorId:");
    sb.append(this.operatorId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("circleId:");
    sb.append(this.circleId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("denominationType:");
    if (this.denominationType == null) {
      sb.append("null");
    } else {
      sb.append(this.denominationType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("validity:");
    if (this.validity == null) {
      sb.append("null");
    } else {
      sb.append(this.validity);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    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);
    }
  }

}