/**
* Autogenerated by Thrift Compiler (0.8.0-dev)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.pyload.thrift;
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 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceCall implements org.apache.thrift.TBase<ServiceCall, ServiceCall._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServiceCall");
private static final org.apache.thrift.protocol.TField PLUGIN_FIELD_DESC = new org.apache.thrift.protocol.TField("plugin", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField FUNC_FIELD_DESC = new org.apache.thrift.protocol.TField("func", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("arguments", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField PARSE_ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("parseArguments", org.apache.thrift.protocol.TType.BOOL, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ServiceCallStandardSchemeFactory());
schemes.put(TupleScheme.class, new ServiceCallTupleSchemeFactory());
}
public String plugin; // required
public String func; // required
public List<String> arguments; // required
public boolean parseArguments; // 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 {
PLUGIN((short)1, "plugin"),
FUNC((short)2, "func"),
ARGUMENTS((short)3, "arguments"),
PARSE_ARGUMENTS((short)4, "parseArguments");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
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: // PLUGIN
return PLUGIN;
case 2: // FUNC
return FUNC;
case 3: // ARGUMENTS
return ARGUMENTS;
case 4: // PARSE_ARGUMENTS
return PARSE_ARGUMENTS;
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 int __PARSEARGUMENTS_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
private _Fields optionals[] = {_Fields.ARGUMENTS,_Fields.PARSE_ARGUMENTS};
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.PLUGIN, new org.apache.thrift.meta_data.FieldMetaData("plugin", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "PluginName")));
tmpMap.put(_Fields.FUNC, new org.apache.thrift.meta_data.FieldMetaData("func", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", 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))));
tmpMap.put(_Fields.PARSE_ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("parseArguments", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ServiceCall.class, metaDataMap);
}
public ServiceCall() {
}
public ServiceCall(
String plugin,
String func)
{
this();
this.plugin = plugin;
this.func = func;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ServiceCall(ServiceCall other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetPlugin()) {
this.plugin = other.plugin;
}
if (other.isSetFunc()) {
this.func = other.func;
}
if (other.isSetArguments()) {
List<String> __this__arguments = new ArrayList<String>();
for (String other_element : other.arguments) {
__this__arguments.add(other_element);
}
this.arguments = __this__arguments;
}
this.parseArguments = other.parseArguments;
}
public ServiceCall deepCopy() {
return new ServiceCall(this);
}
@Override
public void clear() {
this.plugin = null;
this.func = null;
this.arguments = null;
setParseArgumentsIsSet(false);
this.parseArguments = false;
}
public String getPlugin() {
return this.plugin;
}
public ServiceCall setPlugin(String plugin) {
this.plugin = plugin;
return this;
}
public void unsetPlugin() {
this.plugin = null;
}
/** Returns true if field plugin is set (has been assigned a value) and false otherwise */
public boolean isSetPlugin() {
return this.plugin != null;
}
public void setPluginIsSet(boolean value) {
if (!value) {
this.plugin = null;
}
}
public String getFunc() {
return this.func;
}
public ServiceCall setFunc(String func) {
this.func = func;
return this;
}
public void unsetFunc() {
this.func = null;
}
/** Returns true if field func is set (has been assigned a value) and false otherwise */
public boolean isSetFunc() {
return this.func != null;
}
public void setFuncIsSet(boolean value) {
if (!value) {
this.func = null;
}
}
public int getArgumentsSize() {
return (this.arguments == null) ? 0 : this.arguments.size();
}
public java.util.Iterator<String> getArgumentsIterator() {
return (this.arguments == null) ? null : this.arguments.iterator();
}
public void addToArguments(String elem) {
if (this.arguments == null) {
this.arguments = new ArrayList<String>();
}
this.arguments.add(elem);
}
public List<String> getArguments() {
return this.arguments;
}
public ServiceCall setArguments(List<String> arguments) {
this.arguments = arguments;
return this;
}
public void unsetArguments() {
this.arguments = null;
}
/** Returns true if field arguments is set (has been assigned a value) and false otherwise */
public boolean isSetArguments() {
return this.arguments != null;
}
public void setArgumentsIsSet(boolean value) {
if (!value) {
this.arguments = null;
}
}
public boolean isParseArguments() {
return this.parseArguments;
}
public ServiceCall setParseArguments(boolean parseArguments) {
this.parseArguments = parseArguments;
setParseArgumentsIsSet(true);
return this;
}
public void unsetParseArguments() {
__isset_bit_vector.clear(__PARSEARGUMENTS_ISSET_ID);
}
/** Returns true if field parseArguments is set (has been assigned a value) and false otherwise */
public boolean isSetParseArguments() {
return __isset_bit_vector.get(__PARSEARGUMENTS_ISSET_ID);
}
public void setParseArgumentsIsSet(boolean value) {
__isset_bit_vector.set(__PARSEARGUMENTS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case PLUGIN:
if (value == null) {
unsetPlugin();
} else {
setPlugin((String)value);
}
break;
case FUNC:
if (value == null) {
unsetFunc();
} else {
setFunc((String)value);
}
break;
case ARGUMENTS:
if (value == null) {
unsetArguments();
} else {
setArguments((List<String>)value);
}
break;
case PARSE_ARGUMENTS:
if (value == null) {
unsetParseArguments();
} else {
setParseArguments((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case PLUGIN:
return getPlugin();
case FUNC:
return getFunc();
case ARGUMENTS:
return getArguments();
case PARSE_ARGUMENTS:
return Boolean.valueOf(isParseArguments());
}
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 PLUGIN:
return isSetPlugin();
case FUNC:
return isSetFunc();
case ARGUMENTS:
return isSetArguments();
case PARSE_ARGUMENTS:
return isSetParseArguments();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ServiceCall)
return this.equals((ServiceCall)that);
return false;
}
public boolean equals(ServiceCall that) {
if (that == null)
return false;
boolean this_present_plugin = true && this.isSetPlugin();
boolean that_present_plugin = true && that.isSetPlugin();
if (this_present_plugin || that_present_plugin) {
if (!(this_present_plugin && that_present_plugin))
return false;
if (!this.plugin.equals(that.plugin))
return false;
}
boolean this_present_func = true && this.isSetFunc();
boolean that_present_func = true && that.isSetFunc();
if (this_present_func || that_present_func) {
if (!(this_present_func && that_present_func))
return false;
if (!this.func.equals(that.func))
return false;
}
boolean this_present_arguments = true && this.isSetArguments();
boolean that_present_arguments = true && that.isSetArguments();
if (this_present_arguments || that_present_arguments) {
if (!(this_present_arguments && that_present_arguments))
return false;
if (!this.arguments.equals(that.arguments))
return false;
}
boolean this_present_parseArguments = true && this.isSetParseArguments();
boolean that_present_parseArguments = true && that.isSetParseArguments();
if (this_present_parseArguments || that_present_parseArguments) {
if (!(this_present_parseArguments && that_present_parseArguments))
return false;
if (this.parseArguments != that.parseArguments)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(ServiceCall other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ServiceCall typedOther = (ServiceCall)other;
lastComparison = Boolean.valueOf(isSetPlugin()).compareTo(typedOther.isSetPlugin());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPlugin()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.plugin, typedOther.plugin);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFunc()).compareTo(typedOther.isSetFunc());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFunc()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.func, typedOther.func);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetArguments()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetParseArguments()).compareTo(typedOther.isSetParseArguments());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetParseArguments()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parseArguments, typedOther.parseArguments);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ServiceCall(");
boolean first = true;
sb.append("plugin:");
if (this.plugin == null) {
sb.append("null");
} else {
sb.append(this.plugin);
}
first = false;
if (!first) sb.append(", ");
sb.append("func:");
if (this.func == null) {
sb.append("null");
} else {
sb.append(this.func);
}
first = false;
if (isSetArguments()) {
if (!first) sb.append(", ");
sb.append("arguments:");
if (this.arguments == null) {
sb.append("null");
} else {
sb.append(this.arguments);
}
first = false;
}
if (isSetParseArguments()) {
if (!first) sb.append(", ");
sb.append("parseArguments:");
sb.append(this.parseArguments);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
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.getMessage());
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
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.getMessage());
}
}
private static class ServiceCallStandardSchemeFactory implements SchemeFactory {
public ServiceCallStandardScheme getScheme() {
return new ServiceCallStandardScheme();
}
}
private static class ServiceCallStandardScheme extends StandardScheme<ServiceCall> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ServiceCall 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: // PLUGIN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.plugin = iprot.readString();
struct.setPluginIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // FUNC
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.func = iprot.readString();
struct.setFuncIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // ARGUMENTS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list42 = iprot.readListBegin();
struct.arguments = new ArrayList<String>(_list42.size);
for (int _i43 = 0; _i43 < _list42.size; ++_i43)
{
String _elem44; // required
_elem44 = iprot.readString();
struct.arguments.add(_elem44);
}
iprot.readListEnd();
}
struct.setArgumentsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // PARSE_ARGUMENTS
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.parseArguments = iprot.readBool();
struct.setParseArgumentsIsSet(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, ServiceCall struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.plugin != null) {
oprot.writeFieldBegin(PLUGIN_FIELD_DESC);
oprot.writeString(struct.plugin);
oprot.writeFieldEnd();
}
if (struct.func != null) {
oprot.writeFieldBegin(FUNC_FIELD_DESC);
oprot.writeString(struct.func);
oprot.writeFieldEnd();
}
if (struct.arguments != null) {
if (struct.isSetArguments()) {
oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.arguments.size()));
for (String _iter45 : struct.arguments)
{
oprot.writeString(_iter45);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.isSetParseArguments()) {
oprot.writeFieldBegin(PARSE_ARGUMENTS_FIELD_DESC);
oprot.writeBool(struct.parseArguments);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ServiceCallTupleSchemeFactory implements SchemeFactory {
public ServiceCallTupleScheme getScheme() {
return new ServiceCallTupleScheme();
}
}
private static class ServiceCallTupleScheme extends TupleScheme<ServiceCall> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ServiceCall struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetPlugin()) {
optionals.set(0);
}
if (struct.isSetFunc()) {
optionals.set(1);
}
if (struct.isSetArguments()) {
optionals.set(2);
}
if (struct.isSetParseArguments()) {
optionals.set(3);
}
oprot.writeBitSet(optionals, 4);
if (struct.isSetPlugin()) {
oprot.writeString(struct.plugin);
}
if (struct.isSetFunc()) {
oprot.writeString(struct.func);
}
if (struct.isSetArguments()) {
{
oprot.writeI32(struct.arguments.size());
for (String _iter46 : struct.arguments)
{
oprot.writeString(_iter46);
}
}
}
if (struct.isSetParseArguments()) {
oprot.writeBool(struct.parseArguments);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ServiceCall struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(4);
if (incoming.get(0)) {
struct.plugin = iprot.readString();
struct.setPluginIsSet(true);
}
if (incoming.get(1)) {
struct.func = iprot.readString();
struct.setFuncIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TList _list47 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.arguments = new ArrayList<String>(_list47.size);
for (int _i48 = 0; _i48 < _list47.size; ++_i48)
{
String _elem49; // required
_elem49 = iprot.readString();
struct.arguments.add(_elem49);
}
}
struct.setArgumentsIsSet(true);
}
if (incoming.get(3)) {
struct.parseArguments = iprot.readBool();
struct.setParseArgumentsIsSet(true);
}
}
}
}