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

  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 AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField CREATING_TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("creatingTransactionId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField CONSUMING_TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("consumingTransactionId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField COUPON_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("couponCode", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField CREATION_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTimestamp", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField CONSUMED_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("consumedTimestamp", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField CUSTOMER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("customerId", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField CUSTOMER_EMAIL_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("customerEmailId", org.apache.thrift.protocol.TType.I64, (short)10);
  private static final org.apache.thrift.protocol.TField EXPIRY_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("expiryTimestamp", org.apache.thrift.protocol.TType.I64, (short)11);

  private long id; // required
  private long amount; // required
  private long creatingTransactionId; // required
  private long consumingTransactionId; // required
  private RechargeCouponStatus status; // required
  private String couponCode; // required
  private long creationTimestamp; // required
  private long consumedTimestamp; // required
  private long customerId; // required
  private long customerEmailId; // required
  private long expiryTimestamp; // 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"),
    AMOUNT((short)2, "amount"),
    CREATING_TRANSACTION_ID((short)3, "creatingTransactionId"),
    CONSUMING_TRANSACTION_ID((short)4, "consumingTransactionId"),
    /**
     * 
     * @see RechargeCouponStatus
     */
    STATUS((short)5, "status"),
    COUPON_CODE((short)6, "couponCode"),
    CREATION_TIMESTAMP((short)7, "creationTimestamp"),
    CONSUMED_TIMESTAMP((short)8, "consumedTimestamp"),
    CUSTOMER_ID((short)9, "customerId"),
    CUSTOMER_EMAIL_ID((short)10, "customerEmailId"),
    EXPIRY_TIMESTAMP((short)11, "expiryTimestamp");

    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: // AMOUNT
          return AMOUNT;
        case 3: // CREATING_TRANSACTION_ID
          return CREATING_TRANSACTION_ID;
        case 4: // CONSUMING_TRANSACTION_ID
          return CONSUMING_TRANSACTION_ID;
        case 5: // STATUS
          return STATUS;
        case 6: // COUPON_CODE
          return COUPON_CODE;
        case 7: // CREATION_TIMESTAMP
          return CREATION_TIMESTAMP;
        case 8: // CONSUMED_TIMESTAMP
          return CONSUMED_TIMESTAMP;
        case 9: // CUSTOMER_ID
          return CUSTOMER_ID;
        case 10: // CUSTOMER_EMAIL_ID
          return CUSTOMER_EMAIL_ID;
        case 11: // EXPIRY_TIMESTAMP
          return EXPIRY_TIMESTAMP;
        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 __AMOUNT_ISSET_ID = 1;
  private static final int __CREATINGTRANSACTIONID_ISSET_ID = 2;
  private static final int __CONSUMINGTRANSACTIONID_ISSET_ID = 3;
  private static final int __CREATIONTIMESTAMP_ISSET_ID = 4;
  private static final int __CONSUMEDTIMESTAMP_ISSET_ID = 5;
  private static final int __CUSTOMERID_ISSET_ID = 6;
  private static final int __CUSTOMEREMAILID_ISSET_ID = 7;
  private static final int __EXPIRYTIMESTAMP_ISSET_ID = 8;
  private BitSet __isset_bit_vector = new BitSet(9);

  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.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.CREATING_TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("creatingTransactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CONSUMING_TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("consumingTransactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, RechargeCouponStatus.class)));
    tmpMap.put(_Fields.COUPON_CODE, new org.apache.thrift.meta_data.FieldMetaData("couponCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CREATION_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("creationTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CONSUMED_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("consumedTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CUSTOMER_ID, new org.apache.thrift.meta_data.FieldMetaData("customerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CUSTOMER_EMAIL_ID, new org.apache.thrift.meta_data.FieldMetaData("customerEmailId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.EXPIRY_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("expiryTimestamp", 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(RechargeCoupon.class, metaDataMap);
  }

  public RechargeCoupon() {
  }

  public RechargeCoupon(
    long id,
    long amount,
    long creatingTransactionId,
    long consumingTransactionId,
    RechargeCouponStatus status,
    String couponCode,
    long creationTimestamp,
    long consumedTimestamp,
    long customerId,
    long customerEmailId,
    long expiryTimestamp)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.amount = amount;
    setAmountIsSet(true);
    this.creatingTransactionId = creatingTransactionId;
    setCreatingTransactionIdIsSet(true);
    this.consumingTransactionId = consumingTransactionId;
    setConsumingTransactionIdIsSet(true);
    this.status = status;
    this.couponCode = couponCode;
    this.creationTimestamp = creationTimestamp;
    setCreationTimestampIsSet(true);
    this.consumedTimestamp = consumedTimestamp;
    setConsumedTimestampIsSet(true);
    this.customerId = customerId;
    setCustomerIdIsSet(true);
    this.customerEmailId = customerEmailId;
    setCustomerEmailIdIsSet(true);
    this.expiryTimestamp = expiryTimestamp;
    setExpiryTimestampIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public RechargeCoupon(RechargeCoupon other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.amount = other.amount;
    this.creatingTransactionId = other.creatingTransactionId;
    this.consumingTransactionId = other.consumingTransactionId;
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    if (other.isSetCouponCode()) {
      this.couponCode = other.couponCode;
    }
    this.creationTimestamp = other.creationTimestamp;
    this.consumedTimestamp = other.consumedTimestamp;
    this.customerId = other.customerId;
    this.customerEmailId = other.customerEmailId;
    this.expiryTimestamp = other.expiryTimestamp;
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setAmountIsSet(false);
    this.amount = 0;
    setCreatingTransactionIdIsSet(false);
    this.creatingTransactionId = 0;
    setConsumingTransactionIdIsSet(false);
    this.consumingTransactionId = 0;
    this.status = null;
    this.couponCode = null;
    setCreationTimestampIsSet(false);
    this.creationTimestamp = 0;
    setConsumedTimestampIsSet(false);
    this.consumedTimestamp = 0;
    setCustomerIdIsSet(false);
    this.customerId = 0;
    setCustomerEmailIdIsSet(false);
    this.customerEmailId = 0;
    setExpiryTimestampIsSet(false);
    this.expiryTimestamp = 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 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 long getCreatingTransactionId() {
    return this.creatingTransactionId;
  }

  public void setCreatingTransactionId(long creatingTransactionId) {
    this.creatingTransactionId = creatingTransactionId;
    setCreatingTransactionIdIsSet(true);
  }

  public void unsetCreatingTransactionId() {
    __isset_bit_vector.clear(__CREATINGTRANSACTIONID_ISSET_ID);
  }

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

  public void setCreatingTransactionIdIsSet(boolean value) {
    __isset_bit_vector.set(__CREATINGTRANSACTIONID_ISSET_ID, value);
  }

  public long getConsumingTransactionId() {
    return this.consumingTransactionId;
  }

  public void setConsumingTransactionId(long consumingTransactionId) {
    this.consumingTransactionId = consumingTransactionId;
    setConsumingTransactionIdIsSet(true);
  }

  public void unsetConsumingTransactionId() {
    __isset_bit_vector.clear(__CONSUMINGTRANSACTIONID_ISSET_ID);
  }

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

  public void setConsumingTransactionIdIsSet(boolean value) {
    __isset_bit_vector.set(__CONSUMINGTRANSACTIONID_ISSET_ID, value);
  }

  /**
   * 
   * @see RechargeCouponStatus
   */
  public RechargeCouponStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see RechargeCouponStatus
   */
  public void setStatus(RechargeCouponStatus status) {
    this.status = status;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public String getCouponCode() {
    return this.couponCode;
  }

  public void setCouponCode(String couponCode) {
    this.couponCode = couponCode;
  }

  public void unsetCouponCode() {
    this.couponCode = null;
  }

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

  public void setCouponCodeIsSet(boolean value) {
    if (!value) {
      this.couponCode = null;
    }
  }

  public long getCreationTimestamp() {
    return this.creationTimestamp;
  }

  public void setCreationTimestamp(long creationTimestamp) {
    this.creationTimestamp = creationTimestamp;
    setCreationTimestampIsSet(true);
  }

  public void unsetCreationTimestamp() {
    __isset_bit_vector.clear(__CREATIONTIMESTAMP_ISSET_ID);
  }

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

  public void setCreationTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__CREATIONTIMESTAMP_ISSET_ID, value);
  }

  public long getConsumedTimestamp() {
    return this.consumedTimestamp;
  }

  public void setConsumedTimestamp(long consumedTimestamp) {
    this.consumedTimestamp = consumedTimestamp;
    setConsumedTimestampIsSet(true);
  }

  public void unsetConsumedTimestamp() {
    __isset_bit_vector.clear(__CONSUMEDTIMESTAMP_ISSET_ID);
  }

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

  public void setConsumedTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__CONSUMEDTIMESTAMP_ISSET_ID, value);
  }

  public long getCustomerId() {
    return this.customerId;
  }

  public void setCustomerId(long customerId) {
    this.customerId = customerId;
    setCustomerIdIsSet(true);
  }

  public void unsetCustomerId() {
    __isset_bit_vector.clear(__CUSTOMERID_ISSET_ID);
  }

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

  public void setCustomerIdIsSet(boolean value) {
    __isset_bit_vector.set(__CUSTOMERID_ISSET_ID, value);
  }

  public long getCustomerEmailId() {
    return this.customerEmailId;
  }

  public void setCustomerEmailId(long customerEmailId) {
    this.customerEmailId = customerEmailId;
    setCustomerEmailIdIsSet(true);
  }

  public void unsetCustomerEmailId() {
    __isset_bit_vector.clear(__CUSTOMEREMAILID_ISSET_ID);
  }

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

  public void setCustomerEmailIdIsSet(boolean value) {
    __isset_bit_vector.set(__CUSTOMEREMAILID_ISSET_ID, value);
  }

  public long getExpiryTimestamp() {
    return this.expiryTimestamp;
  }

  public void setExpiryTimestamp(long expiryTimestamp) {
    this.expiryTimestamp = expiryTimestamp;
    setExpiryTimestampIsSet(true);
  }

  public void unsetExpiryTimestamp() {
    __isset_bit_vector.clear(__EXPIRYTIMESTAMP_ISSET_ID);
  }

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

  public void setExpiryTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__EXPIRYTIMESTAMP_ISSET_ID, value);
  }

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

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

    case CREATING_TRANSACTION_ID:
      if (value == null) {
        unsetCreatingTransactionId();
      } else {
        setCreatingTransactionId((Long)value);
      }
      break;

    case CONSUMING_TRANSACTION_ID:
      if (value == null) {
        unsetConsumingTransactionId();
      } else {
        setConsumingTransactionId((Long)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((RechargeCouponStatus)value);
      }
      break;

    case COUPON_CODE:
      if (value == null) {
        unsetCouponCode();
      } else {
        setCouponCode((String)value);
      }
      break;

    case CREATION_TIMESTAMP:
      if (value == null) {
        unsetCreationTimestamp();
      } else {
        setCreationTimestamp((Long)value);
      }
      break;

    case CONSUMED_TIMESTAMP:
      if (value == null) {
        unsetConsumedTimestamp();
      } else {
        setConsumedTimestamp((Long)value);
      }
      break;

    case CUSTOMER_ID:
      if (value == null) {
        unsetCustomerId();
      } else {
        setCustomerId((Long)value);
      }
      break;

    case CUSTOMER_EMAIL_ID:
      if (value == null) {
        unsetCustomerEmailId();
      } else {
        setCustomerEmailId((Long)value);
      }
      break;

    case EXPIRY_TIMESTAMP:
      if (value == null) {
        unsetExpiryTimestamp();
      } else {
        setExpiryTimestamp((Long)value);
      }
      break;

    }
  }

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

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

    case CREATING_TRANSACTION_ID:
      return Long.valueOf(getCreatingTransactionId());

    case CONSUMING_TRANSACTION_ID:
      return Long.valueOf(getConsumingTransactionId());

    case STATUS:
      return getStatus();

    case COUPON_CODE:
      return getCouponCode();

    case CREATION_TIMESTAMP:
      return Long.valueOf(getCreationTimestamp());

    case CONSUMED_TIMESTAMP:
      return Long.valueOf(getConsumedTimestamp());

    case CUSTOMER_ID:
      return Long.valueOf(getCustomerId());

    case CUSTOMER_EMAIL_ID:
      return Long.valueOf(getCustomerEmailId());

    case EXPIRY_TIMESTAMP:
      return Long.valueOf(getExpiryTimestamp());

    }
    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 AMOUNT:
      return isSetAmount();
    case CREATING_TRANSACTION_ID:
      return isSetCreatingTransactionId();
    case CONSUMING_TRANSACTION_ID:
      return isSetConsumingTransactionId();
    case STATUS:
      return isSetStatus();
    case COUPON_CODE:
      return isSetCouponCode();
    case CREATION_TIMESTAMP:
      return isSetCreationTimestamp();
    case CONSUMED_TIMESTAMP:
      return isSetConsumedTimestamp();
    case CUSTOMER_ID:
      return isSetCustomerId();
    case CUSTOMER_EMAIL_ID:
      return isSetCustomerEmailId();
    case EXPIRY_TIMESTAMP:
      return isSetExpiryTimestamp();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(RechargeCoupon 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_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_creatingTransactionId = true;
    boolean that_present_creatingTransactionId = true;
    if (this_present_creatingTransactionId || that_present_creatingTransactionId) {
      if (!(this_present_creatingTransactionId && that_present_creatingTransactionId))
        return false;
      if (this.creatingTransactionId != that.creatingTransactionId)
        return false;
    }

    boolean this_present_consumingTransactionId = true;
    boolean that_present_consumingTransactionId = true;
    if (this_present_consumingTransactionId || that_present_consumingTransactionId) {
      if (!(this_present_consumingTransactionId && that_present_consumingTransactionId))
        return false;
      if (this.consumingTransactionId != that.consumingTransactionId)
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_couponCode = true && this.isSetCouponCode();
    boolean that_present_couponCode = true && that.isSetCouponCode();
    if (this_present_couponCode || that_present_couponCode) {
      if (!(this_present_couponCode && that_present_couponCode))
        return false;
      if (!this.couponCode.equals(that.couponCode))
        return false;
    }

    boolean this_present_creationTimestamp = true;
    boolean that_present_creationTimestamp = true;
    if (this_present_creationTimestamp || that_present_creationTimestamp) {
      if (!(this_present_creationTimestamp && that_present_creationTimestamp))
        return false;
      if (this.creationTimestamp != that.creationTimestamp)
        return false;
    }

    boolean this_present_consumedTimestamp = true;
    boolean that_present_consumedTimestamp = true;
    if (this_present_consumedTimestamp || that_present_consumedTimestamp) {
      if (!(this_present_consumedTimestamp && that_present_consumedTimestamp))
        return false;
      if (this.consumedTimestamp != that.consumedTimestamp)
        return false;
    }

    boolean this_present_customerId = true;
    boolean that_present_customerId = true;
    if (this_present_customerId || that_present_customerId) {
      if (!(this_present_customerId && that_present_customerId))
        return false;
      if (this.customerId != that.customerId)
        return false;
    }

    boolean this_present_customerEmailId = true;
    boolean that_present_customerEmailId = true;
    if (this_present_customerEmailId || that_present_customerEmailId) {
      if (!(this_present_customerEmailId && that_present_customerEmailId))
        return false;
      if (this.customerEmailId != that.customerEmailId)
        return false;
    }

    boolean this_present_expiryTimestamp = true;
    boolean that_present_expiryTimestamp = true;
    if (this_present_expiryTimestamp || that_present_expiryTimestamp) {
      if (!(this_present_expiryTimestamp && that_present_expiryTimestamp))
        return false;
      if (this.expiryTimestamp != that.expiryTimestamp)
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    RechargeCoupon typedOther = (RechargeCoupon)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(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(isSetCreatingTransactionId()).compareTo(typedOther.isSetCreatingTransactionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreatingTransactionId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creatingTransactionId, typedOther.creatingTransactionId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetConsumingTransactionId()).compareTo(typedOther.isSetConsumingTransactionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConsumingTransactionId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consumingTransactionId, typedOther.consumingTransactionId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCouponCode()).compareTo(typedOther.isSetCouponCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCouponCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.couponCode, typedOther.couponCode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreationTimestamp()).compareTo(typedOther.isSetCreationTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreationTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creationTimestamp, typedOther.creationTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetConsumedTimestamp()).compareTo(typedOther.isSetConsumedTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConsumedTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consumedTimestamp, typedOther.consumedTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCustomerId()).compareTo(typedOther.isSetCustomerId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCustomerId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.customerId, typedOther.customerId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCustomerEmailId()).compareTo(typedOther.isSetCustomerEmailId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCustomerEmailId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.customerEmailId, typedOther.customerEmailId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpiryTimestamp()).compareTo(typedOther.isSetExpiryTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpiryTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expiryTimestamp, typedOther.expiryTimestamp);
      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: // 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 3: // CREATING_TRANSACTION_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.creatingTransactionId = iprot.readI64();
            setCreatingTransactionIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CONSUMING_TRANSACTION_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.consumingTransactionId = iprot.readI64();
            setConsumingTransactionIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // STATUS
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.status = RechargeCouponStatus.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // COUPON_CODE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.couponCode = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // CREATION_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.creationTimestamp = iprot.readI64();
            setCreationTimestampIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // CONSUMED_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.consumedTimestamp = iprot.readI64();
            setConsumedTimestampIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // CUSTOMER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.customerId = iprot.readI64();
            setCustomerIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // CUSTOMER_EMAIL_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.customerEmailId = iprot.readI64();
            setCustomerEmailIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // EXPIRY_TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.expiryTimestamp = iprot.readI64();
            setExpiryTimestampIsSet(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(AMOUNT_FIELD_DESC);
    oprot.writeI64(this.amount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATING_TRANSACTION_ID_FIELD_DESC);
    oprot.writeI64(this.creatingTransactionId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CONSUMING_TRANSACTION_ID_FIELD_DESC);
    oprot.writeI64(this.consumingTransactionId);
    oprot.writeFieldEnd();
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    if (this.couponCode != null) {
      oprot.writeFieldBegin(COUPON_CODE_FIELD_DESC);
      oprot.writeString(this.couponCode);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATION_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.creationTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CONSUMED_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.consumedTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CUSTOMER_ID_FIELD_DESC);
    oprot.writeI64(this.customerId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CUSTOMER_EMAIL_ID_FIELD_DESC);
    oprot.writeI64(this.customerEmailId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EXPIRY_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.expiryTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("creatingTransactionId:");
    sb.append(this.creatingTransactionId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("consumingTransactionId:");
    sb.append(this.consumingTransactionId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("couponCode:");
    if (this.couponCode == null) {
      sb.append("null");
    } else {
      sb.append(this.couponCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("creationTimestamp:");
    sb.append(this.creationTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("consumedTimestamp:");
    sb.append(this.consumedTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("customerId:");
    sb.append(this.customerId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("customerEmailId:");
    sb.append(this.customerEmailId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("expiryTimestamp:");
    sb.append(this.expiryTimestamp);
    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);
    }
  }

}