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.user;

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

  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 VOUCHER_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherCode", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField VOUCHER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("voucherType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField ISSUED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("issuedOn", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField EXPIRED_ON_FIELD_DESC = new org.apache.thrift.protocol.TField("expiredOn", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField USER_EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("userEmail", org.apache.thrift.protocol.TType.STRING, (short)7);

  private long id; // required
  private String voucherCode; // required
  private VoucherType voucherType; // required
  private long issuedOn; // required
  private double amount; // required
  private long expiredOn; // required
  private String userEmail; // 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"),
    VOUCHER_CODE((short)2, "voucherCode"),
    /**
     * 
     * @see VoucherType
     */
    VOUCHER_TYPE((short)3, "voucherType"),
    ISSUED_ON((short)4, "issuedOn"),
    AMOUNT((short)5, "amount"),
    EXPIRED_ON((short)6, "expiredOn"),
    USER_EMAIL((short)7, "userEmail");

    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: // VOUCHER_CODE
          return VOUCHER_CODE;
        case 3: // VOUCHER_TYPE
          return VOUCHER_TYPE;
        case 4: // ISSUED_ON
          return ISSUED_ON;
        case 5: // AMOUNT
          return AMOUNT;
        case 6: // EXPIRED_ON
          return EXPIRED_ON;
        case 7: // USER_EMAIL
          return USER_EMAIL;
        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 __ISSUEDON_ISSET_ID = 1;
  private static final int __AMOUNT_ISSET_ID = 2;
  private static final int __EXPIREDON_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  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.VOUCHER_CODE, new org.apache.thrift.meta_data.FieldMetaData("voucherCode", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VOUCHER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("voucherType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, VoucherType.class)));
    tmpMap.put(_Fields.ISSUED_ON, new org.apache.thrift.meta_data.FieldMetaData("issuedOn", 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.DOUBLE)));
    tmpMap.put(_Fields.EXPIRED_ON, new org.apache.thrift.meta_data.FieldMetaData("expiredOn", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.USER_EMAIL, new org.apache.thrift.meta_data.FieldMetaData("userEmail", 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(Voucher.class, metaDataMap);
  }

  public Voucher() {
  }

  public Voucher(
    long id,
    String voucherCode,
    VoucherType voucherType,
    long issuedOn,
    double amount,
    long expiredOn,
    String userEmail)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.voucherCode = voucherCode;
    this.voucherType = voucherType;
    this.issuedOn = issuedOn;
    setIssuedOnIsSet(true);
    this.amount = amount;
    setAmountIsSet(true);
    this.expiredOn = expiredOn;
    setExpiredOnIsSet(true);
    this.userEmail = userEmail;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Voucher(Voucher other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetVoucherCode()) {
      this.voucherCode = other.voucherCode;
    }
    if (other.isSetVoucherType()) {
      this.voucherType = other.voucherType;
    }
    this.issuedOn = other.issuedOn;
    this.amount = other.amount;
    this.expiredOn = other.expiredOn;
    if (other.isSetUserEmail()) {
      this.userEmail = other.userEmail;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.voucherCode = null;
    this.voucherType = null;
    setIssuedOnIsSet(false);
    this.issuedOn = 0;
    setAmountIsSet(false);
    this.amount = 0.0;
    setExpiredOnIsSet(false);
    this.expiredOn = 0;
    this.userEmail = null;
  }

  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 String getVoucherCode() {
    return this.voucherCode;
  }

  public void setVoucherCode(String voucherCode) {
    this.voucherCode = voucherCode;
  }

  public void unsetVoucherCode() {
    this.voucherCode = null;
  }

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

  public void setVoucherCodeIsSet(boolean value) {
    if (!value) {
      this.voucherCode = null;
    }
  }

  /**
   * 
   * @see VoucherType
   */
  public VoucherType getVoucherType() {
    return this.voucherType;
  }

  /**
   * 
   * @see VoucherType
   */
  public void setVoucherType(VoucherType voucherType) {
    this.voucherType = voucherType;
  }

  public void unsetVoucherType() {
    this.voucherType = null;
  }

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

  public void setVoucherTypeIsSet(boolean value) {
    if (!value) {
      this.voucherType = null;
    }
  }

  public long getIssuedOn() {
    return this.issuedOn;
  }

  public void setIssuedOn(long issuedOn) {
    this.issuedOn = issuedOn;
    setIssuedOnIsSet(true);
  }

  public void unsetIssuedOn() {
    __isset_bit_vector.clear(__ISSUEDON_ISSET_ID);
  }

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

  public void setIssuedOnIsSet(boolean value) {
    __isset_bit_vector.set(__ISSUEDON_ISSET_ID, value);
  }

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

  public void setAmount(double 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 getExpiredOn() {
    return this.expiredOn;
  }

  public void setExpiredOn(long expiredOn) {
    this.expiredOn = expiredOn;
    setExpiredOnIsSet(true);
  }

  public void unsetExpiredOn() {
    __isset_bit_vector.clear(__EXPIREDON_ISSET_ID);
  }

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

  public void setExpiredOnIsSet(boolean value) {
    __isset_bit_vector.set(__EXPIREDON_ISSET_ID, value);
  }

  public String getUserEmail() {
    return this.userEmail;
  }

  public void setUserEmail(String userEmail) {
    this.userEmail = userEmail;
  }

  public void unsetUserEmail() {
    this.userEmail = null;
  }

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

  public void setUserEmailIsSet(boolean value) {
    if (!value) {
      this.userEmail = null;
    }
  }

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

    case VOUCHER_CODE:
      if (value == null) {
        unsetVoucherCode();
      } else {
        setVoucherCode((String)value);
      }
      break;

    case VOUCHER_TYPE:
      if (value == null) {
        unsetVoucherType();
      } else {
        setVoucherType((VoucherType)value);
      }
      break;

    case ISSUED_ON:
      if (value == null) {
        unsetIssuedOn();
      } else {
        setIssuedOn((Long)value);
      }
      break;

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

    case EXPIRED_ON:
      if (value == null) {
        unsetExpiredOn();
      } else {
        setExpiredOn((Long)value);
      }
      break;

    case USER_EMAIL:
      if (value == null) {
        unsetUserEmail();
      } else {
        setUserEmail((String)value);
      }
      break;

    }
  }

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

    case VOUCHER_CODE:
      return getVoucherCode();

    case VOUCHER_TYPE:
      return getVoucherType();

    case ISSUED_ON:
      return Long.valueOf(getIssuedOn());

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

    case EXPIRED_ON:
      return Long.valueOf(getExpiredOn());

    case USER_EMAIL:
      return getUserEmail();

    }
    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 VOUCHER_CODE:
      return isSetVoucherCode();
    case VOUCHER_TYPE:
      return isSetVoucherType();
    case ISSUED_ON:
      return isSetIssuedOn();
    case AMOUNT:
      return isSetAmount();
    case EXPIRED_ON:
      return isSetExpiredOn();
    case USER_EMAIL:
      return isSetUserEmail();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(Voucher 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_voucherCode = true && this.isSetVoucherCode();
    boolean that_present_voucherCode = true && that.isSetVoucherCode();
    if (this_present_voucherCode || that_present_voucherCode) {
      if (!(this_present_voucherCode && that_present_voucherCode))
        return false;
      if (!this.voucherCode.equals(that.voucherCode))
        return false;
    }

    boolean this_present_voucherType = true && this.isSetVoucherType();
    boolean that_present_voucherType = true && that.isSetVoucherType();
    if (this_present_voucherType || that_present_voucherType) {
      if (!(this_present_voucherType && that_present_voucherType))
        return false;
      if (!this.voucherType.equals(that.voucherType))
        return false;
    }

    boolean this_present_issuedOn = true;
    boolean that_present_issuedOn = true;
    if (this_present_issuedOn || that_present_issuedOn) {
      if (!(this_present_issuedOn && that_present_issuedOn))
        return false;
      if (this.issuedOn != that.issuedOn)
        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_expiredOn = true;
    boolean that_present_expiredOn = true;
    if (this_present_expiredOn || that_present_expiredOn) {
      if (!(this_present_expiredOn && that_present_expiredOn))
        return false;
      if (this.expiredOn != that.expiredOn)
        return false;
    }

    boolean this_present_userEmail = true && this.isSetUserEmail();
    boolean that_present_userEmail = true && that.isSetUserEmail();
    if (this_present_userEmail || that_present_userEmail) {
      if (!(this_present_userEmail && that_present_userEmail))
        return false;
      if (!this.userEmail.equals(that.userEmail))
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    Voucher typedOther = (Voucher)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(isSetVoucherCode()).compareTo(typedOther.isSetVoucherCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVoucherCode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.voucherCode, typedOther.voucherCode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetVoucherType()).compareTo(typedOther.isSetVoucherType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVoucherType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.voucherType, typedOther.voucherType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIssuedOn()).compareTo(typedOther.isSetIssuedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIssuedOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuedOn, typedOther.issuedOn);
      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(isSetExpiredOn()).compareTo(typedOther.isSetExpiredOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpiredOn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expiredOn, typedOther.expiredOn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserEmail()).compareTo(typedOther.isSetUserEmail());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserEmail()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userEmail, typedOther.userEmail);
      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: // VOUCHER_CODE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.voucherCode = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // VOUCHER_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.voucherType = VoucherType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ISSUED_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.issuedOn = iprot.readI64();
            setIssuedOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.amount = iprot.readDouble();
            setAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // EXPIRED_ON
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.expiredOn = iprot.readI64();
            setExpiredOnIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // USER_EMAIL
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.userEmail = 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(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.voucherCode != null) {
      oprot.writeFieldBegin(VOUCHER_CODE_FIELD_DESC);
      oprot.writeString(this.voucherCode);
      oprot.writeFieldEnd();
    }
    if (this.voucherType != null) {
      oprot.writeFieldBegin(VOUCHER_TYPE_FIELD_DESC);
      oprot.writeI32(this.voucherType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ISSUED_ON_FIELD_DESC);
    oprot.writeI64(this.issuedOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.amount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EXPIRED_ON_FIELD_DESC);
    oprot.writeI64(this.expiredOn);
    oprot.writeFieldEnd();
    if (this.userEmail != null) {
      oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC);
      oprot.writeString(this.userEmail);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("voucherCode:");
    if (this.voucherCode == null) {
      sb.append("null");
    } else {
      sb.append(this.voucherCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("voucherType:");
    if (this.voucherType == null) {
      sb.append("null");
    } else {
      sb.append(this.voucherType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("issuedOn:");
    sb.append(this.issuedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("expiredOn:");
    sb.append(this.expiredOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("userEmail:");
    if (this.userEmail == null) {
      sb.append("null");
    } else {
      sb.append(this.userEmail);
    }
    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);
    }
  }

}