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

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 USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("user_id", org.apache.thrift.protocol.TType.I64, (short)1);
  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)2);
  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)3);
  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)4);
  private static final org.apache.thrift.protocol.TField CREDITTYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("credittype", org.apache.thrift.protocol.TType.I32, (short)5);
  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)6);
  private static final org.apache.thrift.protocol.TField UPDATED_FIELD_DESC = new org.apache.thrift.protocol.TField("updated", org.apache.thrift.protocol.TType.I64, (short)7);
  private static final org.apache.thrift.protocol.TField LOAN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("loan_id", org.apache.thrift.protocol.TType.STRING, (short)8);
  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)9);
  private static final org.apache.thrift.protocol.TField DUE_DATE_FIELD_DESC = new org.apache.thrift.protocol.TField("dueDate", org.apache.thrift.protocol.TType.I64, (short)10);

  private long user_id; // required
  private long creditor_id; // required
  private long payment_id; // required
  private double amount; // required
  private CreditTxnType credittype; // required
  private long created; // required
  private long updated; // required
  private String loan_id; // required
  private String shipping_id; // required
  private long dueDate; // 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 {
    USER_ID((short)1, "user_id"),
    CREDITOR_ID((short)2, "creditor_id"),
    PAYMENT_ID((short)3, "payment_id"),
    AMOUNT((short)4, "amount"),
    /**
     * 
     * @see CreditTxnType
     */
    CREDITTYPE((short)5, "credittype"),
    CREATED((short)6, "created"),
    UPDATED((short)7, "updated"),
    LOAN_ID((short)8, "loan_id"),
    SHIPPING_ID((short)9, "shipping_id"),
    DUE_DATE((short)10, "dueDate");

    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: // USER_ID
          return USER_ID;
        case 2: // CREDITOR_ID
          return CREDITOR_ID;
        case 3: // PAYMENT_ID
          return PAYMENT_ID;
        case 4: // AMOUNT
          return AMOUNT;
        case 5: // CREDITTYPE
          return CREDITTYPE;
        case 6: // CREATED
          return CREATED;
        case 7: // UPDATED
          return UPDATED;
        case 8: // LOAN_ID
          return LOAN_ID;
        case 9: // SHIPPING_ID
          return SHIPPING_ID;
        case 10: // DUE_DATE
          return DUE_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 __USER_ID_ISSET_ID = 0;
  private static final int __CREDITOR_ID_ISSET_ID = 1;
  private static final int __PAYMENT_ID_ISSET_ID = 2;
  private static final int __AMOUNT_ISSET_ID = 3;
  private static final int __CREATED_ISSET_ID = 4;
  private static final int __UPDATED_ISSET_ID = 5;
  private static final int __DUEDATE_ISSET_ID = 6;
  private BitSet __isset_bit_vector = new BitSet(7);

  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.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.CREDITTYPE, new org.apache.thrift.meta_data.FieldMetaData("credittype", 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.UPDATED, new org.apache.thrift.meta_data.FieldMetaData("updated", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.LOAN_ID, new org.apache.thrift.meta_data.FieldMetaData("loan_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    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)));
    tmpMap.put(_Fields.DUE_DATE, new org.apache.thrift.meta_data.FieldMetaData("dueDate", 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(CreditHistory.class, metaDataMap);
  }

  public CreditHistory() {
  }

  public CreditHistory(
    long user_id,
    long creditor_id,
    long payment_id,
    double amount,
    CreditTxnType credittype,
    long created,
    long updated,
    String loan_id,
    String shipping_id,
    long dueDate)
  {
    this();
    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.credittype = credittype;
    this.created = created;
    setCreatedIsSet(true);
    this.updated = updated;
    setUpdatedIsSet(true);
    this.loan_id = loan_id;
    this.shipping_id = shipping_id;
    this.dueDate = dueDate;
    setDueDateIsSet(true);
  }

  /**
   * 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.user_id = other.user_id;
    this.creditor_id = other.creditor_id;
    this.payment_id = other.payment_id;
    this.amount = other.amount;
    if (other.isSetCredittype()) {
      this.credittype = other.credittype;
    }
    this.created = other.created;
    this.updated = other.updated;
    if (other.isSetLoan_id()) {
      this.loan_id = other.loan_id;
    }
    if (other.isSetShipping_id()) {
      this.shipping_id = other.shipping_id;
    }
    this.dueDate = other.dueDate;
  }

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

  @Override
  public void clear() {
    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.credittype = null;
    setCreatedIsSet(false);
    this.created = 0;
    setUpdatedIsSet(false);
    this.updated = 0;
    this.loan_id = null;
    this.shipping_id = null;
    setDueDateIsSet(false);
    this.dueDate = 0;
  }

  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 getCredittype() {
    return this.credittype;
  }

  /**
   * 
   * @see CreditTxnType
   */
  public void setCredittype(CreditTxnType credittype) {
    this.credittype = credittype;
  }

  public void unsetCredittype() {
    this.credittype = null;
  }

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

  public void setCredittypeIsSet(boolean value) {
    if (!value) {
      this.credittype = 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 long getUpdated() {
    return this.updated;
  }

  public void setUpdated(long updated) {
    this.updated = updated;
    setUpdatedIsSet(true);
  }

  public void unsetUpdated() {
    __isset_bit_vector.clear(__UPDATED_ISSET_ID);
  }

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

  public void setUpdatedIsSet(boolean value) {
    __isset_bit_vector.set(__UPDATED_ISSET_ID, value);
  }

  public String getLoan_id() {
    return this.loan_id;
  }

  public void setLoan_id(String loan_id) {
    this.loan_id = loan_id;
  }

  public void unsetLoan_id() {
    this.loan_id = null;
  }

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

  public void setLoan_idIsSet(boolean value) {
    if (!value) {
      this.loan_id = null;
    }
  }

  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 long getDueDate() {
    return this.dueDate;
  }

  public void setDueDate(long dueDate) {
    this.dueDate = dueDate;
    setDueDateIsSet(true);
  }

  public void unsetDueDate() {
    __isset_bit_vector.clear(__DUEDATE_ISSET_ID);
  }

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

  public void setDueDateIsSet(boolean value) {
    __isset_bit_vector.set(__DUEDATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    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 CREDITTYPE:
      if (value == null) {
        unsetCredittype();
      } else {
        setCredittype((CreditTxnType)value);
      }
      break;

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

    case UPDATED:
      if (value == null) {
        unsetUpdated();
      } else {
        setUpdated((Long)value);
      }
      break;

    case LOAN_ID:
      if (value == null) {
        unsetLoan_id();
      } else {
        setLoan_id((String)value);
      }
      break;

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

    case DUE_DATE:
      if (value == null) {
        unsetDueDate();
      } else {
        setDueDate((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    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 CREDITTYPE:
      return getCredittype();

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

    case UPDATED:
      return Long.valueOf(getUpdated());

    case LOAN_ID:
      return getLoan_id();

    case SHIPPING_ID:
      return getShipping_id();

    case DUE_DATE:
      return Long.valueOf(getDueDate());

    }
    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 USER_ID:
      return isSetUser_id();
    case CREDITOR_ID:
      return isSetCreditor_id();
    case PAYMENT_ID:
      return isSetPayment_id();
    case AMOUNT:
      return isSetAmount();
    case CREDITTYPE:
      return isSetCredittype();
    case CREATED:
      return isSetCreated();
    case UPDATED:
      return isSetUpdated();
    case LOAN_ID:
      return isSetLoan_id();
    case SHIPPING_ID:
      return isSetShipping_id();
    case DUE_DATE:
      return isSetDueDate();
    }
    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_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_credittype = true && this.isSetCredittype();
    boolean that_present_credittype = true && that.isSetCredittype();
    if (this_present_credittype || that_present_credittype) {
      if (!(this_present_credittype && that_present_credittype))
        return false;
      if (!this.credittype.equals(that.credittype))
        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_updated = true;
    boolean that_present_updated = true;
    if (this_present_updated || that_present_updated) {
      if (!(this_present_updated && that_present_updated))
        return false;
      if (this.updated != that.updated)
        return false;
    }

    boolean this_present_loan_id = true && this.isSetLoan_id();
    boolean that_present_loan_id = true && that.isSetLoan_id();
    if (this_present_loan_id || that_present_loan_id) {
      if (!(this_present_loan_id && that_present_loan_id))
        return false;
      if (!this.loan_id.equals(that.loan_id))
        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;
    }

    boolean this_present_dueDate = true;
    boolean that_present_dueDate = true;
    if (this_present_dueDate || that_present_dueDate) {
      if (!(this_present_dueDate && that_present_dueDate))
        return false;
      if (this.dueDate != that.dueDate)
        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(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(isSetCredittype()).compareTo(typedOther.isSetCredittype());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCredittype()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credittype, typedOther.credittype);
      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(isSetUpdated()).compareTo(typedOther.isSetUpdated());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdated()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updated, typedOther.updated);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLoan_id()).compareTo(typedOther.isSetLoan_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoan_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loan_id, typedOther.loan_id);
      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;
      }
    }
    lastComparison = Boolean.valueOf(isSetDueDate()).compareTo(typedOther.isSetDueDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDueDate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dueDate, typedOther.dueDate);
      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: // 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 2: // 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 3: // 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 4: // 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 5: // CREDITTYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.credittype = CreditTxnType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // 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 7: // UPDATED
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.updated = iprot.readI64();
            setUpdatedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // LOAN_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.loan_id = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // 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;
        case 10: // DUE_DATE
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.dueDate = iprot.readI64();
            setDueDateIsSet(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(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.credittype != null) {
      oprot.writeFieldBegin(CREDITTYPE_FIELD_DESC);
      oprot.writeI32(this.credittype.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREATED_FIELD_DESC);
    oprot.writeI64(this.created);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_FIELD_DESC);
    oprot.writeI64(this.updated);
    oprot.writeFieldEnd();
    if (this.loan_id != null) {
      oprot.writeFieldBegin(LOAN_ID_FIELD_DESC);
      oprot.writeString(this.loan_id);
      oprot.writeFieldEnd();
    }
    if (this.shipping_id != null) {
      oprot.writeFieldBegin(SHIPPING_ID_FIELD_DESC);
      oprot.writeString(this.shipping_id);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DUE_DATE_FIELD_DESC);
    oprot.writeI64(this.dueDate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    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("credittype:");
    if (this.credittype == null) {
      sb.append("null");
    } else {
      sb.append(this.credittype);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("created:");
    sb.append(this.created);
    first = false;
    if (!first) sb.append(", ");
    sb.append("updated:");
    sb.append(this.updated);
    first = false;
    if (!first) sb.append(", ");
    sb.append("loan_id:");
    if (this.loan_id == null) {
      sb.append("null");
    } else {
      sb.append(this.loan_id);
    }
    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;
    if (!first) sb.append(", ");
    sb.append("dueDate:");
    sb.append(this.dueDate);
    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);
    }
  }

}