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

  private static final org.apache.thrift.protocol.TField CATALOG_ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("catalog_item_id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField BRAND_FIELD_DESC = new org.apache.thrift.protocol.TField("brand", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField MODEL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("model_name", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField MODEL_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("model_number", org.apache.thrift.protocol.TType.STRING, (short)4);

  private long catalog_item_id; // required
  private String brand; // required
  private String model_name; // required
  private String model_number; // 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 {
    CATALOG_ITEM_ID((short)1, "catalog_item_id"),
    BRAND((short)2, "brand"),
    MODEL_NAME((short)3, "model_name"),
    MODEL_NUMBER((short)4, "model_number");

    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: // CATALOG_ITEM_ID
          return CATALOG_ITEM_ID;
        case 2: // BRAND
          return BRAND;
        case 3: // MODEL_NAME
          return MODEL_NAME;
        case 4: // MODEL_NUMBER
          return MODEL_NUMBER;
        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 __CATALOG_ITEM_ID_ISSET_ID = 0;
  private BitSet __isset_bit_vector = new BitSet(1);

  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.CATALOG_ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("catalog_item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BRAND, new org.apache.thrift.meta_data.FieldMetaData("brand", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MODEL_NAME, new org.apache.thrift.meta_data.FieldMetaData("model_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MODEL_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("model_number", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BulkUploadCatalog.class, metaDataMap);
  }

  public BulkUploadCatalog() {
  }

  public BulkUploadCatalog(
    long catalog_item_id,
    String brand,
    String model_name,
    String model_number)
  {
    this();
    this.catalog_item_id = catalog_item_id;
    setCatalog_item_idIsSet(true);
    this.brand = brand;
    this.model_name = model_name;
    this.model_number = model_number;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public BulkUploadCatalog(BulkUploadCatalog other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.catalog_item_id = other.catalog_item_id;
    if (other.isSetBrand()) {
      this.brand = other.brand;
    }
    if (other.isSetModel_name()) {
      this.model_name = other.model_name;
    }
    if (other.isSetModel_number()) {
      this.model_number = other.model_number;
    }
  }

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

  @Override
  public void clear() {
    setCatalog_item_idIsSet(false);
    this.catalog_item_id = 0;
    this.brand = null;
    this.model_name = null;
    this.model_number = null;
  }

  public long getCatalog_item_id() {
    return this.catalog_item_id;
  }

  public void setCatalog_item_id(long catalog_item_id) {
    this.catalog_item_id = catalog_item_id;
    setCatalog_item_idIsSet(true);
  }

  public void unsetCatalog_item_id() {
    __isset_bit_vector.clear(__CATALOG_ITEM_ID_ISSET_ID);
  }

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

  public void setCatalog_item_idIsSet(boolean value) {
    __isset_bit_vector.set(__CATALOG_ITEM_ID_ISSET_ID, value);
  }

  public String getBrand() {
    return this.brand;
  }

  public void setBrand(String brand) {
    this.brand = brand;
  }

  public void unsetBrand() {
    this.brand = null;
  }

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

  public void setBrandIsSet(boolean value) {
    if (!value) {
      this.brand = null;
    }
  }

  public String getModel_name() {
    return this.model_name;
  }

  public void setModel_name(String model_name) {
    this.model_name = model_name;
  }

  public void unsetModel_name() {
    this.model_name = null;
  }

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

  public void setModel_nameIsSet(boolean value) {
    if (!value) {
      this.model_name = null;
    }
  }

  public String getModel_number() {
    return this.model_number;
  }

  public void setModel_number(String model_number) {
    this.model_number = model_number;
  }

  public void unsetModel_number() {
    this.model_number = null;
  }

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

  public void setModel_numberIsSet(boolean value) {
    if (!value) {
      this.model_number = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CATALOG_ITEM_ID:
      if (value == null) {
        unsetCatalog_item_id();
      } else {
        setCatalog_item_id((Long)value);
      }
      break;

    case BRAND:
      if (value == null) {
        unsetBrand();
      } else {
        setBrand((String)value);
      }
      break;

    case MODEL_NAME:
      if (value == null) {
        unsetModel_name();
      } else {
        setModel_name((String)value);
      }
      break;

    case MODEL_NUMBER:
      if (value == null) {
        unsetModel_number();
      } else {
        setModel_number((String)value);
      }
      break;

    }
  }

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

    case BRAND:
      return getBrand();

    case MODEL_NAME:
      return getModel_name();

    case MODEL_NUMBER:
      return getModel_number();

    }
    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 CATALOG_ITEM_ID:
      return isSetCatalog_item_id();
    case BRAND:
      return isSetBrand();
    case MODEL_NAME:
      return isSetModel_name();
    case MODEL_NUMBER:
      return isSetModel_number();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_catalog_item_id = true;
    boolean that_present_catalog_item_id = true;
    if (this_present_catalog_item_id || that_present_catalog_item_id) {
      if (!(this_present_catalog_item_id && that_present_catalog_item_id))
        return false;
      if (this.catalog_item_id != that.catalog_item_id)
        return false;
    }

    boolean this_present_brand = true && this.isSetBrand();
    boolean that_present_brand = true && that.isSetBrand();
    if (this_present_brand || that_present_brand) {
      if (!(this_present_brand && that_present_brand))
        return false;
      if (!this.brand.equals(that.brand))
        return false;
    }

    boolean this_present_model_name = true && this.isSetModel_name();
    boolean that_present_model_name = true && that.isSetModel_name();
    if (this_present_model_name || that_present_model_name) {
      if (!(this_present_model_name && that_present_model_name))
        return false;
      if (!this.model_name.equals(that.model_name))
        return false;
    }

    boolean this_present_model_number = true && this.isSetModel_number();
    boolean that_present_model_number = true && that.isSetModel_number();
    if (this_present_model_number || that_present_model_number) {
      if (!(this_present_model_number && that_present_model_number))
        return false;
      if (!this.model_number.equals(that.model_number))
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetCatalog_item_id()).compareTo(typedOther.isSetCatalog_item_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCatalog_item_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catalog_item_id, typedOther.catalog_item_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBrand()).compareTo(typedOther.isSetBrand());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBrand()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.brand, typedOther.brand);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetModel_name()).compareTo(typedOther.isSetModel_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetModel_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.model_name, typedOther.model_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetModel_number()).compareTo(typedOther.isSetModel_number());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetModel_number()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.model_number, typedOther.model_number);
      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: // CATALOG_ITEM_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.catalog_item_id = iprot.readI64();
            setCatalog_item_idIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // BRAND
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.brand = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // MODEL_NAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.model_name = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // MODEL_NUMBER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.model_number = iprot.readString();
          } 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(CATALOG_ITEM_ID_FIELD_DESC);
    oprot.writeI64(this.catalog_item_id);
    oprot.writeFieldEnd();
    if (this.brand != null) {
      oprot.writeFieldBegin(BRAND_FIELD_DESC);
      oprot.writeString(this.brand);
      oprot.writeFieldEnd();
    }
    if (this.model_name != null) {
      oprot.writeFieldBegin(MODEL_NAME_FIELD_DESC);
      oprot.writeString(this.model_name);
      oprot.writeFieldEnd();
    }
    if (this.model_number != null) {
      oprot.writeFieldBegin(MODEL_NUMBER_FIELD_DESC);
      oprot.writeString(this.model_number);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("catalog_item_id:");
    sb.append(this.catalog_item_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("brand:");
    if (this.brand == null) {
      sb.append("null");
    } else {
      sb.append(this.brand);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("model_name:");
    if (this.model_name == null) {
      sb.append("null");
    } else {
      sb.append(this.model_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("model_number:");
    if (this.model_number == null) {
      sb.append("null");
    } else {
      sb.append(this.model_number);
    }
    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);
    }
  }

}