Subversion Repositories SmartDukaan

Rev

Rev 11580 | 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.catalog;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PrivateDeal implements org.apache.thrift.TBase<PrivateDeal, PrivateDeal._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PrivateDeal");

  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("item_id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField DEAL_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("dealPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)2);
  private static final org.apache.thrift.protocol.TField DEAL_FREEBIE_ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("dealFreebieItemId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField START_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("startDate", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField END_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("endDate", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField DEAL_TEXT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("dealTextOption", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField DEAL_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("dealText", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField IS_COD_FIELD_DESC = new org.apache.thrift.protocol.TField("isCod", org.apache.thrift.protocol.TType.BOOL, (short)8);
  private static final org.apache.thrift.protocol.TField RANK_FIELD_DESC = new org.apache.thrift.protocol.TField("rank", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField DEAL_FREEBIE_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("dealFreebieOption", org.apache.thrift.protocol.TType.I64, (short)10);
  private static final org.apache.thrift.protocol.TField IS_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("isActive", org.apache.thrift.protocol.TType.BOOL, (short)11);

  private long item_id; // required
  private double dealPrice; // required
  private long dealFreebieItemId; // required
  private long startDate; // required
  private long endDate; // required
  private long dealTextOption; // required
  private String dealText; // required
  private boolean isCod; // required
  private long rank; // required
  private long dealFreebieOption; // required
  private boolean isActive; // 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 {
    ITEM_ID((short)1, "item_id"),
    DEAL_PRICE((short)2, "dealPrice"),
    DEAL_FREEBIE_ITEM_ID((short)3, "dealFreebieItemId"),
    START_DATE((short)4, "startDate"),
    END_DATE((short)5, "endDate"),
    DEAL_TEXT_OPTION((short)6, "dealTextOption"),
    DEAL_TEXT((short)7, "dealText"),
    IS_COD((short)8, "isCod"),
    RANK((short)9, "rank"),
    DEAL_FREEBIE_OPTION((short)10, "dealFreebieOption"),
    IS_ACTIVE((short)11, "isActive");

    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: // ITEM_ID
          return ITEM_ID;
        case 2: // DEAL_PRICE
          return DEAL_PRICE;
        case 3: // DEAL_FREEBIE_ITEM_ID
          return DEAL_FREEBIE_ITEM_ID;
        case 4: // START_DATE
          return START_DATE;
        case 5: // END_DATE
          return END_DATE;
        case 6: // DEAL_TEXT_OPTION
          return DEAL_TEXT_OPTION;
        case 7: // DEAL_TEXT
          return DEAL_TEXT;
        case 8: // IS_COD
          return IS_COD;
        case 9: // RANK
          return RANK;
        case 10: // DEAL_FREEBIE_OPTION
          return DEAL_FREEBIE_OPTION;
        case 11: // IS_ACTIVE
          return IS_ACTIVE;
        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 __ITEM_ID_ISSET_ID = 0;
  private static final int __DEALPRICE_ISSET_ID = 1;
  private static final int __DEALFREEBIEITEMID_ISSET_ID = 2;
  private static final int __STARTDATE_ISSET_ID = 3;
  private static final int __ENDDATE_ISSET_ID = 4;
  private static final int __DEALTEXTOPTION_ISSET_ID = 5;
  private static final int __ISCOD_ISSET_ID = 6;
  private static final int __RANK_ISSET_ID = 7;
  private static final int __DEALFREEBIEOPTION_ISSET_ID = 8;
  private static final int __ISACTIVE_ISSET_ID = 9;
  private BitSet __isset_bit_vector = new BitSet(10);

  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.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DEAL_PRICE, new org.apache.thrift.meta_data.FieldMetaData("dealPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.DEAL_FREEBIE_ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("dealFreebieItemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.START_DATE, new org.apache.thrift.meta_data.FieldMetaData("startDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.END_DATE, new org.apache.thrift.meta_data.FieldMetaData("endDate", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DEAL_TEXT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("dealTextOption", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DEAL_TEXT, new org.apache.thrift.meta_data.FieldMetaData("dealText", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IS_COD, new org.apache.thrift.meta_data.FieldMetaData("isCod", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.RANK, new org.apache.thrift.meta_data.FieldMetaData("rank", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DEAL_FREEBIE_OPTION, new org.apache.thrift.meta_data.FieldMetaData("dealFreebieOption", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IS_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("isActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PrivateDeal.class, metaDataMap);
  }

  public PrivateDeal() {
  }

  public PrivateDeal(
    long item_id,
    double dealPrice,
    long dealFreebieItemId,
    long startDate,
    long endDate,
    long dealTextOption,
    String dealText,
    boolean isCod,
    long rank,
    long dealFreebieOption,
    boolean isActive)
  {
    this();
    this.item_id = item_id;
    setItem_idIsSet(true);
    this.dealPrice = dealPrice;
    setDealPriceIsSet(true);
    this.dealFreebieItemId = dealFreebieItemId;
    setDealFreebieItemIdIsSet(true);
    this.startDate = startDate;
    setStartDateIsSet(true);
    this.endDate = endDate;
    setEndDateIsSet(true);
    this.dealTextOption = dealTextOption;
    setDealTextOptionIsSet(true);
    this.dealText = dealText;
    this.isCod = isCod;
    setIsCodIsSet(true);
    this.rank = rank;
    setRankIsSet(true);
    this.dealFreebieOption = dealFreebieOption;
    setDealFreebieOptionIsSet(true);
    this.isActive = isActive;
    setIsActiveIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public PrivateDeal(PrivateDeal other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.item_id = other.item_id;
    this.dealPrice = other.dealPrice;
    this.dealFreebieItemId = other.dealFreebieItemId;
    this.startDate = other.startDate;
    this.endDate = other.endDate;
    this.dealTextOption = other.dealTextOption;
    if (other.isSetDealText()) {
      this.dealText = other.dealText;
    }
    this.isCod = other.isCod;
    this.rank = other.rank;
    this.dealFreebieOption = other.dealFreebieOption;
    this.isActive = other.isActive;
  }

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

  @Override
  public void clear() {
    setItem_idIsSet(false);
    this.item_id = 0;
    setDealPriceIsSet(false);
    this.dealPrice = 0.0;
    setDealFreebieItemIdIsSet(false);
    this.dealFreebieItemId = 0;
    setStartDateIsSet(false);
    this.startDate = 0;
    setEndDateIsSet(false);
    this.endDate = 0;
    setDealTextOptionIsSet(false);
    this.dealTextOption = 0;
    this.dealText = null;
    setIsCodIsSet(false);
    this.isCod = false;
    setRankIsSet(false);
    this.rank = 0;
    setDealFreebieOptionIsSet(false);
    this.dealFreebieOption = 0;
    setIsActiveIsSet(false);
    this.isActive = false;
  }

  public long getItem_id() {
    return this.item_id;
  }

  public void setItem_id(long item_id) {
    this.item_id = item_id;
    setItem_idIsSet(true);
  }

  public void unsetItem_id() {
    __isset_bit_vector.clear(__ITEM_ID_ISSET_ID);
  }

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

  public void setItem_idIsSet(boolean value) {
    __isset_bit_vector.set(__ITEM_ID_ISSET_ID, value);
  }

  public double getDealPrice() {
    return this.dealPrice;
  }

  public void setDealPrice(double dealPrice) {
    this.dealPrice = dealPrice;
    setDealPriceIsSet(true);
  }

  public void unsetDealPrice() {
    __isset_bit_vector.clear(__DEALPRICE_ISSET_ID);
  }

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

  public void setDealPriceIsSet(boolean value) {
    __isset_bit_vector.set(__DEALPRICE_ISSET_ID, value);
  }

  public long getDealFreebieItemId() {
    return this.dealFreebieItemId;
  }

  public void setDealFreebieItemId(long dealFreebieItemId) {
    this.dealFreebieItemId = dealFreebieItemId;
    setDealFreebieItemIdIsSet(true);
  }

  public void unsetDealFreebieItemId() {
    __isset_bit_vector.clear(__DEALFREEBIEITEMID_ISSET_ID);
  }

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

  public void setDealFreebieItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__DEALFREEBIEITEMID_ISSET_ID, value);
  }

  public long getStartDate() {
    return this.startDate;
  }

  public void setStartDate(long startDate) {
    this.startDate = startDate;
    setStartDateIsSet(true);
  }

  public void unsetStartDate() {
    __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
  }

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

  public void setStartDateIsSet(boolean value) {
    __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
  }

  public long getEndDate() {
    return this.endDate;
  }

  public void setEndDate(long endDate) {
    this.endDate = endDate;
    setEndDateIsSet(true);
  }

  public void unsetEndDate() {
    __isset_bit_vector.clear(__ENDDATE_ISSET_ID);
  }

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

  public void setEndDateIsSet(boolean value) {
    __isset_bit_vector.set(__ENDDATE_ISSET_ID, value);
  }

  public long getDealTextOption() {
    return this.dealTextOption;
  }

  public void setDealTextOption(long dealTextOption) {
    this.dealTextOption = dealTextOption;
    setDealTextOptionIsSet(true);
  }

  public void unsetDealTextOption() {
    __isset_bit_vector.clear(__DEALTEXTOPTION_ISSET_ID);
  }

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

  public void setDealTextOptionIsSet(boolean value) {
    __isset_bit_vector.set(__DEALTEXTOPTION_ISSET_ID, value);
  }

  public String getDealText() {
    return this.dealText;
  }

  public void setDealText(String dealText) {
    this.dealText = dealText;
  }

  public void unsetDealText() {
    this.dealText = null;
  }

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

  public void setDealTextIsSet(boolean value) {
    if (!value) {
      this.dealText = null;
    }
  }

  public boolean isIsCod() {
    return this.isCod;
  }

  public void setIsCod(boolean isCod) {
    this.isCod = isCod;
    setIsCodIsSet(true);
  }

  public void unsetIsCod() {
    __isset_bit_vector.clear(__ISCOD_ISSET_ID);
  }

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

  public void setIsCodIsSet(boolean value) {
    __isset_bit_vector.set(__ISCOD_ISSET_ID, value);
  }

  public long getRank() {
    return this.rank;
  }

  public void setRank(long rank) {
    this.rank = rank;
    setRankIsSet(true);
  }

  public void unsetRank() {
    __isset_bit_vector.clear(__RANK_ISSET_ID);
  }

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

  public void setRankIsSet(boolean value) {
    __isset_bit_vector.set(__RANK_ISSET_ID, value);
  }

  public long getDealFreebieOption() {
    return this.dealFreebieOption;
  }

  public void setDealFreebieOption(long dealFreebieOption) {
    this.dealFreebieOption = dealFreebieOption;
    setDealFreebieOptionIsSet(true);
  }

  public void unsetDealFreebieOption() {
    __isset_bit_vector.clear(__DEALFREEBIEOPTION_ISSET_ID);
  }

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

  public void setDealFreebieOptionIsSet(boolean value) {
    __isset_bit_vector.set(__DEALFREEBIEOPTION_ISSET_ID, value);
  }

  public boolean isIsActive() {
    return this.isActive;
  }

  public void setIsActive(boolean isActive) {
    this.isActive = isActive;
    setIsActiveIsSet(true);
  }

  public void unsetIsActive() {
    __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
  }

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

  public void setIsActiveIsSet(boolean value) {
    __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ITEM_ID:
      if (value == null) {
        unsetItem_id();
      } else {
        setItem_id((Long)value);
      }
      break;

    case DEAL_PRICE:
      if (value == null) {
        unsetDealPrice();
      } else {
        setDealPrice((Double)value);
      }
      break;

    case DEAL_FREEBIE_ITEM_ID:
      if (value == null) {
        unsetDealFreebieItemId();
      } else {
        setDealFreebieItemId((Long)value);
      }
      break;

    case START_DATE:
      if (value == null) {
        unsetStartDate();
      } else {
        setStartDate((Long)value);
      }
      break;

    case END_DATE:
      if (value == null) {
        unsetEndDate();
      } else {
        setEndDate((Long)value);
      }
      break;

    case DEAL_TEXT_OPTION:
      if (value == null) {
        unsetDealTextOption();
      } else {
        setDealTextOption((Long)value);
      }
      break;

    case DEAL_TEXT:
      if (value == null) {
        unsetDealText();
      } else {
        setDealText((String)value);
      }
      break;

    case IS_COD:
      if (value == null) {
        unsetIsCod();
      } else {
        setIsCod((Boolean)value);
      }
      break;

    case RANK:
      if (value == null) {
        unsetRank();
      } else {
        setRank((Long)value);
      }
      break;

    case DEAL_FREEBIE_OPTION:
      if (value == null) {
        unsetDealFreebieOption();
      } else {
        setDealFreebieOption((Long)value);
      }
      break;

    case IS_ACTIVE:
      if (value == null) {
        unsetIsActive();
      } else {
        setIsActive((Boolean)value);
      }
      break;

    }
  }

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

    case DEAL_PRICE:
      return Double.valueOf(getDealPrice());

    case DEAL_FREEBIE_ITEM_ID:
      return Long.valueOf(getDealFreebieItemId());

    case START_DATE:
      return Long.valueOf(getStartDate());

    case END_DATE:
      return Long.valueOf(getEndDate());

    case DEAL_TEXT_OPTION:
      return Long.valueOf(getDealTextOption());

    case DEAL_TEXT:
      return getDealText();

    case IS_COD:
      return Boolean.valueOf(isIsCod());

    case RANK:
      return Long.valueOf(getRank());

    case DEAL_FREEBIE_OPTION:
      return Long.valueOf(getDealFreebieOption());

    case IS_ACTIVE:
      return Boolean.valueOf(isIsActive());

    }
    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 ITEM_ID:
      return isSetItem_id();
    case DEAL_PRICE:
      return isSetDealPrice();
    case DEAL_FREEBIE_ITEM_ID:
      return isSetDealFreebieItemId();
    case START_DATE:
      return isSetStartDate();
    case END_DATE:
      return isSetEndDate();
    case DEAL_TEXT_OPTION:
      return isSetDealTextOption();
    case DEAL_TEXT:
      return isSetDealText();
    case IS_COD:
      return isSetIsCod();
    case RANK:
      return isSetRank();
    case DEAL_FREEBIE_OPTION:
      return isSetDealFreebieOption();
    case IS_ACTIVE:
      return isSetIsActive();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_item_id = true;
    boolean that_present_item_id = true;
    if (this_present_item_id || that_present_item_id) {
      if (!(this_present_item_id && that_present_item_id))
        return false;
      if (this.item_id != that.item_id)
        return false;
    }

    boolean this_present_dealPrice = true;
    boolean that_present_dealPrice = true;
    if (this_present_dealPrice || that_present_dealPrice) {
      if (!(this_present_dealPrice && that_present_dealPrice))
        return false;
      if (this.dealPrice != that.dealPrice)
        return false;
    }

    boolean this_present_dealFreebieItemId = true;
    boolean that_present_dealFreebieItemId = true;
    if (this_present_dealFreebieItemId || that_present_dealFreebieItemId) {
      if (!(this_present_dealFreebieItemId && that_present_dealFreebieItemId))
        return false;
      if (this.dealFreebieItemId != that.dealFreebieItemId)
        return false;
    }

    boolean this_present_startDate = true;
    boolean that_present_startDate = true;
    if (this_present_startDate || that_present_startDate) {
      if (!(this_present_startDate && that_present_startDate))
        return false;
      if (this.startDate != that.startDate)
        return false;
    }

    boolean this_present_endDate = true;
    boolean that_present_endDate = true;
    if (this_present_endDate || that_present_endDate) {
      if (!(this_present_endDate && that_present_endDate))
        return false;
      if (this.endDate != that.endDate)
        return false;
    }

    boolean this_present_dealTextOption = true;
    boolean that_present_dealTextOption = true;
    if (this_present_dealTextOption || that_present_dealTextOption) {
      if (!(this_present_dealTextOption && that_present_dealTextOption))
        return false;
      if (this.dealTextOption != that.dealTextOption)
        return false;
    }

    boolean this_present_dealText = true && this.isSetDealText();
    boolean that_present_dealText = true && that.isSetDealText();
    if (this_present_dealText || that_present_dealText) {
      if (!(this_present_dealText && that_present_dealText))
        return false;
      if (!this.dealText.equals(that.dealText))
        return false;
    }

    boolean this_present_isCod = true;
    boolean that_present_isCod = true;
    if (this_present_isCod || that_present_isCod) {
      if (!(this_present_isCod && that_present_isCod))
        return false;
      if (this.isCod != that.isCod)
        return false;
    }

    boolean this_present_rank = true;
    boolean that_present_rank = true;
    if (this_present_rank || that_present_rank) {
      if (!(this_present_rank && that_present_rank))
        return false;
      if (this.rank != that.rank)
        return false;
    }

    boolean this_present_dealFreebieOption = true;
    boolean that_present_dealFreebieOption = true;
    if (this_present_dealFreebieOption || that_present_dealFreebieOption) {
      if (!(this_present_dealFreebieOption && that_present_dealFreebieOption))
        return false;
      if (this.dealFreebieOption != that.dealFreebieOption)
        return false;
    }

    boolean this_present_isActive = true;
    boolean that_present_isActive = true;
    if (this_present_isActive || that_present_isActive) {
      if (!(this_present_isActive && that_present_isActive))
        return false;
      if (this.isActive != that.isActive)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetItem_id()).compareTo(typedOther.isSetItem_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItem_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.item_id, typedOther.item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealPrice()).compareTo(typedOther.isSetDealPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealPrice, typedOther.dealPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealFreebieItemId()).compareTo(typedOther.isSetDealFreebieItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealFreebieItemId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealFreebieItemId, typedOther.dealFreebieItemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStartDate()).compareTo(typedOther.isSetStartDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startDate, typedOther.startDate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEndDate()).compareTo(typedOther.isSetEndDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endDate, typedOther.endDate);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealTextOption()).compareTo(typedOther.isSetDealTextOption());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealTextOption()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealTextOption, typedOther.dealTextOption);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealText()).compareTo(typedOther.isSetDealText());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealText()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealText, typedOther.dealText);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsCod()).compareTo(typedOther.isSetIsCod());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCod()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isCod, typedOther.isCod);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRank()).compareTo(typedOther.isSetRank());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRank()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rank, typedOther.rank);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDealFreebieOption()).compareTo(typedOther.isSetDealFreebieOption());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDealFreebieOption()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dealFreebieOption, typedOther.dealFreebieOption);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(typedOther.isSetIsActive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsActive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isActive, typedOther.isActive);
      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: // ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.item_id = iprot.readI64();
            setItem_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // DEAL_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.dealPrice = iprot.readDouble();
            setDealPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // DEAL_FREEBIE_ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.dealFreebieItemId = iprot.readI64();
            setDealFreebieItemIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // START_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.startDate = iprot.readI64();
            setStartDateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // END_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.endDate = iprot.readI64();
            setEndDateIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // DEAL_TEXT_OPTION
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.dealTextOption = iprot.readI64();
            setDealTextOptionIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // DEAL_TEXT
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.dealText = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // IS_COD
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isCod = iprot.readBool();
            setIsCodIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // RANK
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.rank = iprot.readI64();
            setRankIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // DEAL_FREEBIE_OPTION
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.dealFreebieOption = iprot.readI64();
            setDealFreebieOptionIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // IS_ACTIVE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isActive = iprot.readBool();
            setIsActiveIsSet(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(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.item_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DEAL_PRICE_FIELD_DESC);
    oprot.writeDouble(this.dealPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DEAL_FREEBIE_ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.dealFreebieItemId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(START_DATE_FIELD_DESC);
    oprot.writeI64(this.startDate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(END_DATE_FIELD_DESC);
    oprot.writeI64(this.endDate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DEAL_TEXT_OPTION_FIELD_DESC);
    oprot.writeI64(this.dealTextOption);
    oprot.writeFieldEnd();
    if (this.dealText != null) {
      oprot.writeFieldBegin(DEAL_TEXT_FIELD_DESC);
      oprot.writeString(this.dealText);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(IS_COD_FIELD_DESC);
    oprot.writeBool(this.isCod);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(RANK_FIELD_DESC);
    oprot.writeI64(this.rank);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DEAL_FREEBIE_OPTION_FIELD_DESC);
    oprot.writeI64(this.dealFreebieOption);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
    oprot.writeBool(this.isActive);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("item_id:");
    sb.append(this.item_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealPrice:");
    sb.append(this.dealPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealFreebieItemId:");
    sb.append(this.dealFreebieItemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("startDate:");
    sb.append(this.startDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("endDate:");
    sb.append(this.endDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealTextOption:");
    sb.append(this.dealTextOption);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealText:");
    if (this.dealText == null) {
      sb.append("null");
    } else {
      sb.append(this.dealText);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("isCod:");
    sb.append(this.isCod);
    first = false;
    if (!first) sb.append(", ");
    sb.append("rank:");
    sb.append(this.rank);
    first = false;
    if (!first) sb.append(", ");
    sb.append("dealFreebieOption:");
    sb.append(this.dealFreebieOption);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isActive:");
    sb.append(this.isActive);
    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);
    }
  }

}