All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rbkmoney.damsel.fraudbusters.ValidateTemplateResponse 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 ValidateTemplateResponse 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("ValidateTemplateResponse");
private static final org.apache.thrift.protocol.TField ERRORS_FIELD_DESC = new org.apache.thrift.protocol.TField("errors", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final SchemeFactory STANDARD_SCHEME_FACTORY = new ValidateTemplateResponseStandardSchemeFactory();
private static final SchemeFactory TUPLE_SCHEME_FACTORY = new ValidateTemplateResponseTupleSchemeFactory();
public List errors; // 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 {
ERRORS((short)1, "errors");
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: // ERRORS
return ERRORS;
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.ERRORS};
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.ERRORS, new org.apache.thrift.meta_data.FieldMetaData("errors", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TemplateValidateError.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ValidateTemplateResponse.class, metaDataMap);
}
public ValidateTemplateResponse() {
}
/**
* Performs a deep copy on other .
*/
public ValidateTemplateResponse(ValidateTemplateResponse other) {
if (other.isSetErrors()) {
List __this__errors = new ArrayList(other.errors.size());
for (TemplateValidateError other_element : other.errors) {
__this__errors.add(other_element);
}
this.errors = __this__errors;
}
}
public ValidateTemplateResponse deepCopy() {
return new ValidateTemplateResponse(this);
}
@Override
public void clear() {
this.errors = null;
}
public int getErrorsSize() {
return (this.errors == null) ? 0 : this.errors.size();
}
public java.util.Iterator getErrorsIterator() {
return (this.errors == null) ? null : this.errors.iterator();
}
public void addToErrors(TemplateValidateError elem) {
if (this.errors == null) {
this.errors = new ArrayList();
}
this.errors.add(elem);
}
public List getErrors() {
return this.errors;
}
public ValidateTemplateResponse setErrors(List errors) {
this.errors = errors;
return this;
}
public void unsetErrors() {
this.errors = null;
}
/** Returns true if field errors is set (has been assigned a value) and false otherwise */
public boolean isSetErrors() {
return this.errors != null;
}
public void setErrorsIsSet(boolean value) {
if (!value) {
this.errors = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ERRORS:
if (value == null) {
unsetErrors();
} else {
setErrors((List)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ERRORS:
return getErrors();
}
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 ERRORS:
return isSetErrors();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ValidateTemplateResponse)
return this.equals((ValidateTemplateResponse)that);
return false;
}
public boolean equals(ValidateTemplateResponse that) {
if (that == null)
return false;
boolean this_present_errors = true && this.isSetErrors();
boolean that_present_errors = true && that.isSetErrors();
if (this_present_errors || that_present_errors) {
if (!(this_present_errors && that_present_errors))
return false;
if (!this.errors.equals(that.errors))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetErrors()) ? 131071 : 524287);
if (isSetErrors())
hashCode = hashCode * 8191 + errors.hashCode();
return hashCode;
}
@Override
public int compareTo(ValidateTemplateResponse other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetErrors()).compareTo(other.isSetErrors());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetErrors()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errors, other.errors);
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("ValidateTemplateResponse(");
boolean first = true;
if (isSetErrors()) {
sb.append("errors:");
if (this.errors == null) {
sb.append("null");
} else {
sb.append(this.errors);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// 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 ValidateTemplateResponseStandardSchemeFactory implements SchemeFactory {
public ValidateTemplateResponseStandardScheme getScheme() {
return new ValidateTemplateResponseStandardScheme();
}
}
private static class ValidateTemplateResponseStandardScheme extends StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, ValidateTemplateResponse 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: // ERRORS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
struct.errors = new ArrayList(_list8.size);
TemplateValidateError _elem9;
for (int _i10 = 0; _i10 < _list8.size; ++_i10)
{
_elem9 = new TemplateValidateError();
_elem9.read(iprot);
struct.errors.add(_elem9);
}
iprot.readListEnd();
}
struct.setErrorsIsSet(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, ValidateTemplateResponse struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.errors != null) {
if (struct.isSetErrors()) {
oprot.writeFieldBegin(ERRORS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.errors.size()));
for (TemplateValidateError _iter11 : struct.errors)
{
_iter11.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ValidateTemplateResponseTupleSchemeFactory implements SchemeFactory {
public ValidateTemplateResponseTupleScheme getScheme() {
return new ValidateTemplateResponseTupleScheme();
}
}
private static class ValidateTemplateResponseTupleScheme extends TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ValidateTemplateResponse struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetErrors()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetErrors()) {
{
oprot.writeI32(struct.errors.size());
for (TemplateValidateError _iter12 : struct.errors)
{
_iter12.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ValidateTemplateResponse struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.errors = new ArrayList(_list13.size);
TemplateValidateError _elem14;
for (int _i15 = 0; _i15 < _list13.size; ++_i15)
{
_elem14 = new TemplateValidateError();
_elem14.read(iprot);
struct.errors.add(_elem14);
}
}
struct.setErrorsIsSet(true);
}
}
}
private static S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}