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.logistics;

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

  private static final org.apache.thrift.protocol.TField PROVIDER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("providerId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField IS_COD_AVAILABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("isCodAvailable", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField IS_OTG_AVAILABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("isOtgAvailable", org.apache.thrift.protocol.TType.BOOL, (short)3);
  private static final org.apache.thrift.protocol.TField DELAY_DAYS_FIELD_DESC = new org.apache.thrift.protocol.TField("delayDays", org.apache.thrift.protocol.TType.I64, (short)4);

  private long providerId; // required
  private boolean isCodAvailable; // required
  private boolean isOtgAvailable; // required
  private long delayDays; // 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 {
    PROVIDER_ID((short)1, "providerId"),
    IS_COD_AVAILABLE((short)2, "isCodAvailable"),
    IS_OTG_AVAILABLE((short)3, "isOtgAvailable"),
    DELAY_DAYS((short)4, "delayDays");

    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: // PROVIDER_ID
          return PROVIDER_ID;
        case 2: // IS_COD_AVAILABLE
          return IS_COD_AVAILABLE;
        case 3: // IS_OTG_AVAILABLE
          return IS_OTG_AVAILABLE;
        case 4: // DELAY_DAYS
          return DELAY_DAYS;
        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 __PROVIDERID_ISSET_ID = 0;
  private static final int __ISCODAVAILABLE_ISSET_ID = 1;
  private static final int __ISOTGAVAILABLE_ISSET_ID = 2;
  private static final int __DELAYDAYS_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  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.PROVIDER_ID, new org.apache.thrift.meta_data.FieldMetaData("providerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.IS_COD_AVAILABLE, new org.apache.thrift.meta_data.FieldMetaData("isCodAvailable", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_OTG_AVAILABLE, new org.apache.thrift.meta_data.FieldMetaData("isOtgAvailable", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.DELAY_DAYS, new org.apache.thrift.meta_data.FieldMetaData("delayDays", 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(ProviderInfo.class, metaDataMap);
  }

  public ProviderInfo() {
  }

  public ProviderInfo(
    long providerId,
    boolean isCodAvailable,
    boolean isOtgAvailable,
    long delayDays)
  {
    this();
    this.providerId = providerId;
    setProviderIdIsSet(true);
    this.isCodAvailable = isCodAvailable;
    setIsCodAvailableIsSet(true);
    this.isOtgAvailable = isOtgAvailable;
    setIsOtgAvailableIsSet(true);
    this.delayDays = delayDays;
    setDelayDaysIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ProviderInfo(ProviderInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.providerId = other.providerId;
    this.isCodAvailable = other.isCodAvailable;
    this.isOtgAvailable = other.isOtgAvailable;
    this.delayDays = other.delayDays;
  }

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

  @Override
  public void clear() {
    setProviderIdIsSet(false);
    this.providerId = 0;
    setIsCodAvailableIsSet(false);
    this.isCodAvailable = false;
    setIsOtgAvailableIsSet(false);
    this.isOtgAvailable = false;
    setDelayDaysIsSet(false);
    this.delayDays = 0;
  }

  public long getProviderId() {
    return this.providerId;
  }

  public void setProviderId(long providerId) {
    this.providerId = providerId;
    setProviderIdIsSet(true);
  }

  public void unsetProviderId() {
    __isset_bit_vector.clear(__PROVIDERID_ISSET_ID);
  }

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

  public void setProviderIdIsSet(boolean value) {
    __isset_bit_vector.set(__PROVIDERID_ISSET_ID, value);
  }

  public boolean isIsCodAvailable() {
    return this.isCodAvailable;
  }

  public void setIsCodAvailable(boolean isCodAvailable) {
    this.isCodAvailable = isCodAvailable;
    setIsCodAvailableIsSet(true);
  }

  public void unsetIsCodAvailable() {
    __isset_bit_vector.clear(__ISCODAVAILABLE_ISSET_ID);
  }

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

  public void setIsCodAvailableIsSet(boolean value) {
    __isset_bit_vector.set(__ISCODAVAILABLE_ISSET_ID, value);
  }

  public boolean isIsOtgAvailable() {
    return this.isOtgAvailable;
  }

  public void setIsOtgAvailable(boolean isOtgAvailable) {
    this.isOtgAvailable = isOtgAvailable;
    setIsOtgAvailableIsSet(true);
  }

  public void unsetIsOtgAvailable() {
    __isset_bit_vector.clear(__ISOTGAVAILABLE_ISSET_ID);
  }

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

  public void setIsOtgAvailableIsSet(boolean value) {
    __isset_bit_vector.set(__ISOTGAVAILABLE_ISSET_ID, value);
  }

  public long getDelayDays() {
    return this.delayDays;
  }

  public void setDelayDays(long delayDays) {
    this.delayDays = delayDays;
    setDelayDaysIsSet(true);
  }

  public void unsetDelayDays() {
    __isset_bit_vector.clear(__DELAYDAYS_ISSET_ID);
  }

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

  public void setDelayDaysIsSet(boolean value) {
    __isset_bit_vector.set(__DELAYDAYS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case PROVIDER_ID:
      if (value == null) {
        unsetProviderId();
      } else {
        setProviderId((Long)value);
      }
      break;

    case IS_COD_AVAILABLE:
      if (value == null) {
        unsetIsCodAvailable();
      } else {
        setIsCodAvailable((Boolean)value);
      }
      break;

    case IS_OTG_AVAILABLE:
      if (value == null) {
        unsetIsOtgAvailable();
      } else {
        setIsOtgAvailable((Boolean)value);
      }
      break;

    case DELAY_DAYS:
      if (value == null) {
        unsetDelayDays();
      } else {
        setDelayDays((Long)value);
      }
      break;

    }
  }

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

    case IS_COD_AVAILABLE:
      return Boolean.valueOf(isIsCodAvailable());

    case IS_OTG_AVAILABLE:
      return Boolean.valueOf(isIsOtgAvailable());

    case DELAY_DAYS:
      return Long.valueOf(getDelayDays());

    }
    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 PROVIDER_ID:
      return isSetProviderId();
    case IS_COD_AVAILABLE:
      return isSetIsCodAvailable();
    case IS_OTG_AVAILABLE:
      return isSetIsOtgAvailable();
    case DELAY_DAYS:
      return isSetDelayDays();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_providerId = true;
    boolean that_present_providerId = true;
    if (this_present_providerId || that_present_providerId) {
      if (!(this_present_providerId && that_present_providerId))
        return false;
      if (this.providerId != that.providerId)
        return false;
    }

    boolean this_present_isCodAvailable = true;
    boolean that_present_isCodAvailable = true;
    if (this_present_isCodAvailable || that_present_isCodAvailable) {
      if (!(this_present_isCodAvailable && that_present_isCodAvailable))
        return false;
      if (this.isCodAvailable != that.isCodAvailable)
        return false;
    }

    boolean this_present_isOtgAvailable = true;
    boolean that_present_isOtgAvailable = true;
    if (this_present_isOtgAvailable || that_present_isOtgAvailable) {
      if (!(this_present_isOtgAvailable && that_present_isOtgAvailable))
        return false;
      if (this.isOtgAvailable != that.isOtgAvailable)
        return false;
    }

    boolean this_present_delayDays = true;
    boolean that_present_delayDays = true;
    if (this_present_delayDays || that_present_delayDays) {
      if (!(this_present_delayDays && that_present_delayDays))
        return false;
      if (this.delayDays != that.delayDays)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetProviderId()).compareTo(typedOther.isSetProviderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProviderId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.providerId, typedOther.providerId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsCodAvailable()).compareTo(typedOther.isSetIsCodAvailable());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsCodAvailable()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isCodAvailable, typedOther.isCodAvailable);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsOtgAvailable()).compareTo(typedOther.isSetIsOtgAvailable());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsOtgAvailable()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOtgAvailable, typedOther.isOtgAvailable);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDelayDays()).compareTo(typedOther.isSetDelayDays());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDelayDays()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delayDays, typedOther.delayDays);
      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: // PROVIDER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.providerId = iprot.readI64();
            setProviderIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // IS_COD_AVAILABLE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isCodAvailable = iprot.readBool();
            setIsCodAvailableIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // IS_OTG_AVAILABLE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isOtgAvailable = iprot.readBool();
            setIsOtgAvailableIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // DELAY_DAYS
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.delayDays = iprot.readI64();
            setDelayDaysIsSet(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(PROVIDER_ID_FIELD_DESC);
    oprot.writeI64(this.providerId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_COD_AVAILABLE_FIELD_DESC);
    oprot.writeBool(this.isCodAvailable);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IS_OTG_AVAILABLE_FIELD_DESC);
    oprot.writeBool(this.isOtgAvailable);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DELAY_DAYS_FIELD_DESC);
    oprot.writeI64(this.delayDays);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("providerId:");
    sb.append(this.providerId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isCodAvailable:");
    sb.append(this.isCodAvailable);
    first = false;
    if (!first) sb.append(", ");
    sb.append("isOtgAvailable:");
    sb.append(this.isOtgAvailable);
    first = false;
    if (!first) sb.append(", ");
    sb.append("delayDays:");
    sb.append(this.delayDays);
    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);
    }
  }

}