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

com.rbkmoney.damsel.fraudbusters.CascasdingTemplateEmulation 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 CascasdingTemplateEmulation 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("CascasdingTemplateEmulation");

  private static final org.apache.thrift.protocol.TField TEMPLATE_FIELD_DESC = new org.apache.thrift.protocol.TField("template", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField REF_FIELD_DESC = new org.apache.thrift.protocol.TField("ref", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField RULE_SET_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("rule_set_timestamp", org.apache.thrift.protocol.TType.STRING, (short)3);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new CascasdingTemplateEmulationStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new CascasdingTemplateEmulationTupleSchemeFactory();

  public Template template; // required
  public TemplateReference ref; // required
  public String rule_set_timestamp; // 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 {
    TEMPLATE((short)1, "template"),
    REF((short)2, "ref"),
    RULE_SET_TIMESTAMP((short)3, "rule_set_timestamp");

    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: // TEMPLATE
          return TEMPLATE;
        case 2: // REF
          return REF;
        case 3: // RULE_SET_TIMESTAMP
          return RULE_SET_TIMESTAMP;
        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_SET_TIMESTAMP};
  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.TEMPLATE, new org.apache.thrift.meta_data.FieldMetaData("template", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Template.class)));
    tmpMap.put(_Fields.REF, new org.apache.thrift.meta_data.FieldMetaData("ref", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TemplateReference.class)));
    tmpMap.put(_Fields.RULE_SET_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("rule_set_timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CascasdingTemplateEmulation.class, metaDataMap);
  }

  public CascasdingTemplateEmulation() {
  }

  public CascasdingTemplateEmulation(
    Template template,
    TemplateReference ref)
  {
    this();
    this.template = template;
    this.ref = ref;
  }

  /**
   * Performs a deep copy on other.
   */
  public CascasdingTemplateEmulation(CascasdingTemplateEmulation other) {
    if (other.isSetTemplate()) {
      this.template = new Template(other.template);
    }
    if (other.isSetRef()) {
      this.ref = new TemplateReference(other.ref);
    }
    if (other.isSetRuleSetTimestamp()) {
      this.rule_set_timestamp = other.rule_set_timestamp;
    }
  }

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

  @Override
  public void clear() {
    this.template = null;
    this.ref = null;
    this.rule_set_timestamp = null;
  }

  public Template getTemplate() {
    return this.template;
  }

  public CascasdingTemplateEmulation setTemplate(Template template) {
    this.template = template;
    return this;
  }

  public void unsetTemplate() {
    this.template = null;
  }

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

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

  public TemplateReference getRef() {
    return this.ref;
  }

  public CascasdingTemplateEmulation setRef(TemplateReference ref) {
    this.ref = ref;
    return this;
  }

  public void unsetRef() {
    this.ref = null;
  }

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

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

  public String getRuleSetTimestamp() {
    return this.rule_set_timestamp;
  }

  public CascasdingTemplateEmulation setRuleSetTimestamp(String rule_set_timestamp) {
    this.rule_set_timestamp = rule_set_timestamp;
    return this;
  }

  public void unsetRuleSetTimestamp() {
    this.rule_set_timestamp = null;
  }

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

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

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TEMPLATE:
      if (value == null) {
        unsetTemplate();
      } else {
        setTemplate((Template)value);
      }
      break;

    case REF:
      if (value == null) {
        unsetRef();
      } else {
        setRef((TemplateReference)value);
      }
      break;

    case RULE_SET_TIMESTAMP:
      if (value == null) {
        unsetRuleSetTimestamp();
      } else {
        setRuleSetTimestamp((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TEMPLATE:
      return getTemplate();

    case REF:
      return getRef();

    case RULE_SET_TIMESTAMP:
      return getRuleSetTimestamp();

    }
    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 TEMPLATE:
      return isSetTemplate();
    case REF:
      return isSetRef();
    case RULE_SET_TIMESTAMP:
      return isSetRuleSetTimestamp();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_template = true && this.isSetTemplate();
    boolean that_present_template = true && that.isSetTemplate();
    if (this_present_template || that_present_template) {
      if (!(this_present_template && that_present_template))
        return false;
      if (!this.template.equals(that.template))
        return false;
    }

    boolean this_present_ref = true && this.isSetRef();
    boolean that_present_ref = true && that.isSetRef();
    if (this_present_ref || that_present_ref) {
      if (!(this_present_ref && that_present_ref))
        return false;
      if (!this.ref.equals(that.ref))
        return false;
    }

    boolean this_present_rule_set_timestamp = true && this.isSetRuleSetTimestamp();
    boolean that_present_rule_set_timestamp = true && that.isSetRuleSetTimestamp();
    if (this_present_rule_set_timestamp || that_present_rule_set_timestamp) {
      if (!(this_present_rule_set_timestamp && that_present_rule_set_timestamp))
        return false;
      if (!this.rule_set_timestamp.equals(that.rule_set_timestamp))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetTemplate()) ? 131071 : 524287);
    if (isSetTemplate())
      hashCode = hashCode * 8191 + template.hashCode();

    hashCode = hashCode * 8191 + ((isSetRef()) ? 131071 : 524287);
    if (isSetRef())
      hashCode = hashCode * 8191 + ref.hashCode();

    hashCode = hashCode * 8191 + ((isSetRuleSetTimestamp()) ? 131071 : 524287);
    if (isSetRuleSetTimestamp())
      hashCode = hashCode * 8191 + rule_set_timestamp.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTemplate()).compareTo(other.isSetTemplate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTemplate()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.template, other.template);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRef()).compareTo(other.isSetRef());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRef()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref, other.ref);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRuleSetTimestamp()).compareTo(other.isSetRuleSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRuleSetTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rule_set_timestamp, other.rule_set_timestamp);
      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("CascasdingTemplateEmulation(");
    boolean first = true;

    sb.append("template:");
    if (this.template == null) {
      sb.append("null");
    } else {
      sb.append(this.template);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("ref:");
    if (this.ref == null) {
      sb.append("null");
    } else {
      sb.append(this.ref);
    }
    first = false;
    if (isSetRuleSetTimestamp()) {
      if (!first) sb.append(", ");
      sb.append("rule_set_timestamp:");
      if (this.rule_set_timestamp == null) {
        sb.append("null");
      } else {
        sb.append(this.rule_set_timestamp);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (template != null) {
      template.validate();
    }
    if (ref != null) {
      ref.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 CascasdingTemplateEmulationStandardSchemeFactory implements SchemeFactory {
    public CascasdingTemplateEmulationStandardScheme getScheme() {
      return new CascasdingTemplateEmulationStandardScheme();
    }
  }

  private static class CascasdingTemplateEmulationStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, CascasdingTemplateEmulation 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: // TEMPLATE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.template = new Template();
              struct.template.read(iprot);
              struct.setTemplateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // REF
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.ref = new TemplateReference();
              struct.ref.read(iprot);
              struct.setRefIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // RULE_SET_TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.rule_set_timestamp = iprot.readString();
              struct.setRuleSetTimestampIsSet(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, CascasdingTemplateEmulation struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.template != null) {
        oprot.writeFieldBegin(TEMPLATE_FIELD_DESC);
        struct.template.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.ref != null) {
        oprot.writeFieldBegin(REF_FIELD_DESC);
        struct.ref.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.rule_set_timestamp != null) {
        if (struct.isSetRuleSetTimestamp()) {
          oprot.writeFieldBegin(RULE_SET_TIMESTAMP_FIELD_DESC);
          oprot.writeString(struct.rule_set_timestamp);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class CascasdingTemplateEmulationTupleSchemeFactory implements SchemeFactory {
    public CascasdingTemplateEmulationTupleScheme getScheme() {
      return new CascasdingTemplateEmulationTupleScheme();
    }
  }

  private static class CascasdingTemplateEmulationTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, CascasdingTemplateEmulation struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTemplate()) {
        optionals.set(0);
      }
      if (struct.isSetRef()) {
        optionals.set(1);
      }
      if (struct.isSetRuleSetTimestamp()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetTemplate()) {
        struct.template.write(oprot);
      }
      if (struct.isSetRef()) {
        struct.ref.write(oprot);
      }
      if (struct.isSetRuleSetTimestamp()) {
        oprot.writeString(struct.rule_set_timestamp);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, CascasdingTemplateEmulation struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.template = new Template();
        struct.template.read(iprot);
        struct.setTemplateIsSet(true);
      }
      if (incoming.get(1)) {
        struct.ref = new TemplateReference();
        struct.ref.read(iprot);
        struct.setRefIsSet(true);
      }
      if (incoming.get(2)) {
        struct.rule_set_timestamp = iprot.readString();
        struct.setRuleSetTimestampIsSet(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