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

com.rbkmoney.damsel.fraudbusters.Withdrawal Maven / Gradle / Ivy

/**
 * 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.fraudbusters;

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 = "2021-02-10")
public class Withdrawal 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("Withdrawal");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField EVENT_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("event_time", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField DESTINATION_RESOURCE_FIELD_DESC = new org.apache.thrift.protocol.TField("destination_resource", org.apache.thrift.protocol.TType.STRUCT, (short)3);
  private static final org.apache.thrift.protocol.TField COST_FIELD_DESC = new org.apache.thrift.protocol.TField("cost", org.apache.thrift.protocol.TType.STRUCT, (short)4);
  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("account", org.apache.thrift.protocol.TType.STRUCT, (short)6);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new WithdrawalStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new WithdrawalTupleSchemeFactory();

  public String id; // required
  public String event_time; // required
  public Resource destination_resource; // required
  public com.rbkmoney.damsel.domain.Cash cost; // required
  public WithdrawalStatus status; // required
  public Account account; // 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 {
    ID((short)1, "id"),
    EVENT_TIME((short)2, "event_time"),
    DESTINATION_RESOURCE((short)3, "destination_resource"),
    COST((short)4, "cost"),
    STATUS((short)5, "status"),
    ACCOUNT((short)6, "account");

    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: // ID
          return ID;
        case 2: // EVENT_TIME
          return EVENT_TIME;
        case 3: // DESTINATION_RESOURCE
          return DESTINATION_RESOURCE;
        case 4: // COST
          return COST;
        case 5: // STATUS
          return STATUS;
        case 6: // ACCOUNT
          return ACCOUNT;
        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
  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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.EVENT_TIME, new org.apache.thrift.meta_data.FieldMetaData("event_time", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESTINATION_RESOURCE, new org.apache.thrift.meta_data.FieldMetaData("destination_resource", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Resource.class)));
    tmpMap.put(_Fields.COST, new org.apache.thrift.meta_data.FieldMetaData("cost", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.damsel.domain.Cash.class)));
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, WithdrawalStatus.class)));
    tmpMap.put(_Fields.ACCOUNT, new org.apache.thrift.meta_data.FieldMetaData("account", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Account.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Withdrawal.class, metaDataMap);
  }

  public Withdrawal() {
  }

  public Withdrawal(
    String id,
    String event_time,
    Resource destination_resource,
    com.rbkmoney.damsel.domain.Cash cost,
    WithdrawalStatus status,
    Account account)
  {
    this();
    this.id = id;
    this.event_time = event_time;
    this.destination_resource = destination_resource;
    this.cost = cost;
    this.status = status;
    this.account = account;
  }

  /**
   * Performs a deep copy on other.
   */
  public Withdrawal(Withdrawal other) {
    if (other.isSetId()) {
      this.id = other.id;
    }
    if (other.isSetEventTime()) {
      this.event_time = other.event_time;
    }
    if (other.isSetDestinationResource()) {
      this.destination_resource = new Resource(other.destination_resource);
    }
    if (other.isSetCost()) {
      this.cost = new com.rbkmoney.damsel.domain.Cash(other.cost);
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    if (other.isSetAccount()) {
      this.account = new Account(other.account);
    }
  }

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

  @Override
  public void clear() {
    this.id = null;
    this.event_time = null;
    this.destination_resource = null;
    this.cost = null;
    this.status = null;
    this.account = null;
  }

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

  public Withdrawal setId(String 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 String getEventTime() {
    return this.event_time;
  }

  public Withdrawal setEventTime(String event_time) {
    this.event_time = event_time;
    return this;
  }

  public void unsetEventTime() {
    this.event_time = null;
  }

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

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

  public Resource getDestinationResource() {
    return this.destination_resource;
  }

  public Withdrawal setDestinationResource(Resource destination_resource) {
    this.destination_resource = destination_resource;
    return this;
  }

  public void unsetDestinationResource() {
    this.destination_resource = null;
  }

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

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

  public com.rbkmoney.damsel.domain.Cash getCost() {
    return this.cost;
  }

  public Withdrawal setCost(com.rbkmoney.damsel.domain.Cash cost) {
    this.cost = cost;
    return this;
  }

  public void unsetCost() {
    this.cost = null;
  }

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

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

  public WithdrawalStatus getStatus() {
    return this.status;
  }

  public Withdrawal setStatus(WithdrawalStatus status) {
    this.status = status;
    return this;
  }

  public void unsetStatus() {
    this.status = null;
  }

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

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

  public Account getAccount() {
    return this.account;
  }

  public Withdrawal setAccount(Account account) {
    this.account = account;
    return this;
  }

  public void unsetAccount() {
    this.account = null;
  }

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

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

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((String)value);
      }
      break;

    case EVENT_TIME:
      if (value == null) {
        unsetEventTime();
      } else {
        setEventTime((String)value);
      }
      break;

    case DESTINATION_RESOURCE:
      if (value == null) {
        unsetDestinationResource();
      } else {
        setDestinationResource((Resource)value);
      }
      break;

    case COST:
      if (value == null) {
        unsetCost();
      } else {
        setCost((com.rbkmoney.damsel.domain.Cash)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((WithdrawalStatus)value);
      }
      break;

    case ACCOUNT:
      if (value == null) {
        unsetAccount();
      } else {
        setAccount((Account)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return getId();

    case EVENT_TIME:
      return getEventTime();

    case DESTINATION_RESOURCE:
      return getDestinationResource();

    case COST:
      return getCost();

    case STATUS:
      return getStatus();

    case ACCOUNT:
      return getAccount();

    }
    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 ID:
      return isSetId();
    case EVENT_TIME:
      return isSetEventTime();
    case DESTINATION_RESOURCE:
      return isSetDestinationResource();
    case COST:
      return isSetCost();
    case STATUS:
      return isSetStatus();
    case ACCOUNT:
      return isSetAccount();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(Withdrawal that) {
    if (that == null)
      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;
    }

    boolean this_present_event_time = true && this.isSetEventTime();
    boolean that_present_event_time = true && that.isSetEventTime();
    if (this_present_event_time || that_present_event_time) {
      if (!(this_present_event_time && that_present_event_time))
        return false;
      if (!this.event_time.equals(that.event_time))
        return false;
    }

    boolean this_present_destination_resource = true && this.isSetDestinationResource();
    boolean that_present_destination_resource = true && that.isSetDestinationResource();
    if (this_present_destination_resource || that_present_destination_resource) {
      if (!(this_present_destination_resource && that_present_destination_resource))
        return false;
      if (!this.destination_resource.equals(that.destination_resource))
        return false;
    }

    boolean this_present_cost = true && this.isSetCost();
    boolean that_present_cost = true && that.isSetCost();
    if (this_present_cost || that_present_cost) {
      if (!(this_present_cost && that_present_cost))
        return false;
      if (!this.cost.equals(that.cost))
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_account = true && this.isSetAccount();
    boolean that_present_account = true && that.isSetAccount();
    if (this_present_account || that_present_account) {
      if (!(this_present_account && that_present_account))
        return false;
      if (!this.account.equals(that.account))
        return false;
    }

    return true;
  }

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

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

    hashCode = hashCode * 8191 + ((isSetEventTime()) ? 131071 : 524287);
    if (isSetEventTime())
      hashCode = hashCode * 8191 + event_time.hashCode();

    hashCode = hashCode * 8191 + ((isSetDestinationResource()) ? 131071 : 524287);
    if (isSetDestinationResource())
      hashCode = hashCode * 8191 + destination_resource.hashCode();

    hashCode = hashCode * 8191 + ((isSetCost()) ? 131071 : 524287);
    if (isSetCost())
      hashCode = hashCode * 8191 + cost.hashCode();

    hashCode = hashCode * 8191 + ((isSetStatus()) ? 131071 : 524287);
    if (isSetStatus())
      hashCode = hashCode * 8191 + status.getValue();

    hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287);
    if (isSetAccount())
      hashCode = hashCode * 8191 + account.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    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;
      }
    }
    lastComparison = Boolean.valueOf(isSetEventTime()).compareTo(other.isSetEventTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEventTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event_time, other.event_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDestinationResource()).compareTo(other.isSetDestinationResource());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDestinationResource()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.destination_resource, other.destination_resource);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCost()).compareTo(other.isSetCost());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCost()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cost, other.cost);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAccount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account);
      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("Withdrawal(");
    boolean first = true;

    sb.append("id:");
    if (this.id == null) {
      sb.append("null");
    } else {
      sb.append(this.id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("event_time:");
    if (this.event_time == null) {
      sb.append("null");
    } else {
      sb.append(this.event_time);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("destination_resource:");
    if (this.destination_resource == null) {
      sb.append("null");
    } else {
      sb.append(this.destination_resource);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("cost:");
    if (this.cost == null) {
      sb.append("null");
    } else {
      sb.append(this.cost);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("account:");
    if (this.account == null) {
      sb.append("null");
    } else {
      sb.append(this.account);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

  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 WithdrawalStandardSchemeFactory implements SchemeFactory {
    public WithdrawalStandardScheme getScheme() {
      return new WithdrawalStandardScheme();
    }
  }

  private static class WithdrawalStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Withdrawal 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: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.id = iprot.readString();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // EVENT_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.event_time = iprot.readString();
              struct.setEventTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DESTINATION_RESOURCE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.destination_resource = new Resource();
              struct.destination_resource.read(iprot);
              struct.setDestinationResourceIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // COST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.cost = new com.rbkmoney.damsel.domain.Cash();
              struct.cost.read(iprot);
              struct.setCostIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.status = com.rbkmoney.damsel.fraudbusters.WithdrawalStatus.findByValue(iprot.readI32());
              struct.setStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // ACCOUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.account = new Account();
              struct.account.read(iprot);
              struct.setAccountIsSet(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, Withdrawal struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.id != null) {
        oprot.writeFieldBegin(ID_FIELD_DESC);
        oprot.writeString(struct.id);
        oprot.writeFieldEnd();
      }
      if (struct.event_time != null) {
        oprot.writeFieldBegin(EVENT_TIME_FIELD_DESC);
        oprot.writeString(struct.event_time);
        oprot.writeFieldEnd();
      }
      if (struct.destination_resource != null) {
        oprot.writeFieldBegin(DESTINATION_RESOURCE_FIELD_DESC);
        struct.destination_resource.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.cost != null) {
        oprot.writeFieldBegin(COST_FIELD_DESC);
        struct.cost.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(struct.status.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.account != null) {
        oprot.writeFieldBegin(ACCOUNT_FIELD_DESC);
        struct.account.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class WithdrawalTupleSchemeFactory implements SchemeFactory {
    public WithdrawalTupleScheme getScheme() {
      return new WithdrawalTupleScheme();
    }
  }

  private static class WithdrawalTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Withdrawal struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.id);
      oprot.writeString(struct.event_time);
      struct.destination_resource.write(oprot);
      struct.cost.write(oprot);
      oprot.writeI32(struct.status.getValue());
      struct.account.write(oprot);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Withdrawal struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.id = iprot.readString();
      struct.setIdIsSet(true);
      struct.event_time = iprot.readString();
      struct.setEventTimeIsSet(true);
      struct.destination_resource = new Resource();
      struct.destination_resource.read(iprot);
      struct.setDestinationResourceIsSet(true);
      struct.cost = new com.rbkmoney.damsel.domain.Cash();
      struct.cost.read(iprot);
      struct.setCostIsSet(true);
      struct.status = com.rbkmoney.damsel.fraudbusters.WithdrawalStatus.findByValue(iprot.readI32());
      struct.setStatusIsSet(true);
      struct.account = new Account();
      struct.account.read(iprot);
      struct.setAccountIsSet(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