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

com.rbkmoney.damsel.fraudbusters.ConcreteCheckResult 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 = "2021-10-14")
public class ConcreteCheckResult 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("ConcreteCheckResult");

  private static final org.apache.thrift.protocol.TField RESULT_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("result_status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField RULE_CHECKED_FIELD_DESC = new org.apache.thrift.protocol.TField("rule_checked", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField NOTIFICATIONS_RULE_FIELD_DESC = new org.apache.thrift.protocol.TField("notifications_rule", org.apache.thrift.protocol.TType.LIST, (short)3);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new ConcreteCheckResultStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new ConcreteCheckResultTupleSchemeFactory();

  public ResultStatus result_status; // required
  public String rule_checked; // optional
  public List notifications_rule; // 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 {
    RESULT_STATUS((short)1, "result_status"),
    RULE_CHECKED((short)2, "rule_checked"),
    NOTIFICATIONS_RULE((short)3, "notifications_rule");

    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: // RESULT_STATUS
          return RESULT_STATUS;
        case 2: // RULE_CHECKED
          return RULE_CHECKED;
        case 3: // NOTIFICATIONS_RULE
          return NOTIFICATIONS_RULE;
        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.RULE_CHECKED,_Fields.NOTIFICATIONS_RULE};
  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.RESULT_STATUS, new org.apache.thrift.meta_data.FieldMetaData("result_status", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ResultStatus.class)));
    tmpMap.put(_Fields.RULE_CHECKED, new org.apache.thrift.meta_data.FieldMetaData("rule_checked", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NOTIFICATIONS_RULE, new org.apache.thrift.meta_data.FieldMetaData("notifications_rule", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ConcreteCheckResult.class, metaDataMap);
  }

  public ConcreteCheckResult() {
  }

  public ConcreteCheckResult(
    ResultStatus result_status)
  {
    this();
    this.result_status = result_status;
  }

  /**
   * Performs a deep copy on other.
   */
  public ConcreteCheckResult(ConcreteCheckResult other) {
    if (other.isSetResultStatus()) {
      this.result_status = new ResultStatus(other.result_status);
    }
    if (other.isSetRuleChecked()) {
      this.rule_checked = other.rule_checked;
    }
    if (other.isSetNotificationsRule()) {
      List __this__notifications_rule = new ArrayList(other.notifications_rule);
      this.notifications_rule = __this__notifications_rule;
    }
  }

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

  @Override
  public void clear() {
    this.result_status = null;
    this.rule_checked = null;
    this.notifications_rule = null;
  }

  public ResultStatus getResultStatus() {
    return this.result_status;
  }

  public ConcreteCheckResult setResultStatus(ResultStatus result_status) {
    this.result_status = result_status;
    return this;
  }

  public void unsetResultStatus() {
    this.result_status = null;
  }

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

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

  public String getRuleChecked() {
    return this.rule_checked;
  }

  public ConcreteCheckResult setRuleChecked(String rule_checked) {
    this.rule_checked = rule_checked;
    return this;
  }

  public void unsetRuleChecked() {
    this.rule_checked = null;
  }

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

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

  public int getNotificationsRuleSize() {
    return (this.notifications_rule == null) ? 0 : this.notifications_rule.size();
  }

  public java.util.Iterator getNotificationsRuleIterator() {
    return (this.notifications_rule == null) ? null : this.notifications_rule.iterator();
  }

  public void addToNotificationsRule(String elem) {
    if (this.notifications_rule == null) {
      this.notifications_rule = new ArrayList();
    }
    this.notifications_rule.add(elem);
  }

  public List getNotificationsRule() {
    return this.notifications_rule;
  }

  public ConcreteCheckResult setNotificationsRule(List notifications_rule) {
    this.notifications_rule = notifications_rule;
    return this;
  }

  public void unsetNotificationsRule() {
    this.notifications_rule = null;
  }

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

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

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case RESULT_STATUS:
      if (value == null) {
        unsetResultStatus();
      } else {
        setResultStatus((ResultStatus)value);
      }
      break;

    case RULE_CHECKED:
      if (value == null) {
        unsetRuleChecked();
      } else {
        setRuleChecked((String)value);
      }
      break;

    case NOTIFICATIONS_RULE:
      if (value == null) {
        unsetNotificationsRule();
      } else {
        setNotificationsRule((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case RESULT_STATUS:
      return getResultStatus();

    case RULE_CHECKED:
      return getRuleChecked();

    case NOTIFICATIONS_RULE:
      return getNotificationsRule();

    }
    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 RESULT_STATUS:
      return isSetResultStatus();
    case RULE_CHECKED:
      return isSetRuleChecked();
    case NOTIFICATIONS_RULE:
      return isSetNotificationsRule();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_result_status = true && this.isSetResultStatus();
    boolean that_present_result_status = true && that.isSetResultStatus();
    if (this_present_result_status || that_present_result_status) {
      if (!(this_present_result_status && that_present_result_status))
        return false;
      if (!this.result_status.equals(that.result_status))
        return false;
    }

    boolean this_present_rule_checked = true && this.isSetRuleChecked();
    boolean that_present_rule_checked = true && that.isSetRuleChecked();
    if (this_present_rule_checked || that_present_rule_checked) {
      if (!(this_present_rule_checked && that_present_rule_checked))
        return false;
      if (!this.rule_checked.equals(that.rule_checked))
        return false;
    }

    boolean this_present_notifications_rule = true && this.isSetNotificationsRule();
    boolean that_present_notifications_rule = true && that.isSetNotificationsRule();
    if (this_present_notifications_rule || that_present_notifications_rule) {
      if (!(this_present_notifications_rule && that_present_notifications_rule))
        return false;
      if (!this.notifications_rule.equals(that.notifications_rule))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetResultStatus()) ? 131071 : 524287);
    if (isSetResultStatus())
      hashCode = hashCode * 8191 + result_status.hashCode();

    hashCode = hashCode * 8191 + ((isSetRuleChecked()) ? 131071 : 524287);
    if (isSetRuleChecked())
      hashCode = hashCode * 8191 + rule_checked.hashCode();

    hashCode = hashCode * 8191 + ((isSetNotificationsRule()) ? 131071 : 524287);
    if (isSetNotificationsRule())
      hashCode = hashCode * 8191 + notifications_rule.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetResultStatus()).compareTo(other.isSetResultStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResultStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result_status, other.result_status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRuleChecked()).compareTo(other.isSetRuleChecked());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRuleChecked()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rule_checked, other.rule_checked);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNotificationsRule()).compareTo(other.isSetNotificationsRule());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNotificationsRule()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notifications_rule, other.notifications_rule);
      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("ConcreteCheckResult(");
    boolean first = true;

    sb.append("result_status:");
    if (this.result_status == null) {
      sb.append("null");
    } else {
      sb.append(this.result_status);
    }
    first = false;
    if (isSetRuleChecked()) {
      if (!first) sb.append(", ");
      sb.append("rule_checked:");
      if (this.rule_checked == null) {
        sb.append("null");
      } else {
        sb.append(this.rule_checked);
      }
      first = false;
    }
    if (isSetNotificationsRule()) {
      if (!first) sb.append(", ");
      sb.append("notifications_rule:");
      if (this.notifications_rule == null) {
        sb.append("null");
      } else {
        sb.append(this.notifications_rule);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (result_status == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'result_status' 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 ConcreteCheckResultStandardSchemeFactory implements SchemeFactory {
    public ConcreteCheckResultStandardScheme getScheme() {
      return new ConcreteCheckResultStandardScheme();
    }
  }

  private static class ConcreteCheckResultStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ConcreteCheckResult 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: // RESULT_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.result_status = new ResultStatus();
              struct.result_status.read(iprot);
              struct.setResultStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // RULE_CHECKED
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.rule_checked = iprot.readString();
              struct.setRuleCheckedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NOTIFICATIONS_RULE
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
                struct.notifications_rule = new ArrayList(_list32.size);
                String _elem33;
                for (int _i34 = 0; _i34 < _list32.size; ++_i34)
                {
                  _elem33 = iprot.readString();
                  struct.notifications_rule.add(_elem33);
                }
                iprot.readListEnd();
              }
              struct.setNotificationsRuleIsSet(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, ConcreteCheckResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.result_status != null) {
        oprot.writeFieldBegin(RESULT_STATUS_FIELD_DESC);
        struct.result_status.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.rule_checked != null) {
        if (struct.isSetRuleChecked()) {
          oprot.writeFieldBegin(RULE_CHECKED_FIELD_DESC);
          oprot.writeString(struct.rule_checked);
          oprot.writeFieldEnd();
        }
      }
      if (struct.notifications_rule != null) {
        if (struct.isSetNotificationsRule()) {
          oprot.writeFieldBegin(NOTIFICATIONS_RULE_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.notifications_rule.size()));
            for (String _iter35 : struct.notifications_rule)
            {
              oprot.writeString(_iter35);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ConcreteCheckResultTupleSchemeFactory implements SchemeFactory {
    public ConcreteCheckResultTupleScheme getScheme() {
      return new ConcreteCheckResultTupleScheme();
    }
  }

  private static class ConcreteCheckResultTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ConcreteCheckResult struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      struct.result_status.write(oprot);
      BitSet optionals = new BitSet();
      if (struct.isSetRuleChecked()) {
        optionals.set(0);
      }
      if (struct.isSetNotificationsRule()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetRuleChecked()) {
        oprot.writeString(struct.rule_checked);
      }
      if (struct.isSetNotificationsRule()) {
        {
          oprot.writeI32(struct.notifications_rule.size());
          for (String _iter36 : struct.notifications_rule)
          {
            oprot.writeString(_iter36);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ConcreteCheckResult struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.result_status = new ResultStatus();
      struct.result_status.read(iprot);
      struct.setResultStatusIsSet(true);
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.rule_checked = iprot.readString();
        struct.setRuleCheckedIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.notifications_rule = new ArrayList(_list37.size);
          String _elem38;
          for (int _i39 = 0; _i39 < _list37.size; ++_i39)
          {
            _elem38 = iprot.readString();
            struct.notifications_rule.add(_elem38);
          }
        }
        struct.setNotificationsRuleIsSet(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