Subversion Repositories SmartDukaan

Rev

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

  private static final TField AWB_NUMBER_FIELD_DESC = new TField("awbNumber", TType.STRING, (short)1);
  private static final TField PROVIDER_NAME_FIELD_DESC = new TField("providerName", TType.STRING, (short)2);
  private static final TField LOCATION_FIELD_DESC = new TField("location", TType.STRING, (short)3);
  private static final TField ENTRY_DATE_FIELD_DESC = new TField("entryDate", TType.I64, (short)4);
  private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)5);

  private String awbNumber;
  private String providerName;
  private String location;
  private long entryDate;
  private String description;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    AWB_NUMBER((short)1, "awbNumber"),
    PROVIDER_NAME((short)2, "providerName"),
    LOCATION((short)3, "location"),
    ENTRY_DATE((short)4, "entryDate"),
    DESCRIPTION((short)5, "description");

    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 __ENTRYDATE_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.AWB_NUMBER, new FieldMetaData("awbNumber", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PROVIDER_NAME, new FieldMetaData("providerName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.LOCATION, new FieldMetaData("location", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ENTRY_DATE, new FieldMetaData("entryDate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.DESCRIPTION, new FieldMetaData("description", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
  }});

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

  public AwbUpdate() {
  }

  public AwbUpdate(
    String awbNumber,
    String providerName,
    String location,
    long entryDate,
    String description)
  {
    this();
    this.awbNumber = awbNumber;
    this.providerName = providerName;
    this.location = location;
    this.entryDate = entryDate;
    setEntryDateIsSet(true);
    this.description = description;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AwbUpdate(AwbUpdate other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetAwbNumber()) {
      this.awbNumber = other.awbNumber;
    }
    if (other.isSetProviderName()) {
      this.providerName = other.providerName;
    }
    if (other.isSetLocation()) {
      this.location = other.location;
    }
    this.entryDate = other.entryDate;
    if (other.isSetDescription()) {
      this.description = other.description;
    }
  }

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

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

  public String getAwbNumber() {
    return this.awbNumber;
  }

  public AwbUpdate setAwbNumber(String awbNumber) {
    this.awbNumber = awbNumber;
    return this;
  }

  public void unsetAwbNumber() {
    this.awbNumber = null;
  }

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

  public void setAwbNumberIsSet(boolean value) {
    if (!value) {
      this.awbNumber = null;
    }
  }

  public String getProviderName() {
    return this.providerName;
  }

  public AwbUpdate setProviderName(String providerName) {
    this.providerName = providerName;
    return this;
  }

  public void unsetProviderName() {
    this.providerName = null;
  }

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

  public void setProviderNameIsSet(boolean value) {
    if (!value) {
      this.providerName = null;
    }
  }

  public String getLocation() {
    return this.location;
  }

  public AwbUpdate setLocation(String location) {
    this.location = location;
    return this;
  }

  public void unsetLocation() {
    this.location = null;
  }

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

  public void setLocationIsSet(boolean value) {
    if (!value) {
      this.location = null;
    }
  }

  public long getEntryDate() {
    return this.entryDate;
  }

  public AwbUpdate setEntryDate(long entryDate) {
    this.entryDate = entryDate;
    setEntryDateIsSet(true);
    return this;
  }

  public void unsetEntryDate() {
    __isset_bit_vector.clear(__ENTRYDATE_ISSET_ID);
  }

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

  public void setEntryDateIsSet(boolean value) {
    __isset_bit_vector.set(__ENTRYDATE_ISSET_ID, value);
  }

  public String getDescription() {
    return this.description;
  }

  public AwbUpdate setDescription(String description) {
    this.description = description;
    return this;
  }

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case AWB_NUMBER:
      if (value == null) {
        unsetAwbNumber();
      } else {
        setAwbNumber((String)value);
      }
      break;

    case PROVIDER_NAME:
      if (value == null) {
        unsetProviderName();
      } else {
        setProviderName((String)value);
      }
      break;

    case LOCATION:
      if (value == null) {
        unsetLocation();
      } else {
        setLocation((String)value);
      }
      break;

    case ENTRY_DATE:
      if (value == null) {
        unsetEntryDate();
      } else {
        setEntryDate((Long)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    }
  }

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

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case AWB_NUMBER:
      return getAwbNumber();

    case PROVIDER_NAME:
      return getProviderName();

    case LOCATION:
      return getLocation();

    case ENTRY_DATE:
      return new Long(getEntryDate());

    case DESCRIPTION:
      return getDescription();

    }
    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 AWB_NUMBER:
      return isSetAwbNumber();
    case PROVIDER_NAME:
      return isSetProviderName();
    case LOCATION:
      return isSetLocation();
    case ENTRY_DATE:
      return isSetEntryDate();
    case DESCRIPTION:
      return isSetDescription();
    }
    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 AwbUpdate)
      return this.equals((AwbUpdate)that);
    return false;
  }

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

    boolean this_present_awbNumber = true && this.isSetAwbNumber();
    boolean that_present_awbNumber = true && that.isSetAwbNumber();
    if (this_present_awbNumber || that_present_awbNumber) {
      if (!(this_present_awbNumber && that_present_awbNumber))
        return false;
      if (!this.awbNumber.equals(that.awbNumber))
        return false;
    }

    boolean this_present_providerName = true && this.isSetProviderName();
    boolean that_present_providerName = true && that.isSetProviderName();
    if (this_present_providerName || that_present_providerName) {
      if (!(this_present_providerName && that_present_providerName))
        return false;
      if (!this.providerName.equals(that.providerName))
        return false;
    }

    boolean this_present_location = true && this.isSetLocation();
    boolean that_present_location = true && that.isSetLocation();
    if (this_present_location || that_present_location) {
      if (!(this_present_location && that_present_location))
        return false;
      if (!this.location.equals(that.location))
        return false;
    }

    boolean this_present_entryDate = true;
    boolean that_present_entryDate = true;
    if (this_present_entryDate || that_present_entryDate) {
      if (!(this_present_entryDate && that_present_entryDate))
        return false;
      if (this.entryDate != that.entryDate)
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetAwbNumber()).compareTo(isSetAwbNumber());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(awbNumber, typedOther.awbNumber);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetProviderName()).compareTo(isSetProviderName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(providerName, typedOther.providerName);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLocation()).compareTo(isSetLocation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(location, typedOther.location);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEntryDate()).compareTo(isSetEntryDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(entryDate, typedOther.entryDate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(description, typedOther.description);
    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 AWB_NUMBER:
            if (field.type == TType.STRING) {
              this.awbNumber = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PROVIDER_NAME:
            if (field.type == TType.STRING) {
              this.providerName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case LOCATION:
            if (field.type == TType.STRING) {
              this.location = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ENTRY_DATE:
            if (field.type == TType.I64) {
              this.entryDate = iprot.readI64();
              setEntryDateIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DESCRIPTION:
            if (field.type == TType.STRING) {
              this.description = 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.awbNumber != null) {
      oprot.writeFieldBegin(AWB_NUMBER_FIELD_DESC);
      oprot.writeString(this.awbNumber);
      oprot.writeFieldEnd();
    }
    if (this.providerName != null) {
      oprot.writeFieldBegin(PROVIDER_NAME_FIELD_DESC);
      oprot.writeString(this.providerName);
      oprot.writeFieldEnd();
    }
    if (this.location != null) {
      oprot.writeFieldBegin(LOCATION_FIELD_DESC);
      oprot.writeString(this.location);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ENTRY_DATE_FIELD_DESC);
    oprot.writeI64(this.entryDate);
    oprot.writeFieldEnd();
    if (this.description != null) {
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.description);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("awbNumber:");
    if (this.awbNumber == null) {
      sb.append("null");
    } else {
      sb.append(this.awbNumber);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("providerName:");
    if (this.providerName == null) {
      sb.append("null");
    } else {
      sb.append(this.providerName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("location:");
    if (this.location == null) {
      sb.append("null");
    } else {
      sb.append(this.location);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("entryDate:");
    sb.append(this.entryDate);
    first = false;
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}