Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.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 OutstandingPayments implements org.apache.thrift.TBase<OutstandingPayments, OutstandingPayments._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("OutstandingPayments");

  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 COUNTER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_name", org.apache.thrift.protocol.TType.STRING, (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 TOTAL_AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalAmount", org.apache.thrift.protocol.TType.DOUBLE, (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 long user_id; // required
  private String counter_name; // required
  private long creditor_id; // required
  private long payment_id; // required
  private double totalAmount; // required
  private long created; // 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"),
    COUNTER_NAME((short)2, "counter_name"),
    CREDITOR_ID((short)3, "creditor_id"),
    PAYMENT_ID((short)4, "payment_id"),
    TOTAL_AMOUNT((short)5, "totalAmount"),
    CREATED((short)6, "created");

    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: // COUNTER_NAME
          return COUNTER_NAME;
        case 3: // CREDITOR_ID
          return CREDITOR_ID;
        case 4: // PAYMENT_ID
          return PAYMENT_ID;
        case 5: // TOTAL_AMOUNT
          return TOTAL_AMOUNT;
        case 6: // CREATED
          return CREATED;
        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 __TOTALAMOUNT_ISSET_ID = 3;
  private static final int __CREATED_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  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.COUNTER_NAME, new org.apache.thrift.meta_data.FieldMetaData("counter_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    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.TOTAL_AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("totalAmount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    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)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(OutstandingPayments.class, metaDataMap);
  }

  public OutstandingPayments() {
  }

  public OutstandingPayments(
    long user_id,
    String counter_name,
    long creditor_id,
    long payment_id,
    double totalAmount,
    long created)
  {
    this();
    this.user_id = user_id;
    setUser_idIsSet(true);
    this.counter_name = counter_name;
    this.creditor_id = creditor_id;
    setCreditor_idIsSet(true);
    this.payment_id = payment_id;
    setPayment_idIsSet(true);
    this.totalAmount = totalAmount;
    setTotalAmountIsSet(true);
    this.created = created;
    setCreatedIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public OutstandingPayments(OutstandingPayments other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.user_id = other.user_id;
    if (other.isSetCounter_name()) {
      this.counter_name = other.counter_name;
    }
    this.creditor_id = other.creditor_id;
    this.payment_id = other.payment_id;
    this.totalAmount = other.totalAmount;
    this.created = other.created;
  }

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

  @Override
  public void clear() {
    setUser_idIsSet(false);
    this.user_id = 0;
    this.counter_name = null;
    setCreditor_idIsSet(false);
    this.creditor_id = 0;
    setPayment_idIsSet(false);
    this.payment_id = 0;
    setTotalAmountIsSet(false);
    this.totalAmount = 0.0;
    setCreatedIsSet(false);
    this.created = 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 String getCounter_name() {
    return this.counter_name;
  }

  public void setCounter_name(String counter_name) {
    this.counter_name = counter_name;
  }

  public void unsetCounter_name() {
    this.counter_name = null;
  }

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

  public void setCounter_nameIsSet(boolean value) {
    if (!value) {
      this.counter_name = null;
    }
  }

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

  public void setTotalAmount(double totalAmount) {
    this.totalAmount = totalAmount;
    setTotalAmountIsSet(true);
  }

  public void unsetTotalAmount() {
    __isset_bit_vector.clear(__TOTALAMOUNT_ISSET_ID);
  }

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

  public void setTotalAmountIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALAMOUNT_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 void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case USER_ID:
      if (value == null) {
        unsetUser_id();
      } else {
        setUser_id((Long)value);
      }
      break;

    case COUNTER_NAME:
      if (value == null) {
        unsetCounter_name();
      } else {
        setCounter_name((String)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 TOTAL_AMOUNT:
      if (value == null) {
        unsetTotalAmount();
      } else {
        setTotalAmount((Double)value);
      }
      break;

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

    }
  }

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

    case COUNTER_NAME:
      return getCounter_name();

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

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

    case TOTAL_AMOUNT:
      return Double.valueOf(getTotalAmount());

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

    }
    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 COUNTER_NAME:
      return isSetCounter_name();
    case CREDITOR_ID:
      return isSetCreditor_id();
    case PAYMENT_ID:
      return isSetPayment_id();
    case TOTAL_AMOUNT:
      return isSetTotalAmount();
    case CREATED:
      return isSetCreated();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(OutstandingPayments 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_counter_name = true && this.isSetCounter_name();
    boolean that_present_counter_name = true && that.isSetCounter_name();
    if (this_present_counter_name || that_present_counter_name) {
      if (!(this_present_counter_name && that_present_counter_name))
        return false;
      if (!this.counter_name.equals(that.counter_name))
        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_totalAmount = true;
    boolean that_present_totalAmount = true;
    if (this_present_totalAmount || that_present_totalAmount) {
      if (!(this_present_totalAmount && that_present_totalAmount))
        return false;
      if (this.totalAmount != that.totalAmount)
        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;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    OutstandingPayments typedOther = (OutstandingPayments)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(isSetCounter_name()).compareTo(typedOther.isSetCounter_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCounter_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter_name, typedOther.counter_name);
      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(isSetTotalAmount()).compareTo(typedOther.isSetTotalAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalAmount, typedOther.totalAmount);
      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;
      }
    }
    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: // COUNTER_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.counter_name = iprot.readString();
          } 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: // TOTAL_AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.totalAmount = iprot.readDouble();
            setTotalAmountIsSet(true);
          } 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;
        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();
    if (this.counter_name != null) {
      oprot.writeFieldBegin(COUNTER_NAME_FIELD_DESC);
      oprot.writeString(this.counter_name);
      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(TOTAL_AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.totalAmount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATED_FIELD_DESC);
    oprot.writeI64(this.created);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

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

}