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

  private static final org.apache.thrift.protocol.TField CATALOG_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("catalogId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField SELLING_PRICE_FIELD_DESC = new org.apache.thrift.protocol.TField("sellingPrice", org.apache.thrift.protocol.TType.DOUBLE, (short)3);
  private static final org.apache.thrift.protocol.TField IP_FIELD_DESC = new org.apache.thrift.protocol.TField("ip", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField IN_STOCK_FIELD_DESC = new org.apache.thrift.protocol.TField("inStock", org.apache.thrift.protocol.TType.BOOL, (short)6);
  private static final org.apache.thrift.protocol.TField COMING_SOON_FIELD_DESC = new org.apache.thrift.protocol.TField("comingSoon", org.apache.thrift.protocol.TType.BOOL, (short)7);
  private static final org.apache.thrift.protocol.TField EVENT_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("eventDate", org.apache.thrift.protocol.TType.I64, (short)8);

  private long catalogId; // required
  private long itemId; // required
  private double sellingPrice; // required
  private String ip; // required
  private String sessionId; // required
  private boolean inStock; // required
  private boolean comingSoon; // required
  private long eventDate; // 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 {
    CATALOG_ID((short)1, "catalogId"),
    ITEM_ID((short)2, "itemId"),
    SELLING_PRICE((short)3, "sellingPrice"),
    IP((short)4, "ip"),
    SESSION_ID((short)5, "sessionId"),
    IN_STOCK((short)6, "inStock"),
    COMING_SOON((short)7, "comingSoon"),
    EVENT_DATE((short)8, "eventDate");

    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: // CATALOG_ID
          return CATALOG_ID;
        case 2: // ITEM_ID
          return ITEM_ID;
        case 3: // SELLING_PRICE
          return SELLING_PRICE;
        case 4: // IP
          return IP;
        case 5: // SESSION_ID
          return SESSION_ID;
        case 6: // IN_STOCK
          return IN_STOCK;
        case 7: // COMING_SOON
          return COMING_SOON;
        case 8: // EVENT_DATE
          return EVENT_DATE;
        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 __CATALOGID_ISSET_ID = 0;
  private static final int __ITEMID_ISSET_ID = 1;
  private static final int __SELLINGPRICE_ISSET_ID = 2;
  private static final int __INSTOCK_ISSET_ID = 3;
  private static final int __COMINGSOON_ISSET_ID = 4;
  private static final int __EVENTDATE_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.CATALOG_ID, new org.apache.thrift.meta_data.FieldMetaData("catalogId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SELLING_PRICE, new org.apache.thrift.meta_data.FieldMetaData("sellingPrice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.IP, new org.apache.thrift.meta_data.FieldMetaData("ip", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("sessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IN_STOCK, new org.apache.thrift.meta_data.FieldMetaData("inStock", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.COMING_SOON, new org.apache.thrift.meta_data.FieldMetaData("comingSoon", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.EVENT_DATE, new org.apache.thrift.meta_data.FieldMetaData("eventDate", 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(CartEvents.class, metaDataMap);
  }

  public CartEvents() {
  }

  public CartEvents(
    long catalogId,
    long itemId,
    double sellingPrice,
    String ip,
    String sessionId,
    boolean inStock,
    boolean comingSoon,
    long eventDate)
  {
    this();
    this.catalogId = catalogId;
    setCatalogIdIsSet(true);
    this.itemId = itemId;
    setItemIdIsSet(true);
    this.sellingPrice = sellingPrice;
    setSellingPriceIsSet(true);
    this.ip = ip;
    this.sessionId = sessionId;
    this.inStock = inStock;
    setInStockIsSet(true);
    this.comingSoon = comingSoon;
    setComingSoonIsSet(true);
    this.eventDate = eventDate;
    setEventDateIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public CartEvents(CartEvents other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.catalogId = other.catalogId;
    this.itemId = other.itemId;
    this.sellingPrice = other.sellingPrice;
    if (other.isSetIp()) {
      this.ip = other.ip;
    }
    if (other.isSetSessionId()) {
      this.sessionId = other.sessionId;
    }
    this.inStock = other.inStock;
    this.comingSoon = other.comingSoon;
    this.eventDate = other.eventDate;
  }

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

  @Override
  public void clear() {
    setCatalogIdIsSet(false);
    this.catalogId = 0;
    setItemIdIsSet(false);
    this.itemId = 0;
    setSellingPriceIsSet(false);
    this.sellingPrice = 0.0;
    this.ip = null;
    this.sessionId = null;
    setInStockIsSet(false);
    this.inStock = false;
    setComingSoonIsSet(false);
    this.comingSoon = false;
    setEventDateIsSet(false);
    this.eventDate = 0;
  }

  public long getCatalogId() {
    return this.catalogId;
  }

  public void setCatalogId(long catalogId) {
    this.catalogId = catalogId;
    setCatalogIdIsSet(true);
  }

  public void unsetCatalogId() {
    __isset_bit_vector.clear(__CATALOGID_ISSET_ID);
  }

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

  public void setCatalogIdIsSet(boolean value) {
    __isset_bit_vector.set(__CATALOGID_ISSET_ID, value);
  }

  public long getItemId() {
    return this.itemId;
  }

  public void setItemId(long itemId) {
    this.itemId = itemId;
    setItemIdIsSet(true);
  }

  public void unsetItemId() {
    __isset_bit_vector.clear(__ITEMID_ISSET_ID);
  }

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

  public void setItemIdIsSet(boolean value) {
    __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
  }

  public double getSellingPrice() {
    return this.sellingPrice;
  }

  public void setSellingPrice(double sellingPrice) {
    this.sellingPrice = sellingPrice;
    setSellingPriceIsSet(true);
  }

  public void unsetSellingPrice() {
    __isset_bit_vector.clear(__SELLINGPRICE_ISSET_ID);
  }

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

  public void setSellingPriceIsSet(boolean value) {
    __isset_bit_vector.set(__SELLINGPRICE_ISSET_ID, value);
  }

  public String getIp() {
    return this.ip;
  }

  public void setIp(String ip) {
    this.ip = ip;
  }

  public void unsetIp() {
    this.ip = null;
  }

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

  public void setIpIsSet(boolean value) {
    if (!value) {
      this.ip = null;
    }
  }

  public String getSessionId() {
    return this.sessionId;
  }

  public void setSessionId(String sessionId) {
    this.sessionId = sessionId;
  }

  public void unsetSessionId() {
    this.sessionId = null;
  }

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

  public void setSessionIdIsSet(boolean value) {
    if (!value) {
      this.sessionId = null;
    }
  }

  public boolean isInStock() {
    return this.inStock;
  }

  public void setInStock(boolean inStock) {
    this.inStock = inStock;
    setInStockIsSet(true);
  }

  public void unsetInStock() {
    __isset_bit_vector.clear(__INSTOCK_ISSET_ID);
  }

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

  public void setInStockIsSet(boolean value) {
    __isset_bit_vector.set(__INSTOCK_ISSET_ID, value);
  }

  public boolean isComingSoon() {
    return this.comingSoon;
  }

  public void setComingSoon(boolean comingSoon) {
    this.comingSoon = comingSoon;
    setComingSoonIsSet(true);
  }

  public void unsetComingSoon() {
    __isset_bit_vector.clear(__COMINGSOON_ISSET_ID);
  }

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

  public void setComingSoonIsSet(boolean value) {
    __isset_bit_vector.set(__COMINGSOON_ISSET_ID, value);
  }

  public long getEventDate() {
    return this.eventDate;
  }

  public void setEventDate(long eventDate) {
    this.eventDate = eventDate;
    setEventDateIsSet(true);
  }

  public void unsetEventDate() {
    __isset_bit_vector.clear(__EVENTDATE_ISSET_ID);
  }

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

  public void setEventDateIsSet(boolean value) {
    __isset_bit_vector.set(__EVENTDATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CATALOG_ID:
      if (value == null) {
        unsetCatalogId();
      } else {
        setCatalogId((Long)value);
      }
      break;

    case ITEM_ID:
      if (value == null) {
        unsetItemId();
      } else {
        setItemId((Long)value);
      }
      break;

    case SELLING_PRICE:
      if (value == null) {
        unsetSellingPrice();
      } else {
        setSellingPrice((Double)value);
      }
      break;

    case IP:
      if (value == null) {
        unsetIp();
      } else {
        setIp((String)value);
      }
      break;

    case SESSION_ID:
      if (value == null) {
        unsetSessionId();
      } else {
        setSessionId((String)value);
      }
      break;

    case IN_STOCK:
      if (value == null) {
        unsetInStock();
      } else {
        setInStock((Boolean)value);
      }
      break;

    case COMING_SOON:
      if (value == null) {
        unsetComingSoon();
      } else {
        setComingSoon((Boolean)value);
      }
      break;

    case EVENT_DATE:
      if (value == null) {
        unsetEventDate();
      } else {
        setEventDate((Long)value);
      }
      break;

    }
  }

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

    case ITEM_ID:
      return Long.valueOf(getItemId());

    case SELLING_PRICE:
      return Double.valueOf(getSellingPrice());

    case IP:
      return getIp();

    case SESSION_ID:
      return getSessionId();

    case IN_STOCK:
      return Boolean.valueOf(isInStock());

    case COMING_SOON:
      return Boolean.valueOf(isComingSoon());

    case EVENT_DATE:
      return Long.valueOf(getEventDate());

    }
    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 CATALOG_ID:
      return isSetCatalogId();
    case ITEM_ID:
      return isSetItemId();
    case SELLING_PRICE:
      return isSetSellingPrice();
    case IP:
      return isSetIp();
    case SESSION_ID:
      return isSetSessionId();
    case IN_STOCK:
      return isSetInStock();
    case COMING_SOON:
      return isSetComingSoon();
    case EVENT_DATE:
      return isSetEventDate();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_catalogId = true;
    boolean that_present_catalogId = true;
    if (this_present_catalogId || that_present_catalogId) {
      if (!(this_present_catalogId && that_present_catalogId))
        return false;
      if (this.catalogId != that.catalogId)
        return false;
    }

    boolean this_present_itemId = true;
    boolean that_present_itemId = true;
    if (this_present_itemId || that_present_itemId) {
      if (!(this_present_itemId && that_present_itemId))
        return false;
      if (this.itemId != that.itemId)
        return false;
    }

    boolean this_present_sellingPrice = true;
    boolean that_present_sellingPrice = true;
    if (this_present_sellingPrice || that_present_sellingPrice) {
      if (!(this_present_sellingPrice && that_present_sellingPrice))
        return false;
      if (this.sellingPrice != that.sellingPrice)
        return false;
    }

    boolean this_present_ip = true && this.isSetIp();
    boolean that_present_ip = true && that.isSetIp();
    if (this_present_ip || that_present_ip) {
      if (!(this_present_ip && that_present_ip))
        return false;
      if (!this.ip.equals(that.ip))
        return false;
    }

    boolean this_present_sessionId = true && this.isSetSessionId();
    boolean that_present_sessionId = true && that.isSetSessionId();
    if (this_present_sessionId || that_present_sessionId) {
      if (!(this_present_sessionId && that_present_sessionId))
        return false;
      if (!this.sessionId.equals(that.sessionId))
        return false;
    }

    boolean this_present_inStock = true;
    boolean that_present_inStock = true;
    if (this_present_inStock || that_present_inStock) {
      if (!(this_present_inStock && that_present_inStock))
        return false;
      if (this.inStock != that.inStock)
        return false;
    }

    boolean this_present_comingSoon = true;
    boolean that_present_comingSoon = true;
    if (this_present_comingSoon || that_present_comingSoon) {
      if (!(this_present_comingSoon && that_present_comingSoon))
        return false;
      if (this.comingSoon != that.comingSoon)
        return false;
    }

    boolean this_present_eventDate = true;
    boolean that_present_eventDate = true;
    if (this_present_eventDate || that_present_eventDate) {
      if (!(this_present_eventDate && that_present_eventDate))
        return false;
      if (this.eventDate != that.eventDate)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetCatalogId()).compareTo(typedOther.isSetCatalogId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCatalogId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catalogId, typedOther.catalogId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetItemId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSellingPrice()).compareTo(typedOther.isSetSellingPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSellingPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sellingPrice, typedOther.sellingPrice);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIp()).compareTo(typedOther.isSetIp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ip, typedOther.ip);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSessionId()).compareTo(typedOther.isSetSessionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSessionId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionId, typedOther.sessionId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInStock()).compareTo(typedOther.isSetInStock());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInStock()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inStock, typedOther.inStock);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetComingSoon()).compareTo(typedOther.isSetComingSoon());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComingSoon()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comingSoon, typedOther.comingSoon);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEventDate()).compareTo(typedOther.isSetEventDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEventDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventDate, typedOther.eventDate);
      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: // CATALOG_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.catalogId = iprot.readI64();
            setCatalogIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.itemId = iprot.readI64();
            setItemIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // SELLING_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.sellingPrice = iprot.readDouble();
            setSellingPriceIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // IP
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.ip = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // SESSION_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.sessionId = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // IN_STOCK
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.inStock = iprot.readBool();
            setInStockIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // COMING_SOON
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.comingSoon = iprot.readBool();
            setComingSoonIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // EVENT_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.eventDate = iprot.readI64();
            setEventDateIsSet(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(CATALOG_ID_FIELD_DESC);
    oprot.writeI64(this.catalogId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.itemId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SELLING_PRICE_FIELD_DESC);
    oprot.writeDouble(this.sellingPrice);
    oprot.writeFieldEnd();
    if (this.ip != null) {
      oprot.writeFieldBegin(IP_FIELD_DESC);
      oprot.writeString(this.ip);
      oprot.writeFieldEnd();
    }
    if (this.sessionId != null) {
      oprot.writeFieldBegin(SESSION_ID_FIELD_DESC);
      oprot.writeString(this.sessionId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(IN_STOCK_FIELD_DESC);
    oprot.writeBool(this.inStock);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(COMING_SOON_FIELD_DESC);
    oprot.writeBool(this.comingSoon);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(EVENT_DATE_FIELD_DESC);
    oprot.writeI64(this.eventDate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("catalogId:");
    sb.append(this.catalogId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemId:");
    sb.append(this.itemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("sellingPrice:");
    sb.append(this.sellingPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("ip:");
    if (this.ip == null) {
      sb.append("null");
    } else {
      sb.append(this.ip);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("sessionId:");
    if (this.sessionId == null) {
      sb.append("null");
    } else {
      sb.append(this.sessionId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("inStock:");
    sb.append(this.inStock);
    first = false;
    if (!first) sb.append(", ");
    sb.append("comingSoon:");
    sb.append(this.comingSoon);
    first = false;
    if (!first) sb.append(", ");
    sb.append("eventDate:");
    sb.append(this.eventDate);
    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);
    }
  }

}