/**
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.openslx.bwlp.thrift.iface;
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.TException;
import org.apache.thrift.async.AsyncMethodCallback;
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"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-11")
public class PresetRunScript implements org.apache.thrift.TBase<PresetRunScript, PresetRunScript._Fields>, java.io.Serializable, Cloneable, Comparable<PresetRunScript> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PresetRunScript");
private static final org.apache.thrift.protocol.TField SCRIPT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("scriptId", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField DISPLAYNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("displayname", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField OS_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("osIds", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new PresetRunScriptStandardSchemeFactory());
schemes.put(TupleScheme.class, new PresetRunScriptTupleSchemeFactory());
}
public int scriptId; // required
public String displayname; // required
public List<Integer> osIds; // 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 {
SCRIPT_ID((short)1, "scriptId"),
DISPLAYNAME((short)2, "displayname"),
OS_IDS((short)3, "osIds");
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: // SCRIPT_ID
return SCRIPT_ID;
case 2: // DISPLAYNAME
return DISPLAYNAME;
case 3: // OS_IDS
return OS_IDS;
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 __SCRIPTID_ISSET_ID = 0;
private byte __isset_bitfield = 0;
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.SCRIPT_ID, new org.apache.thrift.meta_data.FieldMetaData("scriptId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.DISPLAYNAME, new org.apache.thrift.meta_data.FieldMetaData("displayname", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.OS_IDS, new org.apache.thrift.meta_data.FieldMetaData("osIds", org.apache.thrift.TFieldRequirementType.DEFAULT,
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.I32))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PresetRunScript.class, metaDataMap);
}
public PresetRunScript() {
}
public PresetRunScript(
int scriptId,
String displayname,
List<Integer> osIds)
{
this();
this.scriptId = scriptId;
setScriptIdIsSet(true);
this.displayname = displayname;
this.osIds = osIds;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public PresetRunScript(PresetRunScript other) {
__isset_bitfield = other.__isset_bitfield;
this.scriptId = other.scriptId;
if (other.isSetDisplayname()) {
this.displayname = other.displayname;
}
if (other.isSetOsIds()) {
List<Integer> __this__osIds = new ArrayList<Integer>(other.osIds);
this.osIds = __this__osIds;
}
}
public PresetRunScript deepCopy() {
return new PresetRunScript(this);
}
@Override
public void clear() {
setScriptIdIsSet(false);
this.scriptId = 0;
this.displayname = null;
this.osIds = null;
}
public int getScriptId() {
return this.scriptId;
}
public PresetRunScript setScriptId(int scriptId) {
this.scriptId = scriptId;
setScriptIdIsSet(true);
return this;
}
public void unsetScriptId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SCRIPTID_ISSET_ID);
}
/** Returns true if field scriptId is set (has been assigned a value) and false otherwise */
public boolean isSetScriptId() {
return EncodingUtils.testBit(__isset_bitfield, __SCRIPTID_ISSET_ID);
}
public void setScriptIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SCRIPTID_ISSET_ID, value);
}
public String getDisplayname() {
return this.displayname;
}
public PresetRunScript setDisplayname(String displayname) {
this.displayname = displayname;
return this;
}
public void unsetDisplayname() {
this.displayname = null;
}
/** Returns true if field displayname is set (has been assigned a value) and false otherwise */
public boolean isSetDisplayname() {
return this.displayname != null;
}
public void setDisplaynameIsSet(boolean value) {
if (!value) {
this.displayname = null;
}
}
public int getOsIdsSize() {
return (this.osIds == null) ? 0 : this.osIds.size();
}
public java.util.Iterator<Integer> getOsIdsIterator() {
return (this.osIds == null) ? null : this.osIds.iterator();
}
public void addToOsIds(int elem) {
if (this.osIds == null) {
this.osIds = new ArrayList<Integer>();
}
this.osIds.add(elem);
}
public List<Integer> getOsIds() {
return this.osIds;
}
public PresetRunScript setOsIds(List<Integer> osIds) {
this.osIds = osIds;
return this;
}
public void unsetOsIds() {
this.osIds = null;
}
/** Returns true if field osIds is set (has been assigned a value) and false otherwise */
public boolean isSetOsIds() {
return this.osIds != null;
}
public void setOsIdsIsSet(boolean value) {
if (!value) {
this.osIds = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SCRIPT_ID:
if (value == null) {
unsetScriptId();
} else {
setScriptId((Integer)value);
}
break;
case DISPLAYNAME:
if (value == null) {
unsetDisplayname();
} else {
setDisplayname((String)value);
}
break;
case OS_IDS:
if (value == null) {
unsetOsIds();
} else {
setOsIds((List<Integer>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SCRIPT_ID:
return getScriptId();
case DISPLAYNAME:
return getDisplayname();
case OS_IDS:
return getOsIds();
}
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 SCRIPT_ID:
return isSetScriptId();
case DISPLAYNAME:
return isSetDisplayname();
case OS_IDS:
return isSetOsIds();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof PresetRunScript)
return this.equals((PresetRunScript)that);
return false;
}
public boolean equals(PresetRunScript that) {
if (that == null)
return false;
boolean this_present_scriptId = true;
boolean that_present_scriptId = true;
if (this_present_scriptId || that_present_scriptId) {
if (!(this_present_scriptId && that_present_scriptId))
return false;
if (this.scriptId != that.scriptId)
return false;
}
boolean this_present_displayname = true && this.isSetDisplayname();
boolean that_present_displayname = true && that.isSetDisplayname();
if (this_present_displayname || that_present_displayname) {
if (!(this_present_displayname && that_present_displayname))
return false;
if (!this.displayname.equals(that.displayname))
return false;
}
boolean this_present_osIds = true && this.isSetOsIds();
boolean that_present_osIds = true && that.isSetOsIds();
if (this_present_osIds || that_present_osIds) {
if (!(this_present_osIds && that_present_osIds))
return false;
if (!this.osIds.equals(that.osIds))
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_scriptId = true;
list.add(present_scriptId);
if (present_scriptId)
list.add(scriptId);
boolean present_displayname = true && (isSetDisplayname());
list.add(present_displayname);
if (present_displayname)
list.add(displayname);
boolean present_osIds = true && (isSetOsIds());
list.add(present_osIds);
if (present_osIds)
list.add(osIds);
return list.hashCode();
}
@Override
public int compareTo(PresetRunScript other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetScriptId()).compareTo(other.isSetScriptId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetScriptId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scriptId, other.scriptId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDisplayname()).compareTo(other.isSetDisplayname());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDisplayname()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.displayname, other.displayname);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetOsIds()).compareTo(other.isSetOsIds());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetOsIds()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.osIds, other.osIds);
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("PresetRunScript(");
boolean first = true;
sb.append("scriptId:");
sb.append(this.scriptId);
first = false;
if (!first) sb.append(", ");
sb.append("displayname:");
if (this.displayname == null) {
sb.append("null");
} else {
sb.append(this.displayname);
}
first = false;
if (!first) sb.append(", ");
sb.append("osIds:");
if (this.osIds == null) {
sb.append("null");
} else {
sb.append(this.osIds);
}
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 {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
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 PresetRunScriptStandardSchemeFactory implements SchemeFactory {
public PresetRunScriptStandardScheme getScheme() {
return new PresetRunScriptStandardScheme();
}
}
private static class PresetRunScriptStandardScheme extends StandardScheme<PresetRunScript> {
public void read(org.apache.thrift.protocol.TProtocol iprot, PresetRunScript 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: // SCRIPT_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.scriptId = iprot.readI32();
struct.setScriptIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // DISPLAYNAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.displayname = iprot.readString();
struct.setDisplaynameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // OS_IDS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list90 = iprot.readListBegin();
struct.osIds = new ArrayList<Integer>(_list90.size);
int _elem91;
for (int _i92 = 0; _i92 < _list90.size; ++_i92)
{
_elem91 = iprot.readI32();
struct.osIds.add(_elem91);
}
iprot.readListEnd();
}
struct.setOsIdsIsSet(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, PresetRunScript struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(SCRIPT_ID_FIELD_DESC);
oprot.writeI32(struct.scriptId);
oprot.writeFieldEnd();
if (struct.displayname != null) {
oprot.writeFieldBegin(DISPLAYNAME_FIELD_DESC);
oprot.writeString(struct.displayname);
oprot.writeFieldEnd();
}
if (struct.osIds != null) {
oprot.writeFieldBegin(OS_IDS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.osIds.size()));
for (int _iter93 : struct.osIds)
{
oprot.writeI32(_iter93);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class PresetRunScriptTupleSchemeFactory implements SchemeFactory {
public PresetRunScriptTupleScheme getScheme() {
return new PresetRunScriptTupleScheme();
}
}
private static class PresetRunScriptTupleScheme extends TupleScheme<PresetRunScript> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, PresetRunScript struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetScriptId()) {
optionals.set(0);
}
if (struct.isSetDisplayname()) {
optionals.set(1);
}
if (struct.isSetOsIds()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetScriptId()) {
oprot.writeI32(struct.scriptId);
}
if (struct.isSetDisplayname()) {
oprot.writeString(struct.displayname);
}
if (struct.isSetOsIds()) {
{
oprot.writeI32(struct.osIds.size());
for (int _iter94 : struct.osIds)
{
oprot.writeI32(_iter94);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, PresetRunScript struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.scriptId = iprot.readI32();
struct.setScriptIdIsSet(true);
}
if (incoming.get(1)) {
struct.displayname = iprot.readString();
struct.setDisplaynameIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TList _list95 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
struct.osIds = new ArrayList<Integer>(_list95.size);
int _elem96;
for (int _i97 = 0; _i97 < _list95.size; ++_i97)
{
_elem96 = iprot.readI32();
struct.osIds.add(_elem96);
}
}
struct.setOsIdsIsSet(true);
}
}
}
}