Subversion Repositories SmartDukaan

Rev

Blame | 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 Shipment implements TBase<Shipment._Fields>, java.io.Serializable, Cloneable, Comparable<Shipment> {
  private static final TStruct STRUCT_DESC = new TStruct("Shipment");

  private static final TField WAREHOUSE_NAME_FIELD_DESC = new TField("warehouse_name", TType.STRING, (short)1);
  private static final TField AWB_FIELD_DESC = new TField("awb", TType.STRING, (short)2);
  private static final TField ORIGIN_FIELD_DESC = new TField("origin", TType.STRING, (short)3);
  private static final TField DESTINATION_FIELD_DESC = new TField("destination", TType.STRING, (short)4);
  private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)5);
  private static final TField RECEPIENT_NAME_FIELD_DESC = new TField("recepient_name", TType.STRING, (short)6);
  private static final TField RECEPIENT_ADDRESS_FIELD_DESC = new TField("recepient_address", TType.STRING, (short)7);
  private static final TField RECEPIENT_PINCODE_FIELD_DESC = new TField("recepient_pincode", TType.STRING, (short)8);
  private static final TField RECEPIENT_PHONE_FIELD_DESC = new TField("recepient_phone", TType.STRING, (short)9);
  private static final TField SHIPMENT_WEIGHT_FIELD_DESC = new TField("shipment_weight", TType.STRING, (short)10);
  private static final TField SHIPMENT_CONTENTS_FIELD_DESC = new TField("shipment_contents", TType.STRING, (short)11);

  private String warehouse_name;
  private String awb;
  private String origin;
  private String destination;
  private long timestamp;
  private String recepient_name;
  private String recepient_address;
  private String recepient_pincode;
  private String recepient_phone;
  private String shipment_weight;
  private String shipment_contents;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    WAREHOUSE_NAME((short)1, "warehouse_name"),
    AWB((short)2, "awb"),
    ORIGIN((short)3, "origin"),
    DESTINATION((short)4, "destination"),
    TIMESTAMP((short)5, "timestamp"),
    RECEPIENT_NAME((short)6, "recepient_name"),
    RECEPIENT_ADDRESS((short)7, "recepient_address"),
    RECEPIENT_PINCODE((short)8, "recepient_pincode"),
    RECEPIENT_PHONE((short)9, "recepient_phone"),
    SHIPMENT_WEIGHT((short)10, "shipment_weight"),
    SHIPMENT_CONTENTS((short)11, "shipment_contents");

    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 __TIMESTAMP_ISSET_ID = 0;
  private BitSet __isset_bit_vector = new BitSet(1);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.WAREHOUSE_NAME, new FieldMetaData("warehouse_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.AWB, new FieldMetaData("awb", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ORIGIN, new FieldMetaData("origin", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.DESTINATION, new FieldMetaData("destination", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.RECEPIENT_NAME, new FieldMetaData("recepient_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.RECEPIENT_ADDRESS, new FieldMetaData("recepient_address", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.RECEPIENT_PINCODE, new FieldMetaData("recepient_pincode", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.RECEPIENT_PHONE, new FieldMetaData("recepient_phone", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SHIPMENT_WEIGHT, new FieldMetaData("shipment_weight", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SHIPMENT_CONTENTS, new FieldMetaData("shipment_contents", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
  }});

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

  public Shipment() {
  }

  public Shipment(
    String warehouse_name,
    String awb,
    String origin,
    String destination,
    long timestamp,
    String recepient_name,
    String recepient_address,
    String recepient_pincode,
    String recepient_phone,
    String shipment_weight,
    String shipment_contents)
  {
    this();
    this.warehouse_name = warehouse_name;
    this.awb = awb;
    this.origin = origin;
    this.destination = destination;
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    this.recepient_name = recepient_name;
    this.recepient_address = recepient_address;
    this.recepient_pincode = recepient_pincode;
    this.recepient_phone = recepient_phone;
    this.shipment_weight = shipment_weight;
    this.shipment_contents = shipment_contents;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Shipment(Shipment other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetWarehouse_name()) {
      this.warehouse_name = other.warehouse_name;
    }
    if (other.isSetAwb()) {
      this.awb = other.awb;
    }
    if (other.isSetOrigin()) {
      this.origin = other.origin;
    }
    if (other.isSetDestination()) {
      this.destination = other.destination;
    }
    this.timestamp = other.timestamp;
    if (other.isSetRecepient_name()) {
      this.recepient_name = other.recepient_name;
    }
    if (other.isSetRecepient_address()) {
      this.recepient_address = other.recepient_address;
    }
    if (other.isSetRecepient_pincode()) {
      this.recepient_pincode = other.recepient_pincode;
    }
    if (other.isSetRecepient_phone()) {
      this.recepient_phone = other.recepient_phone;
    }
    if (other.isSetShipment_weight()) {
      this.shipment_weight = other.shipment_weight;
    }
    if (other.isSetShipment_contents()) {
      this.shipment_contents = other.shipment_contents;
    }
  }

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

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

  public String getWarehouse_name() {
    return this.warehouse_name;
  }

  public Shipment setWarehouse_name(String warehouse_name) {
    this.warehouse_name = warehouse_name;
    return this;
  }

  public void unsetWarehouse_name() {
    this.warehouse_name = null;
  }

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

  public void setWarehouse_nameIsSet(boolean value) {
    if (!value) {
      this.warehouse_name = null;
    }
  }

  public String getAwb() {
    return this.awb;
  }

  public Shipment setAwb(String awb) {
    this.awb = awb;
    return this;
  }

  public void unsetAwb() {
    this.awb = null;
  }

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

  public void setAwbIsSet(boolean value) {
    if (!value) {
      this.awb = null;
    }
  }

  public String getOrigin() {
    return this.origin;
  }

  public Shipment setOrigin(String origin) {
    this.origin = origin;
    return this;
  }

  public void unsetOrigin() {
    this.origin = null;
  }

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

  public void setOriginIsSet(boolean value) {
    if (!value) {
      this.origin = null;
    }
  }

  public String getDestination() {
    return this.destination;
  }

  public Shipment setDestination(String destination) {
    this.destination = destination;
    return this;
  }

  public void unsetDestination() {
    this.destination = null;
  }

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

  public void setDestinationIsSet(boolean value) {
    if (!value) {
      this.destination = null;
    }
  }

  public long getTimestamp() {
    return this.timestamp;
  }

  public Shipment setTimestamp(long timestamp) {
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    return this;
  }

  public void unsetTimestamp() {
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
  }

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

  public void setTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
  }

  public String getRecepient_name() {
    return this.recepient_name;
  }

  public Shipment setRecepient_name(String recepient_name) {
    this.recepient_name = recepient_name;
    return this;
  }

  public void unsetRecepient_name() {
    this.recepient_name = null;
  }

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

  public void setRecepient_nameIsSet(boolean value) {
    if (!value) {
      this.recepient_name = null;
    }
  }

  public String getRecepient_address() {
    return this.recepient_address;
  }

  public Shipment setRecepient_address(String recepient_address) {
    this.recepient_address = recepient_address;
    return this;
  }

  public void unsetRecepient_address() {
    this.recepient_address = null;
  }

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

  public void setRecepient_addressIsSet(boolean value) {
    if (!value) {
      this.recepient_address = null;
    }
  }

  public String getRecepient_pincode() {
    return this.recepient_pincode;
  }

  public Shipment setRecepient_pincode(String recepient_pincode) {
    this.recepient_pincode = recepient_pincode;
    return this;
  }

  public void unsetRecepient_pincode() {
    this.recepient_pincode = null;
  }

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

  public void setRecepient_pincodeIsSet(boolean value) {
    if (!value) {
      this.recepient_pincode = null;
    }
  }

  public String getRecepient_phone() {
    return this.recepient_phone;
  }

  public Shipment setRecepient_phone(String recepient_phone) {
    this.recepient_phone = recepient_phone;
    return this;
  }

  public void unsetRecepient_phone() {
    this.recepient_phone = null;
  }

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

  public void setRecepient_phoneIsSet(boolean value) {
    if (!value) {
      this.recepient_phone = null;
    }
  }

  public String getShipment_weight() {
    return this.shipment_weight;
  }

  public Shipment setShipment_weight(String shipment_weight) {
    this.shipment_weight = shipment_weight;
    return this;
  }

  public void unsetShipment_weight() {
    this.shipment_weight = null;
  }

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

  public void setShipment_weightIsSet(boolean value) {
    if (!value) {
      this.shipment_weight = null;
    }
  }

  public String getShipment_contents() {
    return this.shipment_contents;
  }

  public Shipment setShipment_contents(String shipment_contents) {
    this.shipment_contents = shipment_contents;
    return this;
  }

  public void unsetShipment_contents() {
    this.shipment_contents = null;
  }

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

  public void setShipment_contentsIsSet(boolean value) {
    if (!value) {
      this.shipment_contents = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case WAREHOUSE_NAME:
      if (value == null) {
        unsetWarehouse_name();
      } else {
        setWarehouse_name((String)value);
      }
      break;

    case AWB:
      if (value == null) {
        unsetAwb();
      } else {
        setAwb((String)value);
      }
      break;

    case ORIGIN:
      if (value == null) {
        unsetOrigin();
      } else {
        setOrigin((String)value);
      }
      break;

    case DESTINATION:
      if (value == null) {
        unsetDestination();
      } else {
        setDestination((String)value);
      }
      break;

    case TIMESTAMP:
      if (value == null) {
        unsetTimestamp();
      } else {
        setTimestamp((Long)value);
      }
      break;

    case RECEPIENT_NAME:
      if (value == null) {
        unsetRecepient_name();
      } else {
        setRecepient_name((String)value);
      }
      break;

    case RECEPIENT_ADDRESS:
      if (value == null) {
        unsetRecepient_address();
      } else {
        setRecepient_address((String)value);
      }
      break;

    case RECEPIENT_PINCODE:
      if (value == null) {
        unsetRecepient_pincode();
      } else {
        setRecepient_pincode((String)value);
      }
      break;

    case RECEPIENT_PHONE:
      if (value == null) {
        unsetRecepient_phone();
      } else {
        setRecepient_phone((String)value);
      }
      break;

    case SHIPMENT_WEIGHT:
      if (value == null) {
        unsetShipment_weight();
      } else {
        setShipment_weight((String)value);
      }
      break;

    case SHIPMENT_CONTENTS:
      if (value == null) {
        unsetShipment_contents();
      } else {
        setShipment_contents((String)value);
      }
      break;

    }
  }

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

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case WAREHOUSE_NAME:
      return getWarehouse_name();

    case AWB:
      return getAwb();

    case ORIGIN:
      return getOrigin();

    case DESTINATION:
      return getDestination();

    case TIMESTAMP:
      return new Long(getTimestamp());

    case RECEPIENT_NAME:
      return getRecepient_name();

    case RECEPIENT_ADDRESS:
      return getRecepient_address();

    case RECEPIENT_PINCODE:
      return getRecepient_pincode();

    case RECEPIENT_PHONE:
      return getRecepient_phone();

    case SHIPMENT_WEIGHT:
      return getShipment_weight();

    case SHIPMENT_CONTENTS:
      return getShipment_contents();

    }
    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_NAME:
      return isSetWarehouse_name();
    case AWB:
      return isSetAwb();
    case ORIGIN:
      return isSetOrigin();
    case DESTINATION:
      return isSetDestination();
    case TIMESTAMP:
      return isSetTimestamp();
    case RECEPIENT_NAME:
      return isSetRecepient_name();
    case RECEPIENT_ADDRESS:
      return isSetRecepient_address();
    case RECEPIENT_PINCODE:
      return isSetRecepient_pincode();
    case RECEPIENT_PHONE:
      return isSetRecepient_phone();
    case SHIPMENT_WEIGHT:
      return isSetShipment_weight();
    case SHIPMENT_CONTENTS:
      return isSetShipment_contents();
    }
    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 Shipment)
      return this.equals((Shipment)that);
    return false;
  }

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

    boolean this_present_warehouse_name = true && this.isSetWarehouse_name();
    boolean that_present_warehouse_name = true && that.isSetWarehouse_name();
    if (this_present_warehouse_name || that_present_warehouse_name) {
      if (!(this_present_warehouse_name && that_present_warehouse_name))
        return false;
      if (!this.warehouse_name.equals(that.warehouse_name))
        return false;
    }

    boolean this_present_awb = true && this.isSetAwb();
    boolean that_present_awb = true && that.isSetAwb();
    if (this_present_awb || that_present_awb) {
      if (!(this_present_awb && that_present_awb))
        return false;
      if (!this.awb.equals(that.awb))
        return false;
    }

    boolean this_present_origin = true && this.isSetOrigin();
    boolean that_present_origin = true && that.isSetOrigin();
    if (this_present_origin || that_present_origin) {
      if (!(this_present_origin && that_present_origin))
        return false;
      if (!this.origin.equals(that.origin))
        return false;
    }

    boolean this_present_destination = true && this.isSetDestination();
    boolean that_present_destination = true && that.isSetDestination();
    if (this_present_destination || that_present_destination) {
      if (!(this_present_destination && that_present_destination))
        return false;
      if (!this.destination.equals(that.destination))
        return false;
    }

    boolean this_present_timestamp = true;
    boolean that_present_timestamp = true;
    if (this_present_timestamp || that_present_timestamp) {
      if (!(this_present_timestamp && that_present_timestamp))
        return false;
      if (this.timestamp != that.timestamp)
        return false;
    }

    boolean this_present_recepient_name = true && this.isSetRecepient_name();
    boolean that_present_recepient_name = true && that.isSetRecepient_name();
    if (this_present_recepient_name || that_present_recepient_name) {
      if (!(this_present_recepient_name && that_present_recepient_name))
        return false;
      if (!this.recepient_name.equals(that.recepient_name))
        return false;
    }

    boolean this_present_recepient_address = true && this.isSetRecepient_address();
    boolean that_present_recepient_address = true && that.isSetRecepient_address();
    if (this_present_recepient_address || that_present_recepient_address) {
      if (!(this_present_recepient_address && that_present_recepient_address))
        return false;
      if (!this.recepient_address.equals(that.recepient_address))
        return false;
    }

    boolean this_present_recepient_pincode = true && this.isSetRecepient_pincode();
    boolean that_present_recepient_pincode = true && that.isSetRecepient_pincode();
    if (this_present_recepient_pincode || that_present_recepient_pincode) {
      if (!(this_present_recepient_pincode && that_present_recepient_pincode))
        return false;
      if (!this.recepient_pincode.equals(that.recepient_pincode))
        return false;
    }

    boolean this_present_recepient_phone = true && this.isSetRecepient_phone();
    boolean that_present_recepient_phone = true && that.isSetRecepient_phone();
    if (this_present_recepient_phone || that_present_recepient_phone) {
      if (!(this_present_recepient_phone && that_present_recepient_phone))
        return false;
      if (!this.recepient_phone.equals(that.recepient_phone))
        return false;
    }

    boolean this_present_shipment_weight = true && this.isSetShipment_weight();
    boolean that_present_shipment_weight = true && that.isSetShipment_weight();
    if (this_present_shipment_weight || that_present_shipment_weight) {
      if (!(this_present_shipment_weight && that_present_shipment_weight))
        return false;
      if (!this.shipment_weight.equals(that.shipment_weight))
        return false;
    }

    boolean this_present_shipment_contents = true && this.isSetShipment_contents();
    boolean that_present_shipment_contents = true && that.isSetShipment_contents();
    if (this_present_shipment_contents || that_present_shipment_contents) {
      if (!(this_present_shipment_contents && that_present_shipment_contents))
        return false;
      if (!this.shipment_contents.equals(that.shipment_contents))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetWarehouse_name()).compareTo(isSetWarehouse_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(warehouse_name, typedOther.warehouse_name);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAwb()).compareTo(isSetAwb());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(awb, typedOther.awb);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOrigin()).compareTo(isSetOrigin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(origin, typedOther.origin);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDestination()).compareTo(isSetDestination());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(destination, typedOther.destination);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetRecepient_name()).compareTo(isSetRecepient_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(recepient_name, typedOther.recepient_name);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetRecepient_address()).compareTo(isSetRecepient_address());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(recepient_address, typedOther.recepient_address);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetRecepient_pincode()).compareTo(isSetRecepient_pincode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(recepient_pincode, typedOther.recepient_pincode);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetRecepient_phone()).compareTo(isSetRecepient_phone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(recepient_phone, typedOther.recepient_phone);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetShipment_weight()).compareTo(isSetShipment_weight());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(shipment_weight, typedOther.shipment_weight);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetShipment_contents()).compareTo(isSetShipment_contents());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(shipment_contents, typedOther.shipment_contents);
    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_NAME:
            if (field.type == TType.STRING) {
              this.warehouse_name = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AWB:
            if (field.type == TType.STRING) {
              this.awb = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ORIGIN:
            if (field.type == TType.STRING) {
              this.origin = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DESTINATION:
            if (field.type == TType.STRING) {
              this.destination = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case TIMESTAMP:
            if (field.type == TType.I64) {
              this.timestamp = iprot.readI64();
              setTimestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case RECEPIENT_NAME:
            if (field.type == TType.STRING) {
              this.recepient_name = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case RECEPIENT_ADDRESS:
            if (field.type == TType.STRING) {
              this.recepient_address = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case RECEPIENT_PINCODE:
            if (field.type == TType.STRING) {
              this.recepient_pincode = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case RECEPIENT_PHONE:
            if (field.type == TType.STRING) {
              this.recepient_phone = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHIPMENT_WEIGHT:
            if (field.type == TType.STRING) {
              this.shipment_weight = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SHIPMENT_CONTENTS:
            if (field.type == TType.STRING) {
              this.shipment_contents = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.warehouse_name != null) {
      oprot.writeFieldBegin(WAREHOUSE_NAME_FIELD_DESC);
      oprot.writeString(this.warehouse_name);
      oprot.writeFieldEnd();
    }
    if (this.awb != null) {
      oprot.writeFieldBegin(AWB_FIELD_DESC);
      oprot.writeString(this.awb);
      oprot.writeFieldEnd();
    }
    if (this.origin != null) {
      oprot.writeFieldBegin(ORIGIN_FIELD_DESC);
      oprot.writeString(this.origin);
      oprot.writeFieldEnd();
    }
    if (this.destination != null) {
      oprot.writeFieldBegin(DESTINATION_FIELD_DESC);
      oprot.writeString(this.destination);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.timestamp);
    oprot.writeFieldEnd();
    if (this.recepient_name != null) {
      oprot.writeFieldBegin(RECEPIENT_NAME_FIELD_DESC);
      oprot.writeString(this.recepient_name);
      oprot.writeFieldEnd();
    }
    if (this.recepient_address != null) {
      oprot.writeFieldBegin(RECEPIENT_ADDRESS_FIELD_DESC);
      oprot.writeString(this.recepient_address);
      oprot.writeFieldEnd();
    }
    if (this.recepient_pincode != null) {
      oprot.writeFieldBegin(RECEPIENT_PINCODE_FIELD_DESC);
      oprot.writeString(this.recepient_pincode);
      oprot.writeFieldEnd();
    }
    if (this.recepient_phone != null) {
      oprot.writeFieldBegin(RECEPIENT_PHONE_FIELD_DESC);
      oprot.writeString(this.recepient_phone);
      oprot.writeFieldEnd();
    }
    if (this.shipment_weight != null) {
      oprot.writeFieldBegin(SHIPMENT_WEIGHT_FIELD_DESC);
      oprot.writeString(this.shipment_weight);
      oprot.writeFieldEnd();
    }
    if (this.shipment_contents != null) {
      oprot.writeFieldBegin(SHIPMENT_CONTENTS_FIELD_DESC);
      oprot.writeString(this.shipment_contents);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("warehouse_name:");
    if (this.warehouse_name == null) {
      sb.append("null");
    } else {
      sb.append(this.warehouse_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("awb:");
    if (this.awb == null) {
      sb.append("null");
    } else {
      sb.append(this.awb);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("origin:");
    if (this.origin == null) {
      sb.append("null");
    } else {
      sb.append(this.origin);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("destination:");
    if (this.destination == null) {
      sb.append("null");
    } else {
      sb.append(this.destination);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("timestamp:");
    sb.append(this.timestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("recepient_name:");
    if (this.recepient_name == null) {
      sb.append("null");
    } else {
      sb.append(this.recepient_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("recepient_address:");
    if (this.recepient_address == null) {
      sb.append("null");
    } else {
      sb.append(this.recepient_address);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("recepient_pincode:");
    if (this.recepient_pincode == null) {
      sb.append("null");
    } else {
      sb.append(this.recepient_pincode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("recepient_phone:");
    if (this.recepient_phone == null) {
      sb.append("null");
    } else {
      sb.append(this.recepient_phone);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("shipment_weight:");
    if (this.shipment_weight == null) {
      sb.append("null");
    } else {
      sb.append(this.shipment_weight);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("shipment_contents:");
    if (this.shipment_contents == null) {
      sb.append("null");
    } else {
      sb.append(this.shipment_contents);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}