Subversion Repositories SmartDukaan

Rev

Rev 2983 | Blame | Compare with Previous | 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.catalog;

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

  private static final org.apache.thrift.protocol.TField IS_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("isActive", org.apache.thrift.protocol.TType.BOOL, (short)1);
  private static final org.apache.thrift.protocol.TField IS_RISKY_FIELD_DESC = new org.apache.thrift.protocol.TField("isRisky", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField QUANTITY_FIELD_DESC = new org.apache.thrift.protocol.TField("quantity", org.apache.thrift.protocol.TType.I64, (short)3);

  private boolean isActive; // required
  private boolean isRisky; // required
  private long quantity; // 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 {
    IS_ACTIVE((short)1, "isActive"),
    IS_RISKY((short)2, "isRisky"),
    QUANTITY((short)3, "quantity");

    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: // IS_ACTIVE
          return IS_ACTIVE;
        case 2: // IS_RISKY
          return IS_RISKY;
        case 3: // QUANTITY
          return QUANTITY;
        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 __ISACTIVE_ISSET_ID = 0;
  private static final int __ISRISKY_ISSET_ID = 1;
  private static final int __QUANTITY_ISSET_ID = 2;
  private BitSet __isset_bit_vector = new BitSet(3);

  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.IS_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("isActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_RISKY, new org.apache.thrift.meta_data.FieldMetaData("isRisky", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.QUANTITY, new org.apache.thrift.meta_data.FieldMetaData("quantity", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ItemShippingInfo.class, metaDataMap);
  }

  public ItemShippingInfo() {
  }

  public ItemShippingInfo(
    boolean isActive)
  {
    this();
    this.isActive = isActive;
    setIsActiveIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ItemShippingInfo(ItemShippingInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.isActive = other.isActive;
    this.isRisky = other.isRisky;
    this.quantity = other.quantity;
  }

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

  @Override
  public void clear() {
    setIsActiveIsSet(false);
    this.isActive = false;
    setIsRiskyIsSet(false);
    this.isRisky = false;
    setQuantityIsSet(false);
    this.quantity = 0;
  }

  public boolean isIsActive() {
    return this.isActive;
  }

  public void setIsActive(boolean isActive) {
    this.isActive = isActive;
    setIsActiveIsSet(true);
  }

  public void unsetIsActive() {
    __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
  }

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

  public void setIsActiveIsSet(boolean value) {
    __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
  }

  public boolean isIsRisky() {
    return this.isRisky;
  }

  public void setIsRisky(boolean isRisky) {
    this.isRisky = isRisky;
    setIsRiskyIsSet(true);
  }

  public void unsetIsRisky() {
    __isset_bit_vector.clear(__ISRISKY_ISSET_ID);
  }

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

  public void setIsRiskyIsSet(boolean value) {
    __isset_bit_vector.set(__ISRISKY_ISSET_ID, value);
  }

  public long getQuantity() {
    return this.quantity;
  }

  public void setQuantity(long quantity) {
    this.quantity = quantity;
    setQuantityIsSet(true);
  }

  public void unsetQuantity() {
    __isset_bit_vector.clear(__QUANTITY_ISSET_ID);
  }

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

  public void setQuantityIsSet(boolean value) {
    __isset_bit_vector.set(__QUANTITY_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case IS_ACTIVE:
      if (value == null) {
        unsetIsActive();
      } else {
        setIsActive((Boolean)value);
      }
      break;

    case IS_RISKY:
      if (value == null) {
        unsetIsRisky();
      } else {
        setIsRisky((Boolean)value);
      }
      break;

    case QUANTITY:
      if (value == null) {
        unsetQuantity();
      } else {
        setQuantity((Long)value);
      }
      break;

    }
  }

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

    case IS_RISKY:
      return Boolean.valueOf(isIsRisky());

    case QUANTITY:
      return Long.valueOf(getQuantity());

    }
    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 IS_ACTIVE:
      return isSetIsActive();
    case IS_RISKY:
      return isSetIsRisky();
    case QUANTITY:
      return isSetQuantity();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_isActive = true;
    boolean that_present_isActive = true;
    if (this_present_isActive || that_present_isActive) {
      if (!(this_present_isActive && that_present_isActive))
        return false;
      if (this.isActive != that.isActive)
        return false;
    }

    boolean this_present_isRisky = true && this.isSetIsRisky();
    boolean that_present_isRisky = true && that.isSetIsRisky();
    if (this_present_isRisky || that_present_isRisky) {
      if (!(this_present_isRisky && that_present_isRisky))
        return false;
      if (this.isRisky != that.isRisky)
        return false;
    }

    boolean this_present_quantity = true && this.isSetQuantity();
    boolean that_present_quantity = true && that.isSetQuantity();
    if (this_present_quantity || that_present_quantity) {
      if (!(this_present_quantity && that_present_quantity))
        return false;
      if (this.quantity != that.quantity)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(typedOther.isSetIsActive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsActive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isActive, typedOther.isActive);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsRisky()).compareTo(typedOther.isSetIsRisky());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsRisky()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRisky, typedOther.isRisky);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetQuantity()).compareTo(typedOther.isSetQuantity());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuantity()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.quantity, typedOther.quantity);
      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: // IS_ACTIVE
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isActive = iprot.readBool();
            setIsActiveIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // IS_RISKY
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.isRisky = iprot.readBool();
            setIsRiskyIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // QUANTITY
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.quantity = iprot.readI64();
            setQuantityIsSet(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(IS_ACTIVE_FIELD_DESC);
    oprot.writeBool(this.isActive);
    oprot.writeFieldEnd();
    if (isSetIsRisky()) {
      oprot.writeFieldBegin(IS_RISKY_FIELD_DESC);
      oprot.writeBool(this.isRisky);
      oprot.writeFieldEnd();
    }
    if (isSetQuantity()) {
      oprot.writeFieldBegin(QUANTITY_FIELD_DESC);
      oprot.writeI64(this.quantity);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("isActive:");
    sb.append(this.isActive);
    first = false;
    if (isSetIsRisky()) {
      if (!first) sb.append(", ");
      sb.append("isRisky:");
      sb.append(this.isRisky);
      first = false;
    }
    if (isSetQuantity()) {
      if (!first) sb.append(", ");
      sb.append("quantity:");
      sb.append(this.quantity);
      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);
    }
  }

}