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

  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 USER_SANCTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("userSanctions", org.apache.thrift.protocol.TType.LIST, (short)3);

  private boolean hasMore; // required
  private long totalCount; // required
  private List<UserSanction> userSanctions; // 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"),
    USER_SANCTIONS((short)3, "userSanctions");

    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: // USER_SANCTIONS
          return USER_SANCTIONS;
        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.USER_SANCTIONS, new org.apache.thrift.meta_data.FieldMetaData("userSanctions", 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, UserSanction.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PaginatedUserSanction.class, metaDataMap);
  }

  public PaginatedUserSanction() {
  }

  public PaginatedUserSanction(
    boolean hasMore,
    long totalCount,
    List<UserSanction> userSanctions)
  {
    this();
    this.hasMore = hasMore;
    setHasMoreIsSet(true);
    this.totalCount = totalCount;
    setTotalCountIsSet(true);
    this.userSanctions = userSanctions;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public PaginatedUserSanction(PaginatedUserSanction other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.hasMore = other.hasMore;
    this.totalCount = other.totalCount;
    if (other.isSetUserSanctions()) {
      List<UserSanction> __this__userSanctions = new ArrayList<UserSanction>();
      for (UserSanction other_element : other.userSanctions) {
        __this__userSanctions.add(new UserSanction(other_element));
      }
      this.userSanctions = __this__userSanctions;
    }
  }

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

  @Override
  public void clear() {
    setHasMoreIsSet(false);
    this.hasMore = false;
    setTotalCountIsSet(false);
    this.totalCount = 0;
    this.userSanctions = 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 getUserSanctionsSize() {
    return (this.userSanctions == null) ? 0 : this.userSanctions.size();
  }

  public java.util.Iterator<UserSanction> getUserSanctionsIterator() {
    return (this.userSanctions == null) ? null : this.userSanctions.iterator();
  }

  public void addToUserSanctions(UserSanction elem) {
    if (this.userSanctions == null) {
      this.userSanctions = new ArrayList<UserSanction>();
    }
    this.userSanctions.add(elem);
  }

  public List<UserSanction> getUserSanctions() {
    return this.userSanctions;
  }

  public void setUserSanctions(List<UserSanction> userSanctions) {
    this.userSanctions = userSanctions;
  }

  public void unsetUserSanctions() {
    this.userSanctions = null;
  }

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

  public void setUserSanctionsIsSet(boolean value) {
    if (!value) {
      this.userSanctions = 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 USER_SANCTIONS:
      if (value == null) {
        unsetUserSanctions();
      } else {
        setUserSanctions((List<UserSanction>)value);
      }
      break;

    }
  }

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

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

    case USER_SANCTIONS:
      return getUserSanctions();

    }
    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 USER_SANCTIONS:
      return isSetUserSanctions();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(PaginatedUserSanction 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_userSanctions = true && this.isSetUserSanctions();
    boolean that_present_userSanctions = true && that.isSetUserSanctions();
    if (this_present_userSanctions || that_present_userSanctions) {
      if (!(this_present_userSanctions && that_present_userSanctions))
        return false;
      if (!this.userSanctions.equals(that.userSanctions))
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    PaginatedUserSanction typedOther = (PaginatedUserSanction)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(isSetUserSanctions()).compareTo(typedOther.isSetUserSanctions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserSanctions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userSanctions, typedOther.userSanctions);
      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: // USER_SANCTIONS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list60 = iprot.readListBegin();
              this.userSanctions = new ArrayList<UserSanction>(_list60.size);
              for (int _i61 = 0; _i61 < _list60.size; ++_i61)
              {
                UserSanction _elem62; // required
                _elem62 = new UserSanction();
                _elem62.read(iprot);
                this.userSanctions.add(_elem62);
              }
              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.userSanctions != null) {
      oprot.writeFieldBegin(USER_SANCTIONS_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.userSanctions.size()));
        for (UserSanction _iter63 : this.userSanctions)
        {
          _iter63.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("PaginatedUserSanction(");
    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("userSanctions:");
    if (this.userSanctions == null) {
      sb.append("null");
    } else {
      sb.append(this.userSanctions);
    }
    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);
    }
  }

}