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

  private static final org.apache.thrift.protocol.TField HOTSPOT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("hotspotId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SALT_FIELD_DESC = new org.apache.thrift.protocol.TField("salt", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField HOTSPOT_SERVICE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("hotspotServiceType", org.apache.thrift.protocol.TType.I32, (short)3);

  private String hotspotId; // required
  private String salt; // required
  private HotspotServiceType hotspotServiceType; // 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 {
    HOTSPOT_ID((short)1, "hotspotId"),
    SALT((short)2, "salt"),
    /**
     * 
     * @see HotspotServiceType
     */
    HOTSPOT_SERVICE_TYPE((short)3, "hotspotServiceType");

    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: // HOTSPOT_ID
          return HOTSPOT_ID;
        case 2: // SALT
          return SALT;
        case 3: // HOTSPOT_SERVICE_TYPE
          return HOTSPOT_SERVICE_TYPE;
        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

  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.HOTSPOT_ID, new org.apache.thrift.meta_data.FieldMetaData("hotspotId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SALT, new org.apache.thrift.meta_data.FieldMetaData("salt", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HOTSPOT_SERVICE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("hotspotServiceType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, HotspotServiceType.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(HotspotTokens.class, metaDataMap);
  }

  public HotspotTokens() {
  }

  public HotspotTokens(
    String hotspotId,
    String salt,
    HotspotServiceType hotspotServiceType)
  {
    this();
    this.hotspotId = hotspotId;
    this.salt = salt;
    this.hotspotServiceType = hotspotServiceType;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public HotspotTokens(HotspotTokens other) {
    if (other.isSetHotspotId()) {
      this.hotspotId = other.hotspotId;
    }
    if (other.isSetSalt()) {
      this.salt = other.salt;
    }
    if (other.isSetHotspotServiceType()) {
      this.hotspotServiceType = other.hotspotServiceType;
    }
  }

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

  @Override
  public void clear() {
    this.hotspotId = null;
    this.salt = null;
    this.hotspotServiceType = null;
  }

  public String getHotspotId() {
    return this.hotspotId;
  }

  public void setHotspotId(String hotspotId) {
    this.hotspotId = hotspotId;
  }

  public void unsetHotspotId() {
    this.hotspotId = null;
  }

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

  public void setHotspotIdIsSet(boolean value) {
    if (!value) {
      this.hotspotId = null;
    }
  }

  public String getSalt() {
    return this.salt;
  }

  public void setSalt(String salt) {
    this.salt = salt;
  }

  public void unsetSalt() {
    this.salt = null;
  }

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

  public void setSaltIsSet(boolean value) {
    if (!value) {
      this.salt = null;
    }
  }

  /**
   * 
   * @see HotspotServiceType
   */
  public HotspotServiceType getHotspotServiceType() {
    return this.hotspotServiceType;
  }

  /**
   * 
   * @see HotspotServiceType
   */
  public void setHotspotServiceType(HotspotServiceType hotspotServiceType) {
    this.hotspotServiceType = hotspotServiceType;
  }

  public void unsetHotspotServiceType() {
    this.hotspotServiceType = null;
  }

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

  public void setHotspotServiceTypeIsSet(boolean value) {
    if (!value) {
      this.hotspotServiceType = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case HOTSPOT_ID:
      if (value == null) {
        unsetHotspotId();
      } else {
        setHotspotId((String)value);
      }
      break;

    case SALT:
      if (value == null) {
        unsetSalt();
      } else {
        setSalt((String)value);
      }
      break;

    case HOTSPOT_SERVICE_TYPE:
      if (value == null) {
        unsetHotspotServiceType();
      } else {
        setHotspotServiceType((HotspotServiceType)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case HOTSPOT_ID:
      return getHotspotId();

    case SALT:
      return getSalt();

    case HOTSPOT_SERVICE_TYPE:
      return getHotspotServiceType();

    }
    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 HOTSPOT_ID:
      return isSetHotspotId();
    case SALT:
      return isSetSalt();
    case HOTSPOT_SERVICE_TYPE:
      return isSetHotspotServiceType();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_hotspotId = true && this.isSetHotspotId();
    boolean that_present_hotspotId = true && that.isSetHotspotId();
    if (this_present_hotspotId || that_present_hotspotId) {
      if (!(this_present_hotspotId && that_present_hotspotId))
        return false;
      if (!this.hotspotId.equals(that.hotspotId))
        return false;
    }

    boolean this_present_salt = true && this.isSetSalt();
    boolean that_present_salt = true && that.isSetSalt();
    if (this_present_salt || that_present_salt) {
      if (!(this_present_salt && that_present_salt))
        return false;
      if (!this.salt.equals(that.salt))
        return false;
    }

    boolean this_present_hotspotServiceType = true && this.isSetHotspotServiceType();
    boolean that_present_hotspotServiceType = true && that.isSetHotspotServiceType();
    if (this_present_hotspotServiceType || that_present_hotspotServiceType) {
      if (!(this_present_hotspotServiceType && that_present_hotspotServiceType))
        return false;
      if (!this.hotspotServiceType.equals(that.hotspotServiceType))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetHotspotId()).compareTo(typedOther.isSetHotspotId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHotspotId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hotspotId, typedOther.hotspotId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSalt()).compareTo(typedOther.isSetSalt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSalt()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.salt, typedOther.salt);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHotspotServiceType()).compareTo(typedOther.isSetHotspotServiceType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHotspotServiceType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hotspotServiceType, typedOther.hotspotServiceType);
      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: // HOTSPOT_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.hotspotId = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // SALT
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.salt = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // HOTSPOT_SERVICE_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.hotspotServiceType = HotspotServiceType.findByValue(iprot.readI32());
          } 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);
    if (this.hotspotId != null) {
      oprot.writeFieldBegin(HOTSPOT_ID_FIELD_DESC);
      oprot.writeString(this.hotspotId);
      oprot.writeFieldEnd();
    }
    if (this.salt != null) {
      oprot.writeFieldBegin(SALT_FIELD_DESC);
      oprot.writeString(this.salt);
      oprot.writeFieldEnd();
    }
    if (this.hotspotServiceType != null) {
      oprot.writeFieldBegin(HOTSPOT_SERVICE_TYPE_FIELD_DESC);
      oprot.writeI32(this.hotspotServiceType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

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

}