Subversion Repositories SmartDukaan

Rev

Rev 483 | Rev 648 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * 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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class LogisticsInfo implements TBase<LogisticsInfo._Fields>, java.io.Serializable, Cloneable, Comparable<LogisticsInfo> {
  private static final TStruct STRUCT_DESC = new TStruct("LogisticsInfo");

  private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouse_id", TType.I64, (short)1);
  private static final TField PROVIDER_ID_FIELD_DESC = new TField("provider_id", TType.I64, (short)2);
  private static final TField AIRWAY_BILLNO_FIELD_DESC = new TField("airway_billno", TType.STRING, (short)3);
  private static final TField DELIVERY_ESTIMATE_FIELD_DESC = new TField("delivery_estimate", TType.I64, (short)4);

  private long warehouse_id;
  private long provider_id;
  private String airway_billno;
  private long delivery_estimate;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    WAREHOUSE_ID((short)1, "warehouse_id"),
    PROVIDER_ID((short)2, "provider_id"),
    AIRWAY_BILLNO((short)3, "airway_billno"),
    DELIVERY_ESTIMATE((short)4, "delivery_estimate");

    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byId.put((int)field._thriftId, field);
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __WAREHOUSE_ID_ISSET_ID = 0;
  private static final int __PROVIDER_ID_ISSET_ID = 1;
  private static final int __DELIVERY_ESTIMATE_ISSET_ID = 2;
  private BitSet __isset_bit_vector = new BitSet(3);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouse_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.PROVIDER_ID, new FieldMetaData("provider_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.AIRWAY_BILLNO, new FieldMetaData("airway_billno", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.DELIVERY_ESTIMATE, new FieldMetaData("delivery_estimate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(LogisticsInfo.class, metaDataMap);
  }

  public LogisticsInfo() {
  }

  public LogisticsInfo(
    long warehouse_id,
    long provider_id,
    String airway_billno,
    long delivery_estimate)
  {
    this();
    this.warehouse_id = warehouse_id;
    setWarehouse_idIsSet(true);
    this.provider_id = provider_id;
    setProvider_idIsSet(true);
    this.airway_billno = airway_billno;
    this.delivery_estimate = delivery_estimate;
    setDelivery_estimateIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public LogisticsInfo(LogisticsInfo other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.warehouse_id = other.warehouse_id;
    this.provider_id = other.provider_id;
    if (other.isSetAirway_billno()) {
      this.airway_billno = other.airway_billno;
    }
    this.delivery_estimate = other.delivery_estimate;
  }

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

  @Deprecated
  public LogisticsInfo clone() {
    return new LogisticsInfo(this);
  }

  public long getWarehouse_id() {
    return this.warehouse_id;
  }

  public LogisticsInfo setWarehouse_id(long warehouse_id) {
    this.warehouse_id = warehouse_id;
    setWarehouse_idIsSet(true);
    return this;
  }

  public void unsetWarehouse_id() {
    __isset_bit_vector.clear(__WAREHOUSE_ID_ISSET_ID);
  }

  /** Returns true if field warehouse_id is set (has been asigned a value) and false otherwise */
  public boolean isSetWarehouse_id() {
    return __isset_bit_vector.get(__WAREHOUSE_ID_ISSET_ID);
  }

  public void setWarehouse_idIsSet(boolean value) {
    __isset_bit_vector.set(__WAREHOUSE_ID_ISSET_ID, value);
  }

  public long getProvider_id() {
    return this.provider_id;
  }

  public LogisticsInfo setProvider_id(long provider_id) {
    this.provider_id = provider_id;
    setProvider_idIsSet(true);
    return this;
  }

  public void unsetProvider_id() {
    __isset_bit_vector.clear(__PROVIDER_ID_ISSET_ID);
  }

  /** Returns true if field provider_id is set (has been asigned a value) and false otherwise */
  public boolean isSetProvider_id() {
    return __isset_bit_vector.get(__PROVIDER_ID_ISSET_ID);
  }

  public void setProvider_idIsSet(boolean value) {
    __isset_bit_vector.set(__PROVIDER_ID_ISSET_ID, value);
  }

  public String getAirway_billno() {
    return this.airway_billno;
  }

  public LogisticsInfo setAirway_billno(String airway_billno) {
    this.airway_billno = airway_billno;
    return this;
  }

  public void unsetAirway_billno() {
    this.airway_billno = null;
  }

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

  public void setAirway_billnoIsSet(boolean value) {
    if (!value) {
      this.airway_billno = null;
    }
  }

  public long getDelivery_estimate() {
    return this.delivery_estimate;
  }

  public LogisticsInfo setDelivery_estimate(long delivery_estimate) {
    this.delivery_estimate = delivery_estimate;
    setDelivery_estimateIsSet(true);
    return this;
  }

  public void unsetDelivery_estimate() {
    __isset_bit_vector.clear(__DELIVERY_ESTIMATE_ISSET_ID);
  }

  /** Returns true if field delivery_estimate is set (has been asigned a value) and false otherwise */
  public boolean isSetDelivery_estimate() {
    return __isset_bit_vector.get(__DELIVERY_ESTIMATE_ISSET_ID);
  }

  public void setDelivery_estimateIsSet(boolean value) {
    __isset_bit_vector.set(__DELIVERY_ESTIMATE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case WAREHOUSE_ID:
      if (value == null) {
        unsetWarehouse_id();
      } else {
        setWarehouse_id((Long)value);
      }
      break;

    case PROVIDER_ID:
      if (value == null) {
        unsetProvider_id();
      } else {
        setProvider_id((Long)value);
      }
      break;

    case AIRWAY_BILLNO:
      if (value == null) {
        unsetAirway_billno();
      } else {
        setAirway_billno((String)value);
      }
      break;

    case DELIVERY_ESTIMATE:
      if (value == null) {
        unsetDelivery_estimate();
      } else {
        setDelivery_estimate((Long)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case WAREHOUSE_ID:
      return new Long(getWarehouse_id());

    case PROVIDER_ID:
      return new Long(getProvider_id());

    case AIRWAY_BILLNO:
      return getAirway_billno();

    case DELIVERY_ESTIMATE:
      return new Long(getDelivery_estimate());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case WAREHOUSE_ID:
      return isSetWarehouse_id();
    case PROVIDER_ID:
      return isSetProvider_id();
    case AIRWAY_BILLNO:
      return isSetAirway_billno();
    case DELIVERY_ESTIMATE:
      return isSetDelivery_estimate();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

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

    boolean this_present_warehouse_id = true;
    boolean that_present_warehouse_id = true;
    if (this_present_warehouse_id || that_present_warehouse_id) {
      if (!(this_present_warehouse_id && that_present_warehouse_id))
        return false;
      if (this.warehouse_id != that.warehouse_id)
        return false;
    }

    boolean this_present_provider_id = true;
    boolean that_present_provider_id = true;
    if (this_present_provider_id || that_present_provider_id) {
      if (!(this_present_provider_id && that_present_provider_id))
        return false;
      if (this.provider_id != that.provider_id)
        return false;
    }

    boolean this_present_airway_billno = true && this.isSetAirway_billno();
    boolean that_present_airway_billno = true && that.isSetAirway_billno();
    if (this_present_airway_billno || that_present_airway_billno) {
      if (!(this_present_airway_billno && that_present_airway_billno))
        return false;
      if (!this.airway_billno.equals(that.airway_billno))
        return false;
    }

    boolean this_present_delivery_estimate = true;
    boolean that_present_delivery_estimate = true;
    if (this_present_delivery_estimate || that_present_delivery_estimate) {
      if (!(this_present_delivery_estimate && that_present_delivery_estimate))
        return false;
      if (this.delivery_estimate != that.delivery_estimate)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetWarehouse_id()).compareTo(isSetWarehouse_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(warehouse_id, typedOther.warehouse_id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetProvider_id()).compareTo(isSetProvider_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(provider_id, typedOther.provider_id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAirway_billno()).compareTo(isSetAirway_billno());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(airway_billno, typedOther.airway_billno);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDelivery_estimate()).compareTo(isSetDelivery_estimate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(delivery_estimate, typedOther.delivery_estimate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case WAREHOUSE_ID:
            if (field.type == TType.I64) {
              this.warehouse_id = iprot.readI64();
              setWarehouse_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PROVIDER_ID:
            if (field.type == TType.I64) {
              this.provider_id = iprot.readI64();
              setProvider_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AIRWAY_BILLNO:
            if (field.type == TType.STRING) {
              this.airway_billno = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DELIVERY_ESTIMATE:
            if (field.type == TType.I64) {
              this.delivery_estimate = iprot.readI64();
              setDelivery_estimateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
    oprot.writeI64(this.warehouse_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROVIDER_ID_FIELD_DESC);
    oprot.writeI64(this.provider_id);
    oprot.writeFieldEnd();
    if (this.airway_billno != null) {
      oprot.writeFieldBegin(AIRWAY_BILLNO_FIELD_DESC);
      oprot.writeString(this.airway_billno);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DELIVERY_ESTIMATE_FIELD_DESC);
    oprot.writeI64(this.delivery_estimate);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("warehouse_id:");
    sb.append(this.warehouse_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("provider_id:");
    sb.append(this.provider_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("airway_billno:");
    if (this.airway_billno == null) {
      sb.append("null");
    } else {
      sb.append(this.airway_billno);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("delivery_estimate:");
    sb.append(this.delivery_estimate);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}