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

com.rbkmoney.damsel.fraudbusters.FraudPayment 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.99-2a8f6ca
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.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 = "2020-07-08")
public class FraudPayment 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("FraudPayment");

  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 REFERENCE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("reference_info", 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)5);
  private static final org.apache.thrift.protocol.TField PAYER_FIELD_DESC = new org.apache.thrift.protocol.TField("payer", org.apache.thrift.protocol.TType.STRUCT, (short)6);
  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)7);
  private static final org.apache.thrift.protocol.TField RRN_FIELD_DESC = new org.apache.thrift.protocol.TField("rrn", org.apache.thrift.protocol.TType.STRING, (short)8);
  private static final org.apache.thrift.protocol.TField ROUTE_FIELD_DESC = new org.apache.thrift.protocol.TField("route", org.apache.thrift.protocol.TType.STRUCT, (short)9);
  private static final org.apache.thrift.protocol.TField FRAUD_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("fraud_info", org.apache.thrift.protocol.TType.STRUCT, (short)10);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new FraudPaymentStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new FraudPaymentTupleSchemeFactory();

  public String id; // required
  public String event_time; // required
  public ReferenceInfo reference_info; // required
  public com.rbkmoney.damsel.domain.Cash cost; // required
  public com.rbkmoney.damsel.domain.Payer payer; // required
  /**
   * 
   * @see PaymentStatus
   */
  public PaymentStatus status; // required
  public String rrn; // optional
  public com.rbkmoney.damsel.domain.PaymentRoute route; // optional
  public FraudInfo fraud_info; // 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"),
    REFERENCE_INFO((short)3, "reference_info"),
    COST((short)5, "cost"),
    PAYER((short)6, "payer"),
    /**
     * 
     * @see PaymentStatus
     */
    STATUS((short)7, "status"),
    RRN((short)8, "rrn"),
    ROUTE((short)9, "route"),
    FRAUD_INFO((short)10, "fraud_info");

    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: // REFERENCE_INFO
          return REFERENCE_INFO;
        case 5: // COST
          return COST;
        case 6: // PAYER
          return PAYER;
        case 7: // STATUS
          return STATUS;
        case 8: // RRN
          return RRN;
        case 9: // ROUTE
          return ROUTE;
        case 10: // FRAUD_INFO
          return FRAUD_INFO;
        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.RRN,_Fields.ROUTE};
  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.REFERENCE_INFO, new org.apache.thrift.meta_data.FieldMetaData("reference_info", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ReferenceInfo.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.PAYER, new org.apache.thrift.meta_data.FieldMetaData("payer", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.damsel.domain.Payer.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, PaymentStatus.class)));
    tmpMap.put(_Fields.RRN, new org.apache.thrift.meta_data.FieldMetaData("rrn", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ROUTE, new org.apache.thrift.meta_data.FieldMetaData("route", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.damsel.domain.PaymentRoute.class)));
    tmpMap.put(_Fields.FRAUD_INFO, new org.apache.thrift.meta_data.FieldMetaData("fraud_info", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, FraudInfo.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FraudPayment.class, metaDataMap);
  }

  public FraudPayment() {
  }

  public FraudPayment(
    String id,
    String event_time,
    ReferenceInfo reference_info,
    com.rbkmoney.damsel.domain.Cash cost,
    com.rbkmoney.damsel.domain.Payer payer,
    PaymentStatus status,
    FraudInfo fraud_info)
  {
    this();
    this.id = id;
    this.event_time = event_time;
    this.reference_info = reference_info;
    this.cost = cost;
    this.payer = payer;
    this.status = status;
    this.fraud_info = fraud_info;
  }

  /**
   * Performs a deep copy on other.
   */
  public FraudPayment(FraudPayment other) {
    if (other.isSetId()) {
      this.id = other.id;
    }
    if (other.isSetEventTime()) {
      this.event_time = other.event_time;
    }
    if (other.isSetReferenceInfo()) {
      this.reference_info = new ReferenceInfo(other.reference_info);
    }
    if (other.isSetCost()) {
      this.cost = new com.rbkmoney.damsel.domain.Cash(other.cost);
    }
    if (other.isSetPayer()) {
      this.payer = new com.rbkmoney.damsel.domain.Payer(other.payer);
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    if (other.isSetRrn()) {
      this.rrn = other.rrn;
    }
    if (other.isSetRoute()) {
      this.route = new com.rbkmoney.damsel.domain.PaymentRoute(other.route);
    }
    if (other.isSetFraudInfo()) {
      this.fraud_info = new FraudInfo(other.fraud_info);
    }
  }

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

  @Override
  public void clear() {
    this.id = null;
    this.event_time = null;
    this.reference_info = null;
    this.cost = null;
    this.payer = null;
    this.status = null;
    this.rrn = null;
    this.route = null;
    this.fraud_info = null;
  }

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

  public FraudPayment 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 FraudPayment 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 ReferenceInfo getReferenceInfo() {
    return this.reference_info;
  }

  public FraudPayment setReferenceInfo(ReferenceInfo reference_info) {
    this.reference_info = reference_info;
    return this;
  }

  public void unsetReferenceInfo() {
    this.reference_info = null;
  }

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

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

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

  public FraudPayment 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 com.rbkmoney.damsel.domain.Payer getPayer() {
    return this.payer;
  }

  public FraudPayment setPayer(com.rbkmoney.damsel.domain.Payer payer) {
    this.payer = payer;
    return this;
  }

  public void unsetPayer() {
    this.payer = null;
  }

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

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

  /**
   * 
   * @see PaymentStatus
   */
  public PaymentStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see PaymentStatus
   */
  public FraudPayment setStatus(PaymentStatus 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 String getRrn() {
    return this.rrn;
  }

  public FraudPayment setRrn(String rrn) {
    this.rrn = rrn;
    return this;
  }

  public void unsetRrn() {
    this.rrn = null;
  }

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

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

  public com.rbkmoney.damsel.domain.PaymentRoute getRoute() {
    return this.route;
  }

  public FraudPayment setRoute(com.rbkmoney.damsel.domain.PaymentRoute route) {
    this.route = route;
    return this;
  }

  public void unsetRoute() {
    this.route = null;
  }

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

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

  public FraudInfo getFraudInfo() {
    return this.fraud_info;
  }

  public FraudPayment setFraudInfo(FraudInfo fraud_info) {
    this.fraud_info = fraud_info;
    return this;
  }

  public void unsetFraudInfo() {
    this.fraud_info = null;
  }

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

  public void setFraudInfoIsSet(boolean value) {
    if (!value) {
      this.fraud_info = 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 REFERENCE_INFO:
      if (value == null) {
        unsetReferenceInfo();
      } else {
        setReferenceInfo((ReferenceInfo)value);
      }
      break;

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

    case PAYER:
      if (value == null) {
        unsetPayer();
      } else {
        setPayer((com.rbkmoney.damsel.domain.Payer)value);
      }
      break;

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

    case RRN:
      if (value == null) {
        unsetRrn();
      } else {
        setRrn((String)value);
      }
      break;

    case ROUTE:
      if (value == null) {
        unsetRoute();
      } else {
        setRoute((com.rbkmoney.damsel.domain.PaymentRoute)value);
      }
      break;

    case FRAUD_INFO:
      if (value == null) {
        unsetFraudInfo();
      } else {
        setFraudInfo((FraudInfo)value);
      }
      break;

    }
  }

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

    case EVENT_TIME:
      return getEventTime();

    case REFERENCE_INFO:
      return getReferenceInfo();

    case COST:
      return getCost();

    case PAYER:
      return getPayer();

    case STATUS:
      return getStatus();

    case RRN:
      return getRrn();

    case ROUTE:
      return getRoute();

    case FRAUD_INFO:
      return getFraudInfo();

    }
    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 REFERENCE_INFO:
      return isSetReferenceInfo();
    case COST:
      return isSetCost();
    case PAYER:
      return isSetPayer();
    case STATUS:
      return isSetStatus();
    case RRN:
      return isSetRrn();
    case ROUTE:
      return isSetRoute();
    case FRAUD_INFO:
      return isSetFraudInfo();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(FraudPayment 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_reference_info = true && this.isSetReferenceInfo();
    boolean that_present_reference_info = true && that.isSetReferenceInfo();
    if (this_present_reference_info || that_present_reference_info) {
      if (!(this_present_reference_info && that_present_reference_info))
        return false;
      if (!this.reference_info.equals(that.reference_info))
        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_payer = true && this.isSetPayer();
    boolean that_present_payer = true && that.isSetPayer();
    if (this_present_payer || that_present_payer) {
      if (!(this_present_payer && that_present_payer))
        return false;
      if (!this.payer.equals(that.payer))
        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_rrn = true && this.isSetRrn();
    boolean that_present_rrn = true && that.isSetRrn();
    if (this_present_rrn || that_present_rrn) {
      if (!(this_present_rrn && that_present_rrn))
        return false;
      if (!this.rrn.equals(that.rrn))
        return false;
    }

    boolean this_present_route = true && this.isSetRoute();
    boolean that_present_route = true && that.isSetRoute();
    if (this_present_route || that_present_route) {
      if (!(this_present_route && that_present_route))
        return false;
      if (!this.route.equals(that.route))
        return false;
    }

    boolean this_present_fraud_info = true && this.isSetFraudInfo();
    boolean that_present_fraud_info = true && that.isSetFraudInfo();
    if (this_present_fraud_info || that_present_fraud_info) {
      if (!(this_present_fraud_info && that_present_fraud_info))
        return false;
      if (!this.fraud_info.equals(that.fraud_info))
        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 + ((isSetReferenceInfo()) ? 131071 : 524287);
    if (isSetReferenceInfo())
      hashCode = hashCode * 8191 + reference_info.hashCode();

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

    hashCode = hashCode * 8191 + ((isSetPayer()) ? 131071 : 524287);
    if (isSetPayer())
      hashCode = hashCode * 8191 + payer.hashCode();

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

    hashCode = hashCode * 8191 + ((isSetRrn()) ? 131071 : 524287);
    if (isSetRrn())
      hashCode = hashCode * 8191 + rrn.hashCode();

    hashCode = hashCode * 8191 + ((isSetRoute()) ? 131071 : 524287);
    if (isSetRoute())
      hashCode = hashCode * 8191 + route.hashCode();

    hashCode = hashCode * 8191 + ((isSetFraudInfo()) ? 131071 : 524287);
    if (isSetFraudInfo())
      hashCode = hashCode * 8191 + fraud_info.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(FraudPayment 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(isSetReferenceInfo()).compareTo(other.isSetReferenceInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReferenceInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reference_info, other.reference_info);
      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(isSetPayer()).compareTo(other.isSetPayer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPayer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payer, other.payer);
      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(isSetRrn()).compareTo(other.isSetRrn());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRrn()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rrn, other.rrn);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoute()).compareTo(other.isSetRoute());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoute()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.route, other.route);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFraudInfo()).compareTo(other.isSetFraudInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFraudInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fraud_info, other.fraud_info);
      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("FraudPayment(");
    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("reference_info:");
    if (this.reference_info == null) {
      sb.append("null");
    } else {
      sb.append(this.reference_info);
    }
    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("payer:");
    if (this.payer == null) {
      sb.append("null");
    } else {
      sb.append(this.payer);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (isSetRrn()) {
      if (!first) sb.append(", ");
      sb.append("rrn:");
      if (this.rrn == null) {
        sb.append("null");
      } else {
        sb.append(this.rrn);
      }
      first = false;
    }
    if (isSetRoute()) {
      if (!first) sb.append(", ");
      sb.append("route:");
      if (this.route == null) {
        sb.append("null");
      } else {
        sb.append(this.route);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("fraud_info:");
    if (this.fraud_info == null) {
      sb.append("null");
    } else {
      sb.append(this.fraud_info);
    }
    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 (reference_info == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'reference_info' was not present! Struct: " + toString());
    }
    if (cost == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'cost' was not present! Struct: " + toString());
    }
    if (payer == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'payer' was not present! Struct: " + toString());
    }
    if (status == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' was not present! Struct: " + toString());
    }
    if (fraud_info == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'fraud_info' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (cost != null) {
      cost.validate();
    }
    if (route != null) {
      route.validate();
    }
    if (fraud_info != null) {
      fraud_info.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 FraudPaymentStandardSchemeFactory implements SchemeFactory {
    public FraudPaymentStandardScheme getScheme() {
      return new FraudPaymentStandardScheme();
    }
  }

  private static class FraudPaymentStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FraudPayment 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: // REFERENCE_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.reference_info = new ReferenceInfo();
              struct.reference_info.read(iprot);
              struct.setReferenceInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // 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 6: // PAYER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.payer = new com.rbkmoney.damsel.domain.Payer();
              struct.payer.read(iprot);
              struct.setPayerIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.status = com.rbkmoney.damsel.fraudbusters.PaymentStatus.findByValue(iprot.readI32());
              struct.setStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // RRN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.rrn = iprot.readString();
              struct.setRrnIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // ROUTE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.route = new com.rbkmoney.damsel.domain.PaymentRoute();
              struct.route.read(iprot);
              struct.setRouteIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // FRAUD_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.fraud_info = new FraudInfo();
              struct.fraud_info.read(iprot);
              struct.setFraudInfoIsSet(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, FraudPayment 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.reference_info != null) {
        oprot.writeFieldBegin(REFERENCE_INFO_FIELD_DESC);
        struct.reference_info.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.cost != null) {
        oprot.writeFieldBegin(COST_FIELD_DESC);
        struct.cost.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.payer != null) {
        oprot.writeFieldBegin(PAYER_FIELD_DESC);
        struct.payer.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(struct.status.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.rrn != null) {
        if (struct.isSetRrn()) {
          oprot.writeFieldBegin(RRN_FIELD_DESC);
          oprot.writeString(struct.rrn);
          oprot.writeFieldEnd();
        }
      }
      if (struct.route != null) {
        if (struct.isSetRoute()) {
          oprot.writeFieldBegin(ROUTE_FIELD_DESC);
          struct.route.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.fraud_info != null) {
        oprot.writeFieldBegin(FRAUD_INFO_FIELD_DESC);
        struct.fraud_info.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FraudPaymentTupleSchemeFactory implements SchemeFactory {
    public FraudPaymentTupleScheme getScheme() {
      return new FraudPaymentTupleScheme();
    }
  }

  private static class FraudPaymentTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FraudPayment struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.id);
      oprot.writeString(struct.event_time);
      struct.reference_info.write(oprot);
      struct.cost.write(oprot);
      struct.payer.write(oprot);
      oprot.writeI32(struct.status.getValue());
      struct.fraud_info.write(oprot);
      BitSet optionals = new BitSet();
      if (struct.isSetRrn()) {
        optionals.set(0);
      }
      if (struct.isSetRoute()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetRrn()) {
        oprot.writeString(struct.rrn);
      }
      if (struct.isSetRoute()) {
        struct.route.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FraudPayment 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.reference_info = new ReferenceInfo();
      struct.reference_info.read(iprot);
      struct.setReferenceInfoIsSet(true);
      struct.cost = new com.rbkmoney.damsel.domain.Cash();
      struct.cost.read(iprot);
      struct.setCostIsSet(true);
      struct.payer = new com.rbkmoney.damsel.domain.Payer();
      struct.payer.read(iprot);
      struct.setPayerIsSet(true);
      struct.status = com.rbkmoney.damsel.fraudbusters.PaymentStatus.findByValue(iprot.readI32());
      struct.setStatusIsSet(true);
      struct.fraud_info = new FraudInfo();
      struct.fraud_info.read(iprot);
      struct.setFraudInfoIsSet(true);
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.rrn = iprot.readString();
        struct.setRrnIsSet(true);
      }
      if (incoming.get(1)) {
        struct.route = new com.rbkmoney.damsel.domain.PaymentRoute();
        struct.route.read(iprot);
        struct.setRouteIsSet(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