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

  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 USER_REF_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("user_ref_id", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField CREDIT_LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("credit_limit", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
  private static final org.apache.thrift.protocol.TField CREDIT_BLOCKED_FIELD_DESC = new org.apache.thrift.protocol.TField("credit_blocked", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField LOAN_FIELD_DESC = new org.apache.thrift.protocol.TField("loan", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
  private static final org.apache.thrift.protocol.TField ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("active", org.apache.thrift.protocol.TType.BOOL, (short)7);
  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)8);
  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)9);

  private long user_id; // required
  private long creditor_id; // required
  private String user_ref_id; // required
  private double credit_limit; // required
  private double credit_blocked; // required
  private double loan; // required
  private boolean active; // required
  private long created; // required
  private long updated; // 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"),
    USER_REF_ID((short)3, "user_ref_id"),
    CREDIT_LIMIT((short)4, "credit_limit"),
    CREDIT_BLOCKED((short)5, "credit_blocked"),
    LOAN((short)6, "loan"),
    ACTIVE((short)7, "active"),
    CREATED((short)8, "created"),
    UPDATED((short)9, "updated");

    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: // USER_REF_ID
          return USER_REF_ID;
        case 4: // CREDIT_LIMIT
          return CREDIT_LIMIT;
        case 5: // CREDIT_BLOCKED
          return CREDIT_BLOCKED;
        case 6: // LOAN
          return LOAN;
        case 7: // ACTIVE
          return ACTIVE;
        case 8: // CREATED
          return CREATED;
        case 9: // UPDATED
          return UPDATED;
        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 __CREDIT_LIMIT_ISSET_ID = 2;
  private static final int __CREDIT_BLOCKED_ISSET_ID = 3;
  private static final int __LOAN_ISSET_ID = 4;
  private static final int __ACTIVE_ISSET_ID = 5;
  private static final int __CREATED_ISSET_ID = 6;
  private static final int __UPDATED_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  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.USER_REF_ID, new org.apache.thrift.meta_data.FieldMetaData("user_ref_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CREDIT_LIMIT, new org.apache.thrift.meta_data.FieldMetaData("credit_limit", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.CREDIT_BLOCKED, new org.apache.thrift.meta_data.FieldMetaData("credit_blocked", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.LOAN, new org.apache.thrift.meta_data.FieldMetaData("loan", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("active", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    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)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserSanction.class, metaDataMap);
  }

  public UserSanction() {
  }

  public UserSanction(
    long user_id,
    long creditor_id,
    String user_ref_id,
    double credit_limit,
    double credit_blocked,
    double loan,
    boolean active,
    long created,
    long updated)
  {
    this();
    this.user_id = user_id;
    setUser_idIsSet(true);
    this.creditor_id = creditor_id;
    setCreditor_idIsSet(true);
    this.user_ref_id = user_ref_id;
    this.credit_limit = credit_limit;
    setCredit_limitIsSet(true);
    this.credit_blocked = credit_blocked;
    setCredit_blockedIsSet(true);
    this.loan = loan;
    setLoanIsSet(true);
    this.active = active;
    setActiveIsSet(true);
    this.created = created;
    setCreatedIsSet(true);
    this.updated = updated;
    setUpdatedIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public UserSanction(UserSanction 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;
    if (other.isSetUser_ref_id()) {
      this.user_ref_id = other.user_ref_id;
    }
    this.credit_limit = other.credit_limit;
    this.credit_blocked = other.credit_blocked;
    this.loan = other.loan;
    this.active = other.active;
    this.created = other.created;
    this.updated = other.updated;
  }

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

  @Override
  public void clear() {
    setUser_idIsSet(false);
    this.user_id = 0;
    setCreditor_idIsSet(false);
    this.creditor_id = 0;
    this.user_ref_id = null;
    setCredit_limitIsSet(false);
    this.credit_limit = 0.0;
    setCredit_blockedIsSet(false);
    this.credit_blocked = 0.0;
    setLoanIsSet(false);
    this.loan = 0.0;
    setActiveIsSet(false);
    this.active = false;
    setCreatedIsSet(false);
    this.created = 0;
    setUpdatedIsSet(false);
    this.updated = 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 String getUser_ref_id() {
    return this.user_ref_id;
  }

  public void setUser_ref_id(String user_ref_id) {
    this.user_ref_id = user_ref_id;
  }

  public void unsetUser_ref_id() {
    this.user_ref_id = null;
  }

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

  public void setUser_ref_idIsSet(boolean value) {
    if (!value) {
      this.user_ref_id = null;
    }
  }

  public double getCredit_limit() {
    return this.credit_limit;
  }

  public void setCredit_limit(double credit_limit) {
    this.credit_limit = credit_limit;
    setCredit_limitIsSet(true);
  }

  public void unsetCredit_limit() {
    __isset_bit_vector.clear(__CREDIT_LIMIT_ISSET_ID);
  }

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

  public void setCredit_limitIsSet(boolean value) {
    __isset_bit_vector.set(__CREDIT_LIMIT_ISSET_ID, value);
  }

  public double getCredit_blocked() {
    return this.credit_blocked;
  }

  public void setCredit_blocked(double credit_blocked) {
    this.credit_blocked = credit_blocked;
    setCredit_blockedIsSet(true);
  }

  public void unsetCredit_blocked() {
    __isset_bit_vector.clear(__CREDIT_BLOCKED_ISSET_ID);
  }

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

  public void setCredit_blockedIsSet(boolean value) {
    __isset_bit_vector.set(__CREDIT_BLOCKED_ISSET_ID, value);
  }

  public double getLoan() {
    return this.loan;
  }

  public void setLoan(double loan) {
    this.loan = loan;
    setLoanIsSet(true);
  }

  public void unsetLoan() {
    __isset_bit_vector.clear(__LOAN_ISSET_ID);
  }

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

  public void setLoanIsSet(boolean value) {
    __isset_bit_vector.set(__LOAN_ISSET_ID, value);
  }

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

  public void setActive(boolean active) {
    this.active = active;
    setActiveIsSet(true);
  }

  public void unsetActive() {
    __isset_bit_vector.clear(__ACTIVE_ISSET_ID);
  }

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

  public void setActiveIsSet(boolean value) {
    __isset_bit_vector.set(__ACTIVE_ISSET_ID, value);
  }

  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 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 USER_REF_ID:
      if (value == null) {
        unsetUser_ref_id();
      } else {
        setUser_ref_id((String)value);
      }
      break;

    case CREDIT_LIMIT:
      if (value == null) {
        unsetCredit_limit();
      } else {
        setCredit_limit((Double)value);
      }
      break;

    case CREDIT_BLOCKED:
      if (value == null) {
        unsetCredit_blocked();
      } else {
        setCredit_blocked((Double)value);
      }
      break;

    case LOAN:
      if (value == null) {
        unsetLoan();
      } else {
        setLoan((Double)value);
      }
      break;

    case ACTIVE:
      if (value == null) {
        unsetActive();
      } else {
        setActive((Boolean)value);
      }
      break;

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

    case UPDATED:
      if (value == null) {
        unsetUpdated();
      } else {
        setUpdated((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 USER_REF_ID:
      return getUser_ref_id();

    case CREDIT_LIMIT:
      return Double.valueOf(getCredit_limit());

    case CREDIT_BLOCKED:
      return Double.valueOf(getCredit_blocked());

    case LOAN:
      return Double.valueOf(getLoan());

    case ACTIVE:
      return Boolean.valueOf(isActive());

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

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

    }
    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 USER_REF_ID:
      return isSetUser_ref_id();
    case CREDIT_LIMIT:
      return isSetCredit_limit();
    case CREDIT_BLOCKED:
      return isSetCredit_blocked();
    case LOAN:
      return isSetLoan();
    case ACTIVE:
      return isSetActive();
    case CREATED:
      return isSetCreated();
    case UPDATED:
      return isSetUpdated();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(UserSanction 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_user_ref_id = true && this.isSetUser_ref_id();
    boolean that_present_user_ref_id = true && that.isSetUser_ref_id();
    if (this_present_user_ref_id || that_present_user_ref_id) {
      if (!(this_present_user_ref_id && that_present_user_ref_id))
        return false;
      if (!this.user_ref_id.equals(that.user_ref_id))
        return false;
    }

    boolean this_present_credit_limit = true;
    boolean that_present_credit_limit = true;
    if (this_present_credit_limit || that_present_credit_limit) {
      if (!(this_present_credit_limit && that_present_credit_limit))
        return false;
      if (this.credit_limit != that.credit_limit)
        return false;
    }

    boolean this_present_credit_blocked = true;
    boolean that_present_credit_blocked = true;
    if (this_present_credit_blocked || that_present_credit_blocked) {
      if (!(this_present_credit_blocked && that_present_credit_blocked))
        return false;
      if (this.credit_blocked != that.credit_blocked)
        return false;
    }

    boolean this_present_loan = true;
    boolean that_present_loan = true;
    if (this_present_loan || that_present_loan) {
      if (!(this_present_loan && that_present_loan))
        return false;
      if (this.loan != that.loan)
        return false;
    }

    boolean this_present_active = true;
    boolean that_present_active = true;
    if (this_present_active || that_present_active) {
      if (!(this_present_active && that_present_active))
        return false;
      if (this.active != that.active)
        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;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    UserSanction typedOther = (UserSanction)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(isSetUser_ref_id()).compareTo(typedOther.isSetUser_ref_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUser_ref_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user_ref_id, typedOther.user_ref_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCredit_limit()).compareTo(typedOther.isSetCredit_limit());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCredit_limit()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credit_limit, typedOther.credit_limit);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCredit_blocked()).compareTo(typedOther.isSetCredit_blocked());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCredit_blocked()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credit_blocked, typedOther.credit_blocked);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLoan()).compareTo(typedOther.isSetLoan());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoan()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loan, typedOther.loan);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetActive()).compareTo(typedOther.isSetActive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetActive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.active, typedOther.active);
      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;
      }
    }
    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: // USER_REF_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.user_ref_id = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CREDIT_LIMIT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.credit_limit = iprot.readDouble();
            setCredit_limitIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // CREDIT_BLOCKED
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.credit_blocked = iprot.readDouble();
            setCredit_blockedIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // LOAN
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.loan = iprot.readDouble();
            setLoanIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // ACTIVE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.active = iprot.readBool();
            setActiveIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // 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 9: // 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;
        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();
    if (this.user_ref_id != null) {
      oprot.writeFieldBegin(USER_REF_ID_FIELD_DESC);
      oprot.writeString(this.user_ref_id);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CREDIT_LIMIT_FIELD_DESC);
    oprot.writeDouble(this.credit_limit);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREDIT_BLOCKED_FIELD_DESC);
    oprot.writeDouble(this.credit_blocked);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(LOAN_FIELD_DESC);
    oprot.writeDouble(this.loan);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ACTIVE_FIELD_DESC);
    oprot.writeBool(this.active);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATED_FIELD_DESC);
    oprot.writeI64(this.created);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(UPDATED_FIELD_DESC);
    oprot.writeI64(this.updated);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("UserSanction(");
    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("user_ref_id:");
    if (this.user_ref_id == null) {
      sb.append("null");
    } else {
      sb.append(this.user_ref_id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("credit_limit:");
    sb.append(this.credit_limit);
    first = false;
    if (!first) sb.append(", ");
    sb.append("credit_blocked:");
    sb.append(this.credit_blocked);
    first = false;
    if (!first) sb.append(", ");
    sb.append("loan:");
    sb.append(this.loan);
    first = false;
    if (!first) sb.append(", ");
    sb.append("active:");
    sb.append(this.active);
    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;
    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);
    }
  }

}