Subversion Repositories SmartDukaan

Rev

Rev 1013 | Rev 3555 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * 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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class Line implements TBase<Line._Fields>, java.io.Serializable, Cloneable, Comparable<Line> {
  private static final TStruct STRUCT_DESC = new TStruct("Line");

  private static final TField CART_ID_FIELD_DESC = new TField("cartId", TType.I64, (short)1);
  private static final TField ITEM_ID_FIELD_DESC = new TField("itemId", TType.I64, (short)2);
  private static final TField QUANTITY_FIELD_DESC = new TField("quantity", TType.DOUBLE, (short)3);
  private static final TField CREATED_ON_FIELD_DESC = new TField("createdOn", TType.I64, (short)4);
  private static final TField UPDATED_ON_FIELD_DESC = new TField("updatedOn", TType.I64, (short)5);
  private static final TField LINE_STATUS_FIELD_DESC = new TField("lineStatus", TType.I32, (short)6);
  private static final TField ESTIMATE_FIELD_DESC = new TField("estimate", TType.I32, (short)7);
  private static final TField ACTUAL_PRICE_FIELD_DESC = new TField("actualPrice", TType.DOUBLE, (short)8);
  private static final TField DISCOUNTED_PRICE_FIELD_DESC = new TField("discountedPrice", TType.DOUBLE, (short)9);

  private long cartId;
  private long itemId;
  private double quantity;
  private long createdOn;
  private long updatedOn;
  private LineStatus lineStatus;
  private int estimate;
  private double actualPrice;
  private double discountedPrice;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    CART_ID((short)1, "cartId"),
    ITEM_ID((short)2, "itemId"),
    QUANTITY((short)3, "quantity"),
    CREATED_ON((short)4, "createdOn"),
    UPDATED_ON((short)5, "updatedOn"),
    /**
     * 
     * @see LineStatus
     */
    LINE_STATUS((short)6, "lineStatus"),
    ESTIMATE((short)7, "estimate"),
    ACTUAL_PRICE((short)8, "actualPrice"),
    DISCOUNTED_PRICE((short)9, "discountedPrice");

    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byId.put((int)field._thriftId, field);
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __CARTID_ISSET_ID = 0;
  private static final int __ITEMID_ISSET_ID = 1;
  private static final int __QUANTITY_ISSET_ID = 2;
  private static final int __CREATEDON_ISSET_ID = 3;
  private static final int __UPDATEDON_ISSET_ID = 4;
  private static final int __ESTIMATE_ISSET_ID = 5;
  private static final int __ACTUALPRICE_ISSET_ID = 6;
  private static final int __DISCOUNTEDPRICE_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.CART_ID, new FieldMetaData("cartId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ITEM_ID, new FieldMetaData("itemId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.QUANTITY, new FieldMetaData("quantity", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.CREATED_ON, new FieldMetaData("createdOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.UPDATED_ON, new FieldMetaData("updatedOn", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.LINE_STATUS, new FieldMetaData("lineStatus", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, LineStatus.class)));
    put(_Fields.ESTIMATE, new FieldMetaData("estimate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    put(_Fields.ACTUAL_PRICE, new FieldMetaData("actualPrice", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.DISCOUNTED_PRICE, new FieldMetaData("discountedPrice", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(Line.class, metaDataMap);
  }

  public Line() {
  }

  public Line(
    long cartId,
    long itemId,
    double quantity,
    long createdOn,
    long updatedOn,
    LineStatus lineStatus,
    int estimate,
    double actualPrice,
    double discountedPrice)
  {
    this();
    this.cartId = cartId;
    setCartIdIsSet(true);
    this.itemId = itemId;
    setItemIdIsSet(true);
    this.quantity = quantity;
    setQuantityIsSet(true);
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
    this.lineStatus = lineStatus;
    this.estimate = estimate;
    setEstimateIsSet(true);
    this.actualPrice = actualPrice;
    setActualPriceIsSet(true);
    this.discountedPrice = discountedPrice;
    setDiscountedPriceIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Line(Line other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.cartId = other.cartId;
    this.itemId = other.itemId;
    this.quantity = other.quantity;
    this.createdOn = other.createdOn;
    this.updatedOn = other.updatedOn;
    if (other.isSetLineStatus()) {
      this.lineStatus = other.lineStatus;
    }
    this.estimate = other.estimate;
    this.actualPrice = other.actualPrice;
    this.discountedPrice = other.discountedPrice;
  }

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

  @Deprecated
  public Line clone() {
    return new Line(this);
  }

  public long getCartId() {
    return this.cartId;
  }

  public Line setCartId(long cartId) {
    this.cartId = cartId;
    setCartIdIsSet(true);
    return this;
  }

  public void unsetCartId() {
    __isset_bit_vector.clear(__CARTID_ISSET_ID);
  }

  /** Returns true if field cartId is set (has been asigned a value) and false otherwise */
  public boolean isSetCartId() {
    return __isset_bit_vector.get(__CARTID_ISSET_ID);
  }

  public void setCartIdIsSet(boolean value) {
    __isset_bit_vector.set(__CARTID_ISSET_ID, value);
  }

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

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

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

  /** Returns true if field itemId is set (has been asigned 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 getQuantity() {
    return this.quantity;
  }

  public Line setQuantity(double quantity) {
    this.quantity = quantity;
    setQuantityIsSet(true);
    return this;
  }

  public void unsetQuantity() {
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
  }

  /** Returns true if field quantity is set (has been asigned a value) and false otherwise */
  public boolean isSetQuantity() {
    return __isset_bit_vector.get(__QUANTITY_ISSET_ID);
  }

  public void setQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
  }

  public long getCreatedOn() {
    return this.createdOn;
  }

  public Line setCreatedOn(long createdOn) {
    this.createdOn = createdOn;
    setCreatedOnIsSet(true);
    return this;
  }

  public void unsetCreatedOn() {
    __isset_bit_vector.clear(__CREATEDON_ISSET_ID);
  }

  /** Returns true if field createdOn is set (has been asigned a value) and false otherwise */
  public boolean isSetCreatedOn() {
    return __isset_bit_vector.get(__CREATEDON_ISSET_ID);
  }

  public void setCreatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDON_ISSET_ID, value);
  }

  public long getUpdatedOn() {
    return this.updatedOn;
  }

  public Line setUpdatedOn(long updatedOn) {
    this.updatedOn = updatedOn;
    setUpdatedOnIsSet(true);
    return this;
  }

  public void unsetUpdatedOn() {
    __isset_bit_vector.clear(__UPDATEDON_ISSET_ID);
  }

  /** Returns true if field updatedOn is set (has been asigned a value) and false otherwise */
  public boolean isSetUpdatedOn() {
    return __isset_bit_vector.get(__UPDATEDON_ISSET_ID);
  }

  public void setUpdatedOnIsSet(boolean value) {
    __isset_bit_vector.set(__UPDATEDON_ISSET_ID, value);
  }

  /**
   * 
   * @see LineStatus
   */
  public LineStatus getLineStatus() {
    return this.lineStatus;
  }

  /**
   * 
   * @see LineStatus
   */
  public Line setLineStatus(LineStatus lineStatus) {
    this.lineStatus = lineStatus;
    return this;
  }

  public void unsetLineStatus() {
    this.lineStatus = null;
  }

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

  public void setLineStatusIsSet(boolean value) {
    if (!value) {
      this.lineStatus = null;
    }
  }

  public int getEstimate() {
    return this.estimate;
  }

  public Line setEstimate(int estimate) {
    this.estimate = estimate;
    setEstimateIsSet(true);
    return this;
  }

  public void unsetEstimate() {
    __isset_bit_vector.clear(__ESTIMATE_ISSET_ID);
  }

  /** Returns true if field estimate is set (has been asigned a value) and false otherwise */
  public boolean isSetEstimate() {
    return __isset_bit_vector.get(__ESTIMATE_ISSET_ID);
  }

  public void setEstimateIsSet(boolean value) {
    __isset_bit_vector.set(__ESTIMATE_ISSET_ID, value);
  }

  public double getActualPrice() {
    return this.actualPrice;
  }

  public Line setActualPrice(double actualPrice) {
    this.actualPrice = actualPrice;
    setActualPriceIsSet(true);
    return this;
  }

  public void unsetActualPrice() {
    __isset_bit_vector.clear(__ACTUALPRICE_ISSET_ID);
  }

  /** Returns true if field actualPrice is set (has been asigned a value) and false otherwise */
  public boolean isSetActualPrice() {
    return __isset_bit_vector.get(__ACTUALPRICE_ISSET_ID);
  }

  public void setActualPriceIsSet(boolean value) {
    __isset_bit_vector.set(__ACTUALPRICE_ISSET_ID, value);
  }

  public double getDiscountedPrice() {
    return this.discountedPrice;
  }

  public Line setDiscountedPrice(double discountedPrice) {
    this.discountedPrice = discountedPrice;
    setDiscountedPriceIsSet(true);
    return this;
  }

  public void unsetDiscountedPrice() {
    __isset_bit_vector.clear(__DISCOUNTEDPRICE_ISSET_ID);
  }

  /** Returns true if field discountedPrice is set (has been asigned a value) and false otherwise */
  public boolean isSetDiscountedPrice() {
    return __isset_bit_vector.get(__DISCOUNTEDPRICE_ISSET_ID);
  }

  public void setDiscountedPriceIsSet(boolean value) {
    __isset_bit_vector.set(__DISCOUNTEDPRICE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CART_ID:
      if (value == null) {
        unsetCartId();
      } else {
        setCartId((Long)value);
      }
      break;

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

    case QUANTITY:
      if (value == null) {
        unsetQuantity();
      } else {
        setQuantity((Double)value);
      }
      break;

    case CREATED_ON:
      if (value == null) {
        unsetCreatedOn();
      } else {
        setCreatedOn((Long)value);
      }
      break;

    case UPDATED_ON:
      if (value == null) {
        unsetUpdatedOn();
      } else {
        setUpdatedOn((Long)value);
      }
      break;

    case LINE_STATUS:
      if (value == null) {
        unsetLineStatus();
      } else {
        setLineStatus((LineStatus)value);
      }
      break;

    case ESTIMATE:
      if (value == null) {
        unsetEstimate();
      } else {
        setEstimate((Integer)value);
      }
      break;

    case ACTUAL_PRICE:
      if (value == null) {
        unsetActualPrice();
      } else {
        setActualPrice((Double)value);
      }
      break;

    case DISCOUNTED_PRICE:
      if (value == null) {
        unsetDiscountedPrice();
      } else {
        setDiscountedPrice((Double)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case CART_ID:
      return new Long(getCartId());

    case ITEM_ID:
      return new Long(getItemId());

    case QUANTITY:
      return new Double(getQuantity());

    case CREATED_ON:
      return new Long(getCreatedOn());

    case UPDATED_ON:
      return new Long(getUpdatedOn());

    case LINE_STATUS:
      return getLineStatus();

    case ESTIMATE:
      return new Integer(getEstimate());

    case ACTUAL_PRICE:
      return new Double(getActualPrice());

    case DISCOUNTED_PRICE:
      return new Double(getDiscountedPrice());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case CART_ID:
      return isSetCartId();
    case ITEM_ID:
      return isSetItemId();
    case QUANTITY:
      return isSetQuantity();
    case CREATED_ON:
      return isSetCreatedOn();
    case UPDATED_ON:
      return isSetUpdatedOn();
    case LINE_STATUS:
      return isSetLineStatus();
    case ESTIMATE:
      return isSetEstimate();
    case ACTUAL_PRICE:
      return isSetActualPrice();
    case DISCOUNTED_PRICE:
      return isSetDiscountedPrice();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

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

    boolean this_present_cartId = true;
    boolean that_present_cartId = true;
    if (this_present_cartId || that_present_cartId) {
      if (!(this_present_cartId && that_present_cartId))
        return false;
      if (this.cartId != that.cartId)
        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_quantity = true;
    boolean that_present_quantity = true;
    if (this_present_quantity || that_present_quantity) {
      if (!(this_present_quantity && that_present_quantity))
        return false;
      if (this.quantity != that.quantity)
        return false;
    }

    boolean this_present_createdOn = true;
    boolean that_present_createdOn = true;
    if (this_present_createdOn || that_present_createdOn) {
      if (!(this_present_createdOn && that_present_createdOn))
        return false;
      if (this.createdOn != that.createdOn)
        return false;
    }

    boolean this_present_updatedOn = true;
    boolean that_present_updatedOn = true;
    if (this_present_updatedOn || that_present_updatedOn) {
      if (!(this_present_updatedOn && that_present_updatedOn))
        return false;
      if (this.updatedOn != that.updatedOn)
        return false;
    }

    boolean this_present_lineStatus = true && this.isSetLineStatus();
    boolean that_present_lineStatus = true && that.isSetLineStatus();
    if (this_present_lineStatus || that_present_lineStatus) {
      if (!(this_present_lineStatus && that_present_lineStatus))
        return false;
      if (!this.lineStatus.equals(that.lineStatus))
        return false;
    }

    boolean this_present_estimate = true;
    boolean that_present_estimate = true;
    if (this_present_estimate || that_present_estimate) {
      if (!(this_present_estimate && that_present_estimate))
        return false;
      if (this.estimate != that.estimate)
        return false;
    }

    boolean this_present_actualPrice = true;
    boolean that_present_actualPrice = true;
    if (this_present_actualPrice || that_present_actualPrice) {
      if (!(this_present_actualPrice && that_present_actualPrice))
        return false;
      if (this.actualPrice != that.actualPrice)
        return false;
    }

    boolean this_present_discountedPrice = true;
    boolean that_present_discountedPrice = true;
    if (this_present_discountedPrice || that_present_discountedPrice) {
      if (!(this_present_discountedPrice && that_present_discountedPrice))
        return false;
      if (this.discountedPrice != that.discountedPrice)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetCartId()).compareTo(isSetCartId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(cartId, typedOther.cartId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetItemId()).compareTo(isSetItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(itemId, typedOther.itemId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(isSetQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(quantity, typedOther.quantity);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCreatedOn()).compareTo(isSetCreatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(createdOn, typedOther.createdOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUpdatedOn()).compareTo(isSetUpdatedOn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(updatedOn, typedOther.updatedOn);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLineStatus()).compareTo(isSetLineStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(lineStatus, typedOther.lineStatus);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEstimate()).compareTo(isSetEstimate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(estimate, typedOther.estimate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetActualPrice()).compareTo(isSetActualPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(actualPrice, typedOther.actualPrice);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDiscountedPrice()).compareTo(isSetDiscountedPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(discountedPrice, typedOther.discountedPrice);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case CART_ID:
            if (field.type == TType.I64) {
              this.cartId = iprot.readI64();
              setCartIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ITEM_ID:
            if (field.type == TType.I64) {
              this.itemId = iprot.readI64();
              setItemIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case QUANTITY:
            if (field.type == TType.DOUBLE) {
              this.quantity = iprot.readDouble();
              setQuantityIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CREATED_ON:
            if (field.type == TType.I64) {
              this.createdOn = iprot.readI64();
              setCreatedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case UPDATED_ON:
            if (field.type == TType.I64) {
              this.updatedOn = iprot.readI64();
              setUpdatedOnIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case LINE_STATUS:
            if (field.type == TType.I32) {
              this.lineStatus = LineStatus.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ESTIMATE:
            if (field.type == TType.I32) {
              this.estimate = iprot.readI32();
              setEstimateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ACTUAL_PRICE:
            if (field.type == TType.DOUBLE) {
              this.actualPrice = iprot.readDouble();
              setActualPriceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DISCOUNTED_PRICE:
            if (field.type == TType.DOUBLE) {
              this.discountedPrice = iprot.readDouble();
              setDiscountedPriceIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(CART_ID_FIELD_DESC);
    oprot.writeI64(this.cartId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.itemId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
    oprot.writeDouble(this.quantity);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATED_ON_FIELD_DESC);
    oprot.writeI64(this.createdOn);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_ON_FIELD_DESC);
    oprot.writeI64(this.updatedOn);
    oprot.writeFieldEnd();
    if (this.lineStatus != null) {
      oprot.writeFieldBegin(LINE_STATUS_FIELD_DESC);
      oprot.writeI32(this.lineStatus.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ESTIMATE_FIELD_DESC);
    oprot.writeI32(this.estimate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ACTUAL_PRICE_FIELD_DESC);
    oprot.writeDouble(this.actualPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DISCOUNTED_PRICE_FIELD_DESC);
    oprot.writeDouble(this.discountedPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("cartId:");
    sb.append(this.cartId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("itemId:");
    sb.append(this.itemId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("quantity:");
    sb.append(this.quantity);
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdOn:");
    sb.append(this.createdOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("updatedOn:");
    sb.append(this.updatedOn);
    first = false;
    if (!first) sb.append(", ");
    sb.append("lineStatus:");
    if (this.lineStatus == null) {
      sb.append("null");
    } else {
      String lineStatus_name = lineStatus.name();
      if (lineStatus_name != null) {
        sb.append(lineStatus_name);
        sb.append(" (");
      }
      sb.append(this.lineStatus);
      if (lineStatus_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("estimate:");
    sb.append(this.estimate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("actualPrice:");
    sb.append(this.actualPrice);
    first = false;
    if (!first) sb.append(", ");
    sb.append("discountedPrice:");
    sb.append(this.discountedPrice);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}