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

  private static final org.apache.thrift.protocol.TField HAS_MORE_FIELD_DESC = new org.apache.thrift.protocol.TField("hasMore", org.apache.thrift.protocol.TType.BOOL, (short)1);
  private static final org.apache.thrift.protocol.TField TOTAL_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("totalCount", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField CREDIT_HISTORY_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("creditHistoryList", org.apache.thrift.protocol.TType.LIST, (short)3);

  private boolean hasMore; // required
  private long totalCount; // required
  private List<CreditHistory> creditHistoryList; // 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 {
    HAS_MORE((short)1, "hasMore"),
    TOTAL_COUNT((short)2, "totalCount"),
    CREDIT_HISTORY_LIST((short)3, "creditHistoryList");

    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: // HAS_MORE
          return HAS_MORE;
        case 2: // TOTAL_COUNT
          return TOTAL_COUNT;
        case 3: // CREDIT_HISTORY_LIST
          return CREDIT_HISTORY_LIST;
        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 __HASMORE_ISSET_ID = 0;
  private static final int __TOTALCOUNT_ISSET_ID = 1;
  private BitSet __isset_bit_vector = new BitSet(2);

  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.HAS_MORE, new org.apache.thrift.meta_data.FieldMetaData("hasMore", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.TOTAL_COUNT, new org.apache.thrift.meta_data.FieldMetaData("totalCount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CREDIT_HISTORY_LIST, new org.apache.thrift.meta_data.FieldMetaData("creditHistoryList", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CreditHistory.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PaginatedCreditHistory.class, metaDataMap);
  }

  public PaginatedCreditHistory() {
  }

  public PaginatedCreditHistory(
    boolean hasMore,
    long totalCount,
    List<CreditHistory> creditHistoryList)
  {
    this();
    this.hasMore = hasMore;
    setHasMoreIsSet(true);
    this.totalCount = totalCount;
    setTotalCountIsSet(true);
    this.creditHistoryList = creditHistoryList;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public PaginatedCreditHistory(PaginatedCreditHistory other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.hasMore = other.hasMore;
    this.totalCount = other.totalCount;
    if (other.isSetCreditHistoryList()) {
      List<CreditHistory> __this__creditHistoryList = new ArrayList<CreditHistory>();
      for (CreditHistory other_element : other.creditHistoryList) {
        __this__creditHistoryList.add(new CreditHistory(other_element));
      }
      this.creditHistoryList = __this__creditHistoryList;
    }
  }

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

  @Override
  public void clear() {
    setHasMoreIsSet(false);
    this.hasMore = false;
    setTotalCountIsSet(false);
    this.totalCount = 0;
    this.creditHistoryList = null;
  }

  public boolean isHasMore() {
    return this.hasMore;
  }

  public void setHasMore(boolean hasMore) {
    this.hasMore = hasMore;
    setHasMoreIsSet(true);
  }

  public void unsetHasMore() {
    __isset_bit_vector.clear(__HASMORE_ISSET_ID);
  }

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

  public void setHasMoreIsSet(boolean value) {
    __isset_bit_vector.set(__HASMORE_ISSET_ID, value);
  }

  public long getTotalCount() {
    return this.totalCount;
  }

  public void setTotalCount(long totalCount) {
    this.totalCount = totalCount;
    setTotalCountIsSet(true);
  }

  public void unsetTotalCount() {
    __isset_bit_vector.clear(__TOTALCOUNT_ISSET_ID);
  }

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

  public void setTotalCountIsSet(boolean value) {
    __isset_bit_vector.set(__TOTALCOUNT_ISSET_ID, value);
  }

  public int getCreditHistoryListSize() {
    return (this.creditHistoryList == null) ? 0 : this.creditHistoryList.size();
  }

  public java.util.Iterator<CreditHistory> getCreditHistoryListIterator() {
    return (this.creditHistoryList == null) ? null : this.creditHistoryList.iterator();
  }

  public void addToCreditHistoryList(CreditHistory elem) {
    if (this.creditHistoryList == null) {
      this.creditHistoryList = new ArrayList<CreditHistory>();
    }
    this.creditHistoryList.add(elem);
  }

  public List<CreditHistory> getCreditHistoryList() {
    return this.creditHistoryList;
  }

  public void setCreditHistoryList(List<CreditHistory> creditHistoryList) {
    this.creditHistoryList = creditHistoryList;
  }

  public void unsetCreditHistoryList() {
    this.creditHistoryList = null;
  }

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

  public void setCreditHistoryListIsSet(boolean value) {
    if (!value) {
      this.creditHistoryList = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case HAS_MORE:
      if (value == null) {
        unsetHasMore();
      } else {
        setHasMore((Boolean)value);
      }
      break;

    case TOTAL_COUNT:
      if (value == null) {
        unsetTotalCount();
      } else {
        setTotalCount((Long)value);
      }
      break;

    case CREDIT_HISTORY_LIST:
      if (value == null) {
        unsetCreditHistoryList();
      } else {
        setCreditHistoryList((List<CreditHistory>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case HAS_MORE:
      return Boolean.valueOf(isHasMore());

    case TOTAL_COUNT:
      return Long.valueOf(getTotalCount());

    case CREDIT_HISTORY_LIST:
      return getCreditHistoryList();

    }
    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 HAS_MORE:
      return isSetHasMore();
    case TOTAL_COUNT:
      return isSetTotalCount();
    case CREDIT_HISTORY_LIST:
      return isSetCreditHistoryList();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_hasMore = true;
    boolean that_present_hasMore = true;
    if (this_present_hasMore || that_present_hasMore) {
      if (!(this_present_hasMore && that_present_hasMore))
        return false;
      if (this.hasMore != that.hasMore)
        return false;
    }

    boolean this_present_totalCount = true;
    boolean that_present_totalCount = true;
    if (this_present_totalCount || that_present_totalCount) {
      if (!(this_present_totalCount && that_present_totalCount))
        return false;
      if (this.totalCount != that.totalCount)
        return false;
    }

    boolean this_present_creditHistoryList = true && this.isSetCreditHistoryList();
    boolean that_present_creditHistoryList = true && that.isSetCreditHistoryList();
    if (this_present_creditHistoryList || that_present_creditHistoryList) {
      if (!(this_present_creditHistoryList && that_present_creditHistoryList))
        return false;
      if (!this.creditHistoryList.equals(that.creditHistoryList))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetHasMore()).compareTo(typedOther.isSetHasMore());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHasMore()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasMore, typedOther.hasMore);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTotalCount()).compareTo(typedOther.isSetTotalCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotalCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.totalCount, typedOther.totalCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreditHistoryList()).compareTo(typedOther.isSetCreditHistoryList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreditHistoryList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creditHistoryList, typedOther.creditHistoryList);
      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: // HAS_MORE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.hasMore = iprot.readBool();
            setHasMoreIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // TOTAL_COUNT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.totalCount = iprot.readI64();
            setTotalCountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // CREDIT_HISTORY_LIST
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
              this.creditHistoryList = new ArrayList<CreditHistory>(_list64.size);
              for (int _i65 = 0; _i65 < _list64.size; ++_i65)
              {
                CreditHistory _elem66; // required
                _elem66 = new CreditHistory();
                _elem66.read(iprot);
                this.creditHistoryList.add(_elem66);
              }
              iprot.readListEnd();
            }
          } 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(HAS_MORE_FIELD_DESC);
    oprot.writeBool(this.hasMore);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_COUNT_FIELD_DESC);
    oprot.writeI64(this.totalCount);
    oprot.writeFieldEnd();
    if (this.creditHistoryList != null) {
      oprot.writeFieldBegin(CREDIT_HISTORY_LIST_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.creditHistoryList.size()));
        for (CreditHistory _iter67 : this.creditHistoryList)
        {
          _iter67.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("hasMore:");
    sb.append(this.hasMore);
    first = false;
    if (!first) sb.append(", ");
    sb.append("totalCount:");
    sb.append(this.totalCount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("creditHistoryList:");
    if (this.creditHistoryList == null) {
      sb.append("null");
    } else {
      sb.append(this.creditHistoryList);
    }
    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);
    }
  }

}