All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rbkmoney.damsel.wb_list.Row Maven / Gradle / Ivy

Go to download

Generates jar artifact containing compiled thrift classes based on generated thrift IDL files

There is a newer version: 1.39-e20ba71
Show newest version
/**
 * Autogenerated by Thrift Compiler (1.0.0-dev)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.rbkmoney.damsel.wb_list;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
public class Row implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Row");

  private static final org.apache.thrift.protocol.TField PARTY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("party_id", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SHOP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("shop_id", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField LIST_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("list_type", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField LIST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("list_name", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField ROW_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("row_info", org.apache.thrift.protocol.TType.STRUCT, (short)6);
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRUCT, (short)7);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new RowStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new RowTupleSchemeFactory();

  public String party_id; // optional
  public String shop_id; // optional
  /**
   * 
   * @see ListType
   */
  public ListType list_type; // required
  public String list_name; // required
  public String value; // required
  public RowInfo row_info; // optional
  public IdInfo id; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    PARTY_ID((short)1, "party_id"),
    SHOP_ID((short)2, "shop_id"),
    /**
     * 
     * @see ListType
     */
    LIST_TYPE((short)3, "list_type"),
    LIST_NAME((short)4, "list_name"),
    VALUE((short)5, "value"),
    ROW_INFO((short)6, "row_info"),
    ID((short)7, "id");

    private static final Map byName = new HashMap();

    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: // PARTY_ID
          return PARTY_ID;
        case 2: // SHOP_ID
          return SHOP_ID;
        case 3: // LIST_TYPE
          return LIST_TYPE;
        case 4: // LIST_NAME
          return LIST_NAME;
        case 5: // VALUE
          return VALUE;
        case 6: // ROW_INFO
          return ROW_INFO;
        case 7: // ID
          return ID;
        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 _Fields optionals[] = {_Fields.PARTY_ID,_Fields.SHOP_ID,_Fields.ROW_INFO,_Fields.ID};
  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.PARTY_ID, new org.apache.thrift.meta_data.FieldMetaData("party_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SHOP_ID, new org.apache.thrift.meta_data.FieldMetaData("shop_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.LIST_TYPE, new org.apache.thrift.meta_data.FieldMetaData("list_type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ListType.class)));
    tmpMap.put(_Fields.LIST_NAME, new org.apache.thrift.meta_data.FieldMetaData("list_name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ROW_INFO, new org.apache.thrift.meta_data.FieldMetaData("row_info", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RowInfo.class)));
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IdInfo.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Row.class, metaDataMap);
  }

  public Row() {
  }

  public Row(
    ListType list_type,
    String list_name,
    String value)
  {
    this();
    this.list_type = list_type;
    this.list_name = list_name;
    this.value = value;
  }

  /**
   * Performs a deep copy on other.
   */
  public Row(Row other) {
    if (other.isSetPartyId()) {
      this.party_id = other.party_id;
    }
    if (other.isSetShopId()) {
      this.shop_id = other.shop_id;
    }
    if (other.isSetListType()) {
      this.list_type = other.list_type;
    }
    if (other.isSetListName()) {
      this.list_name = other.list_name;
    }
    if (other.isSetValue()) {
      this.value = other.value;
    }
    if (other.isSetRowInfo()) {
      this.row_info = new RowInfo(other.row_info);
    }
    if (other.isSetId()) {
      this.id = new IdInfo(other.id);
    }
  }

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

  @Override
  public void clear() {
    this.party_id = null;
    this.shop_id = null;
    this.list_type = null;
    this.list_name = null;
    this.value = null;
    this.row_info = null;
    this.id = null;
  }

  public String getPartyId() {
    return this.party_id;
  }

  public Row setPartyId(String party_id) {
    this.party_id = party_id;
    return this;
  }

  public void unsetPartyId() {
    this.party_id = null;
  }

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

  public void setPartyIdIsSet(boolean value) {
    if (!value) {
      this.party_id = null;
    }
  }

  public String getShopId() {
    return this.shop_id;
  }

  public Row setShopId(String shop_id) {
    this.shop_id = shop_id;
    return this;
  }

  public void unsetShopId() {
    this.shop_id = null;
  }

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

  public void setShopIdIsSet(boolean value) {
    if (!value) {
      this.shop_id = null;
    }
  }

  /**
   * 
   * @see ListType
   */
  public ListType getListType() {
    return this.list_type;
  }

  /**
   * 
   * @see ListType
   */
  public Row setListType(ListType list_type) {
    this.list_type = list_type;
    return this;
  }

  public void unsetListType() {
    this.list_type = null;
  }

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

  public void setListTypeIsSet(boolean value) {
    if (!value) {
      this.list_type = null;
    }
  }

  public String getListName() {
    return this.list_name;
  }

  public Row setListName(String list_name) {
    this.list_name = list_name;
    return this;
  }

  public void unsetListName() {
    this.list_name = null;
  }

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

  public void setListNameIsSet(boolean value) {
    if (!value) {
      this.list_name = null;
    }
  }

  public String getValue() {
    return this.value;
  }

  public Row setValue(String value) {
    this.value = value;
    return this;
  }

  public void unsetValue() {
    this.value = null;
  }

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

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

  public RowInfo getRowInfo() {
    return this.row_info;
  }

  public Row setRowInfo(RowInfo row_info) {
    this.row_info = row_info;
    return this;
  }

  public void unsetRowInfo() {
    this.row_info = null;
  }

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

  public void setRowInfoIsSet(boolean value) {
    if (!value) {
      this.row_info = null;
    }
  }

  public IdInfo getId() {
    return this.id;
  }

  public Row setId(IdInfo id) {
    this.id = id;
    return this;
  }

  public void unsetId() {
    this.id = null;
  }

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

  public void setIdIsSet(boolean value) {
    if (!value) {
      this.id = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case PARTY_ID:
      if (value == null) {
        unsetPartyId();
      } else {
        setPartyId((String)value);
      }
      break;

    case SHOP_ID:
      if (value == null) {
        unsetShopId();
      } else {
        setShopId((String)value);
      }
      break;

    case LIST_TYPE:
      if (value == null) {
        unsetListType();
      } else {
        setListType((ListType)value);
      }
      break;

    case LIST_NAME:
      if (value == null) {
        unsetListName();
      } else {
        setListName((String)value);
      }
      break;

    case VALUE:
      if (value == null) {
        unsetValue();
      } else {
        setValue((String)value);
      }
      break;

    case ROW_INFO:
      if (value == null) {
        unsetRowInfo();
      } else {
        setRowInfo((RowInfo)value);
      }
      break;

    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((IdInfo)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case PARTY_ID:
      return getPartyId();

    case SHOP_ID:
      return getShopId();

    case LIST_TYPE:
      return getListType();

    case LIST_NAME:
      return getListName();

    case VALUE:
      return getValue();

    case ROW_INFO:
      return getRowInfo();

    case ID:
      return getId();

    }
    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 PARTY_ID:
      return isSetPartyId();
    case SHOP_ID:
      return isSetShopId();
    case LIST_TYPE:
      return isSetListType();
    case LIST_NAME:
      return isSetListName();
    case VALUE:
      return isSetValue();
    case ROW_INFO:
      return isSetRowInfo();
    case ID:
      return isSetId();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_party_id = true && this.isSetPartyId();
    boolean that_present_party_id = true && that.isSetPartyId();
    if (this_present_party_id || that_present_party_id) {
      if (!(this_present_party_id && that_present_party_id))
        return false;
      if (!this.party_id.equals(that.party_id))
        return false;
    }

    boolean this_present_shop_id = true && this.isSetShopId();
    boolean that_present_shop_id = true && that.isSetShopId();
    if (this_present_shop_id || that_present_shop_id) {
      if (!(this_present_shop_id && that_present_shop_id))
        return false;
      if (!this.shop_id.equals(that.shop_id))
        return false;
    }

    boolean this_present_list_type = true && this.isSetListType();
    boolean that_present_list_type = true && that.isSetListType();
    if (this_present_list_type || that_present_list_type) {
      if (!(this_present_list_type && that_present_list_type))
        return false;
      if (!this.list_type.equals(that.list_type))
        return false;
    }

    boolean this_present_list_name = true && this.isSetListName();
    boolean that_present_list_name = true && that.isSetListName();
    if (this_present_list_name || that_present_list_name) {
      if (!(this_present_list_name && that_present_list_name))
        return false;
      if (!this.list_name.equals(that.list_name))
        return false;
    }

    boolean this_present_value = true && this.isSetValue();
    boolean that_present_value = true && that.isSetValue();
    if (this_present_value || that_present_value) {
      if (!(this_present_value && that_present_value))
        return false;
      if (!this.value.equals(that.value))
        return false;
    }

    boolean this_present_row_info = true && this.isSetRowInfo();
    boolean that_present_row_info = true && that.isSetRowInfo();
    if (this_present_row_info || that_present_row_info) {
      if (!(this_present_row_info && that_present_row_info))
        return false;
      if (!this.row_info.equals(that.row_info))
        return false;
    }

    boolean this_present_id = true && this.isSetId();
    boolean that_present_id = true && that.isSetId();
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (!this.id.equals(that.id))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetPartyId()) ? 131071 : 524287);
    if (isSetPartyId())
      hashCode = hashCode * 8191 + party_id.hashCode();

    hashCode = hashCode * 8191 + ((isSetShopId()) ? 131071 : 524287);
    if (isSetShopId())
      hashCode = hashCode * 8191 + shop_id.hashCode();

    hashCode = hashCode * 8191 + ((isSetListType()) ? 131071 : 524287);
    if (isSetListType())
      hashCode = hashCode * 8191 + list_type.getValue();

    hashCode = hashCode * 8191 + ((isSetListName()) ? 131071 : 524287);
    if (isSetListName())
      hashCode = hashCode * 8191 + list_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetValue()) ? 131071 : 524287);
    if (isSetValue())
      hashCode = hashCode * 8191 + value.hashCode();

    hashCode = hashCode * 8191 + ((isSetRowInfo()) ? 131071 : 524287);
    if (isSetRowInfo())
      hashCode = hashCode * 8191 + row_info.hashCode();

    hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
    if (isSetId())
      hashCode = hashCode * 8191 + id.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetPartyId()).compareTo(other.isSetPartyId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPartyId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.party_id, other.party_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShopId()).compareTo(other.isSetShopId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShopId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shop_id, other.shop_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetListType()).compareTo(other.isSetListType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetListType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.list_type, other.list_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetListName()).compareTo(other.isSetListName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetListName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.list_name, other.list_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRowInfo()).compareTo(other.isSetRowInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRowInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row_info, other.row_info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public _Fields[] getFields() {
    return _Fields.values();
  }

  public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
    return metaDataMap;
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

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

    if (isSetPartyId()) {
      sb.append("party_id:");
      if (this.party_id == null) {
        sb.append("null");
      } else {
        sb.append(this.party_id);
      }
      first = false;
    }
    if (isSetShopId()) {
      if (!first) sb.append(", ");
      sb.append("shop_id:");
      if (this.shop_id == null) {
        sb.append("null");
      } else {
        sb.append(this.shop_id);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("list_type:");
    if (this.list_type == null) {
      sb.append("null");
    } else {
      sb.append(this.list_type);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("list_name:");
    if (this.list_name == null) {
      sb.append("null");
    } else {
      sb.append(this.list_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("value:");
    if (this.value == null) {
      sb.append("null");
    } else {
      sb.append(this.value);
    }
    first = false;
    if (isSetRowInfo()) {
      if (!first) sb.append(", ");
      sb.append("row_info:");
      if (this.row_info == null) {
        sb.append("null");
      } else {
        sb.append(this.row_info);
      }
      first = false;
    }
    if (isSetId()) {
      if (!first) sb.append(", ");
      sb.append("id:");
      if (this.id == null) {
        sb.append("null");
      } else {
        sb.append(this.id);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (list_type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'list_type' was not present! Struct: " + toString());
    }
    if (list_name == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'list_name' was not present! Struct: " + toString());
    }
    if (value == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  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 {
      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);
    }
  }

  private static class RowStandardSchemeFactory implements SchemeFactory {
    public RowStandardScheme getScheme() {
      return new RowStandardScheme();
    }
  }

  private static class RowStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Row struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // PARTY_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.party_id = iprot.readString();
              struct.setPartyIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SHOP_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.shop_id = iprot.readString();
              struct.setShopIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // LIST_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.list_type = com.rbkmoney.damsel.wb_list.ListType.findByValue(iprot.readI32());
              struct.setListTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // LIST_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.list_name = iprot.readString();
              struct.setListNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.value = iprot.readString();
              struct.setValueIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // ROW_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.row_info = new RowInfo();
              struct.row_info.read(iprot);
              struct.setRowInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.id = new IdInfo();
              struct.id.read(iprot);
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, Row struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.party_id != null) {
        if (struct.isSetPartyId()) {
          oprot.writeFieldBegin(PARTY_ID_FIELD_DESC);
          oprot.writeString(struct.party_id);
          oprot.writeFieldEnd();
        }
      }
      if (struct.shop_id != null) {
        if (struct.isSetShopId()) {
          oprot.writeFieldBegin(SHOP_ID_FIELD_DESC);
          oprot.writeString(struct.shop_id);
          oprot.writeFieldEnd();
        }
      }
      if (struct.list_type != null) {
        oprot.writeFieldBegin(LIST_TYPE_FIELD_DESC);
        oprot.writeI32(struct.list_type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.list_name != null) {
        oprot.writeFieldBegin(LIST_NAME_FIELD_DESC);
        oprot.writeString(struct.list_name);
        oprot.writeFieldEnd();
      }
      if (struct.value != null) {
        oprot.writeFieldBegin(VALUE_FIELD_DESC);
        oprot.writeString(struct.value);
        oprot.writeFieldEnd();
      }
      if (struct.row_info != null) {
        if (struct.isSetRowInfo()) {
          oprot.writeFieldBegin(ROW_INFO_FIELD_DESC);
          struct.row_info.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.id != null) {
        if (struct.isSetId()) {
          oprot.writeFieldBegin(ID_FIELD_DESC);
          struct.id.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RowTupleSchemeFactory implements SchemeFactory {
    public RowTupleScheme getScheme() {
      return new RowTupleScheme();
    }
  }

  private static class RowTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Row struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI32(struct.list_type.getValue());
      oprot.writeString(struct.list_name);
      oprot.writeString(struct.value);
      BitSet optionals = new BitSet();
      if (struct.isSetPartyId()) {
        optionals.set(0);
      }
      if (struct.isSetShopId()) {
        optionals.set(1);
      }
      if (struct.isSetRowInfo()) {
        optionals.set(2);
      }
      if (struct.isSetId()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetPartyId()) {
        oprot.writeString(struct.party_id);
      }
      if (struct.isSetShopId()) {
        oprot.writeString(struct.shop_id);
      }
      if (struct.isSetRowInfo()) {
        struct.row_info.write(oprot);
      }
      if (struct.isSetId()) {
        struct.id.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Row struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.list_type = com.rbkmoney.damsel.wb_list.ListType.findByValue(iprot.readI32());
      struct.setListTypeIsSet(true);
      struct.list_name = iprot.readString();
      struct.setListNameIsSet(true);
      struct.value = iprot.readString();
      struct.setValueIsSet(true);
      BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.party_id = iprot.readString();
        struct.setPartyIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.shop_id = iprot.readString();
        struct.setShopIdIsSet(true);
      }
      if (incoming.get(2)) {
        struct.row_info = new RowInfo();
        struct.row_info.read(iprot);
        struct.setRowInfoIsSet(true);
      }
      if (incoming.get(3)) {
        struct.id = new IdInfo();
        struct.id.read(iprot);
        struct.setIdIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy