Subversion Repositories SmartDukaan

Rev

Rev 18585 | 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.order;

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

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

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("user_id", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField CREDITOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("creditor_id", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField PAYMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("payment_id", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField CREDIT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("credit_type", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField CREATED_FIELD_DESC = new org.apache.thrift.protocol.TField("created", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField SHIPPING_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("shipping_id", org.apache.thrift.protocol.TType.STRING, (short)8);

  private long id; // required
  private long user_id; // required
  private long creditor_id; // required
  private long payment_id; // required
  private double amount; // required
  private CreditTxnType credit_type; // required
  private long created; // required
  private String shipping_id; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ID((short)1, "id"),
    USER_ID((short)2, "user_id"),
    CREDITOR_ID((short)3, "creditor_id"),
    PAYMENT_ID((short)4, "payment_id"),
    AMOUNT((short)5, "amount"),
    /**
     * 
     * @see CreditTxnType
     */
    CREDIT_TYPE((short)6, "credit_type"),
    CREATED((short)7, "created"),
    SHIPPING_ID((short)8, "shipping_id");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ID
          return ID;
        case 2: // USER_ID
          return USER_ID;
        case 3: // CREDITOR_ID
          return CREDITOR_ID;
        case 4: // PAYMENT_ID
          return PAYMENT_ID;
        case 5: // AMOUNT
          return AMOUNT;
        case 6: // CREDIT_TYPE
          return CREDIT_TYPE;
        case 7: // CREATED
          return CREATED;
        case 8: // SHIPPING_ID
          return SHIPPING_ID;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __ID_ISSET_ID = 0;
  private static final int __USER_ID_ISSET_ID = 1;
  private static final int __CREDITOR_ID_ISSET_ID = 2;
  private static final int __PAYMENT_ID_ISSET_ID = 3;
  private static final int __AMOUNT_ISSET_ID = 4;
  private static final int __CREATED_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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("user_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CREDITOR_ID, new org.apache.thrift.meta_data.FieldMetaData("creditor_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PAYMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("payment_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.CREDIT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("credit_type", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CreditTxnType.class)));
    tmpMap.put(_Fields.CREATED, new org.apache.thrift.meta_data.FieldMetaData("created", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SHIPPING_ID, new org.apache.thrift.meta_data.FieldMetaData("shipping_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CreditHistory.class, metaDataMap);
  }

  public CreditHistory() {
  }

  public CreditHistory(
    long id,
    long user_id,
    long creditor_id,
    long payment_id,
    double amount,
    CreditTxnType credit_type,
    long created,
    String shipping_id)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.user_id = user_id;
    setUser_idIsSet(true);
    this.creditor_id = creditor_id;
    setCreditor_idIsSet(true);
    this.payment_id = payment_id;
    setPayment_idIsSet(true);
    this.amount = amount;
    setAmountIsSet(true);
    this.credit_type = credit_type;
    this.created = created;
    setCreatedIsSet(true);
    this.shipping_id = shipping_id;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public CreditHistory(CreditHistory other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.user_id = other.user_id;
    this.creditor_id = other.creditor_id;
    this.payment_id = other.payment_id;
    this.amount = other.amount;
    if (other.isSetCredit_type()) {
      this.credit_type = other.credit_type;
    }
    this.created = other.created;
    if (other.isSetShipping_id()) {
      this.shipping_id = other.shipping_id;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setUser_idIsSet(false);
    this.user_id = 0;
    setCreditor_idIsSet(false);
    this.creditor_id = 0;
    setPayment_idIsSet(false);
    this.payment_id = 0;
    setAmountIsSet(false);
    this.amount = 0.0;
    this.credit_type = null;
    setCreatedIsSet(false);
    this.created = 0;
    this.shipping_id = null;
  }

  public long getId() {
    return this.id;
  }

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

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

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public long getUser_id() {
    return this.user_id;
  }

  public void setUser_id(long user_id) {
    this.user_id = user_id;
    setUser_idIsSet(true);
  }

  public void unsetUser_id() {
    __isset_bit_vector.clear(__USER_ID_ISSET_ID);
  }

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

  public void setUser_idIsSet(boolean value) {
    __isset_bit_vector.set(__USER_ID_ISSET_ID, value);
  }

  public long getCreditor_id() {
    return this.creditor_id;
  }

  public void setCreditor_id(long creditor_id) {
    this.creditor_id = creditor_id;
    setCreditor_idIsSet(true);
  }

  public void unsetCreditor_id() {
    __isset_bit_vector.clear(__CREDITOR_ID_ISSET_ID);
  }

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

  public void setCreditor_idIsSet(boolean value) {
    __isset_bit_vector.set(__CREDITOR_ID_ISSET_ID, value);
  }

  public long getPayment_id() {
    return this.payment_id;
  }

  public void setPayment_id(long payment_id) {
    this.payment_id = payment_id;
    setPayment_idIsSet(true);
  }

  public void unsetPayment_id() {
    __isset_bit_vector.clear(__PAYMENT_ID_ISSET_ID);
  }

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

  public void setPayment_idIsSet(boolean value) {
    __isset_bit_vector.set(__PAYMENT_ID_ISSET_ID, value);
  }

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

  public void setAmount(double amount) {
    this.amount = amount;
    setAmountIsSet(true);
  }

  public void unsetAmount() {
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
  }

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

  public void setAmountIsSet(boolean value) {
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
  }

  /**
   * 
   * @see CreditTxnType
   */
  public CreditTxnType getCredit_type() {
    return this.credit_type;
  }

  /**
   * 
   * @see CreditTxnType
   */
  public void setCredit_type(CreditTxnType credit_type) {
    this.credit_type = credit_type;
  }

  public void unsetCredit_type() {
    this.credit_type = null;
  }

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

  public void setCredit_typeIsSet(boolean value) {
    if (!value) {
      this.credit_type = null;
    }
  }

  public long getCreated() {
    return this.created;
  }

  public void setCreated(long created) {
    this.created = created;
    setCreatedIsSet(true);
  }

  public void unsetCreated() {
    __isset_bit_vector.clear(__CREATED_ISSET_ID);
  }

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

  public void setCreatedIsSet(boolean value) {
    __isset_bit_vector.set(__CREATED_ISSET_ID, value);
  }

  public String getShipping_id() {
    return this.shipping_id;
  }

  public void setShipping_id(String shipping_id) {
    this.shipping_id = shipping_id;
  }

  public void unsetShipping_id() {
    this.shipping_id = null;
  }

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

  public void setShipping_idIsSet(boolean value) {
    if (!value) {
      this.shipping_id = null;
    }
  }

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

    case USER_ID:
      if (value == null) {
        unsetUser_id();
      } else {
        setUser_id((Long)value);
      }
      break;

    case CREDITOR_ID:
      if (value == null) {
        unsetCreditor_id();
      } else {
        setCreditor_id((Long)value);
      }
      break;

    case PAYMENT_ID:
      if (value == null) {
        unsetPayment_id();
      } else {
        setPayment_id((Long)value);
      }
      break;

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

    case CREDIT_TYPE:
      if (value == null) {
        unsetCredit_type();
      } else {
        setCredit_type((CreditTxnType)value);
      }
      break;

    case CREATED:
      if (value == null) {
        unsetCreated();
      } else {
        setCreated((Long)value);
      }
      break;

    case SHIPPING_ID:
      if (value == null) {
        unsetShipping_id();
      } else {
        setShipping_id((String)value);
      }
      break;

    }
  }

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

    case USER_ID:
      return Long.valueOf(getUser_id());

    case CREDITOR_ID:
      return Long.valueOf(getCreditor_id());

    case PAYMENT_ID:
      return Long.valueOf(getPayment_id());

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

    case CREDIT_TYPE:
      return getCredit_type();

    case CREATED:
      return Long.valueOf(getCreated());

    case SHIPPING_ID:
      return getShipping_id();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case USER_ID:
      return isSetUser_id();
    case CREDITOR_ID:
      return isSetCreditor_id();
    case PAYMENT_ID:
      return isSetPayment_id();
    case AMOUNT:
      return isSetAmount();
    case CREDIT_TYPE:
      return isSetCredit_type();
    case CREATED:
      return isSetCreated();
    case SHIPPING_ID:
      return isSetShipping_id();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_user_id = true;
    boolean that_present_user_id = true;
    if (this_present_user_id || that_present_user_id) {
      if (!(this_present_user_id && that_present_user_id))
        return false;
      if (this.user_id != that.user_id)
        return false;
    }

    boolean this_present_creditor_id = true;
    boolean that_present_creditor_id = true;
    if (this_present_creditor_id || that_present_creditor_id) {
      if (!(this_present_creditor_id && that_present_creditor_id))
        return false;
      if (this.creditor_id != that.creditor_id)
        return false;
    }

    boolean this_present_payment_id = true;
    boolean that_present_payment_id = true;
    if (this_present_payment_id || that_present_payment_id) {
      if (!(this_present_payment_id && that_present_payment_id))
        return false;
      if (this.payment_id != that.payment_id)
        return false;
    }

    boolean this_present_amount = true;
    boolean that_present_amount = true;
    if (this_present_amount || that_present_amount) {
      if (!(this_present_amount && that_present_amount))
        return false;
      if (this.amount != that.amount)
        return false;
    }

    boolean this_present_credit_type = true && this.isSetCredit_type();
    boolean that_present_credit_type = true && that.isSetCredit_type();
    if (this_present_credit_type || that_present_credit_type) {
      if (!(this_present_credit_type && that_present_credit_type))
        return false;
      if (!this.credit_type.equals(that.credit_type))
        return false;
    }

    boolean this_present_created = true;
    boolean that_present_created = true;
    if (this_present_created || that_present_created) {
      if (!(this_present_created && that_present_created))
        return false;
      if (this.created != that.created)
        return false;
    }

    boolean this_present_shipping_id = true && this.isSetShipping_id();
    boolean that_present_shipping_id = true && that.isSetShipping_id();
    if (this_present_shipping_id || that_present_shipping_id) {
      if (!(this_present_shipping_id && that_present_shipping_id))
        return false;
      if (!this.shipping_id.equals(that.shipping_id))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUser_id()).compareTo(typedOther.isSetUser_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUser_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user_id, typedOther.user_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreditor_id()).compareTo(typedOther.isSetCreditor_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreditor_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creditor_id, typedOther.creditor_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPayment_id()).compareTo(typedOther.isSetPayment_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPayment_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payment_id, typedOther.payment_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCredit_type()).compareTo(typedOther.isSetCredit_type());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCredit_type()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credit_type, typedOther.credit_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreated()).compareTo(typedOther.isSetCreated());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreated()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.created, typedOther.created);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShipping_id()).compareTo(typedOther.isSetShipping_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShipping_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shipping_id, typedOther.shipping_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // USER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.user_id = iprot.readI64();
            setUser_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // CREDITOR_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.creditor_id = iprot.readI64();
            setCreditor_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // PAYMENT_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.payment_id = iprot.readI64();
            setPayment_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.amount = iprot.readDouble();
            setAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // CREDIT_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.credit_type = CreditTxnType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // CREATED
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.created = iprot.readI64();
            setCreatedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // SHIPPING_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.shipping_id = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.user_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREDITOR_ID_FIELD_DESC);
    oprot.writeI64(this.creditor_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PAYMENT_ID_FIELD_DESC);
    oprot.writeI64(this.payment_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.amount);
    oprot.writeFieldEnd();
    if (this.credit_type != null) {
      oprot.writeFieldBegin(CREDIT_TYPE_FIELD_DESC);
      oprot.writeI32(this.credit_type.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATED_FIELD_DESC);
    oprot.writeI64(this.created);
    oprot.writeFieldEnd();
    if (this.shipping_id != null) {
      oprot.writeFieldBegin(SHIPPING_ID_FIELD_DESC);
      oprot.writeString(this.shipping_id);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("user_id:");
    sb.append(this.user_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("creditor_id:");
    sb.append(this.creditor_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("payment_id:");
    sb.append(this.payment_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("credit_type:");
    if (this.credit_type == null) {
      sb.append("null");
    } else {
      sb.append(this.credit_type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("created:");
    sb.append(this.created);
    first = false;
    if (!first) sb.append(", ");
    sb.append("shipping_id:");
    if (this.shipping_id == null) {
      sb.append("null");
    } else {
      sb.append(this.shipping_id);
    }
    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);
    }
  }

}