/**
* 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 = "2019-02-25")
public class PresetNetRule implements org.apache.thrift.TBase<PresetNetRule, PresetNetRule._Fields>, java.io.Serializable, Cloneable, Comparable<PresetNetRule> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PresetNetRule");
private static final org.apache.thrift.protocol.TField RULE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("ruleId", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField DISPLAY_NAME_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 NET_RULES_FIELD_DESC = new org.apache.thrift.protocol.TField("netRules", 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 PresetNetRuleStandardSchemeFactory());
schemes.put(TupleScheme.class, new PresetNetRuleTupleSchemeFactory());
}
public int ruleId; // required
public String displayName; // required
public List<NetRule> netRules; // 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 {
RULE_ID((short)1, "ruleId"),
DISPLAY_NAME((short)2, "displayName"),
NET_RULES((short)3, "netRules");
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: // RULE_ID
return RULE_ID;
case 2: // DISPLAY_NAME
return DISPLAY_NAME;
case 3: // NET_RULES
return NET_RULES;
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 __RULEID_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.RULE_ID, new org.apache.thrift.meta_data.FieldMetaData("ruleId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.DISPLAY_NAME, 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.NET_RULES, new org.apache.thrift.meta_data.FieldMetaData("netRules", org.apache.thrift.TFieldRequirementType.DEFAULT,
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, NetRule.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PresetNetRule.class, metaDataMap);
}
public PresetNetRule() {
}
public PresetNetRule(
int ruleId,
String displayName,
List<NetRule> netRules)
{
this();
this.ruleId = ruleId;
setRuleIdIsSet(true);
this.displayName = displayName;
this.netRules = netRules;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public PresetNetRule(PresetNetRule other) {
__isset_bitfield = other.__isset_bitfield;
this.ruleId = other.ruleId;
if (other.isSetDisplayName()) {
this.displayName = other.displayName;
}
if (other.isSetNetRules()) {
List<NetRule> __this__netRules = new ArrayList<NetRule>(other.netRules.size());
for (NetRule other_element : other.netRules) {
__this__netRules.add(new NetRule(other_element));
}
this.netRules = __this__netRules;
}
}
public PresetNetRule deepCopy() {
return new PresetNetRule(this);
}
@Override
public void clear() {
setRuleIdIsSet(false);
this.ruleId = 0;
this.displayName = null;
this.netRules = null;
}
public int getRuleId() {
return this.ruleId;
}
public PresetNetRule setRuleId(int ruleId) {
this.ruleId = ruleId;
setRuleIdIsSet(true);
return this;
}
public void unsetRuleId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RULEID_ISSET_ID);
}
/** Returns true if field ruleId is set (has been assigned a value) and false otherwise */
public boolean isSetRuleId() {
return EncodingUtils.testBit(__isset_bitfield, __RULEID_ISSET_ID);
}
public void setRuleIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RULEID_ISSET_ID, value);
}
public String getDisplayName() {
return this.displayName;
}
public PresetNetRule 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 getNetRulesSize() {
return (this.netRules == null) ? 0 : this.netRules.size();
}
public java.util.Iterator<NetRule> getNetRulesIterator() {
return (this.netRules == null) ? null : this.netRules.iterator();
}
public void addToNetRules(NetRule elem) {
if (this.netRules == null) {
this.netRules = new ArrayList<NetRule>();
}
this.netRules.add(elem);
}
public List<NetRule> getNetRules() {
return this.netRules;
}
public PresetNetRule setNetRules(List<NetRule> netRules) {
this.netRules = netRules;
return this;
}
public void unsetNetRules() {
this.netRules = null;
}
/** Returns true if field netRules is set (has been assigned a value) and false otherwise */
public boolean isSetNetRules() {
return this.netRules != null;
}
public void setNetRulesIsSet(boolean value) {
if (!value) {
this.netRules = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case RULE_ID:
if (value == null) {
unsetRuleId();
} else {
setRuleId((Integer)value);
}
break;
case DISPLAY_NAME:
if (value == null) {
unsetDisplayName();
} else {
setDisplayName((String)value);
}
break;
case NET_RULES:
if (value == null) {
unsetNetRules();
} else {
setNetRules((List<NetRule>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case RULE_ID:
return getRuleId();
case DISPLAY_NAME:
return getDisplayName();
case NET_RULES:
return getNetRules();
}
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 RULE_ID:
return isSetRuleId();
case DISPLAY_NAME:
return isSetDisplayName();
case NET_RULES:
return isSetNetRules();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof PresetNetRule)
return this.equals((PresetNetRule)that);
return false;
}
public boolean equals(PresetNetRule that) {
if (that == null)
return false;
boolean this_present_ruleId = true;
boolean that_present_ruleId = true;
if (this_present_ruleId || that_present_ruleId) {
if (!(this_present_ruleId && that_present_ruleId))
return false;
if (this.ruleId != that.ruleId)
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_netRules = true && this.isSetNetRules();
boolean that_present_netRules = true && that.isSetNetRules();
if (this_present_netRules || that_present_netRules) {
if (!(this_present_netRules && that_present_netRules))
return false;
if (!this.netRules.equals(that.netRules))
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_ruleId = true;
list.add(present_ruleId);
if (present_ruleId)
list.add(ruleId);
boolean present_displayName = true && (isSetDisplayName());
list.add(present_displayName);
if (present_displayName)
list.add(displayName);
boolean present_netRules = true && (isSetNetRules());
list.add(present_netRules);
if (present_netRules)
list.add(netRules);
return list.hashCode();
}
@Override
public int compareTo(PresetNetRule other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetRuleId()).compareTo(other.isSetRuleId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRuleId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ruleId, other.ruleId);
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(isSetNetRules()).compareTo(other.isSetNetRules());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNetRules()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.netRules, other.netRules);
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("PresetNetRule(");
boolean first = true;
sb.append("ruleId:");
sb.append(this.ruleId);
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("netRules:");
if (this.netRules == null) {
sb.append("null");
} else {
sb.append(this.netRules);
}
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 PresetNetRuleStandardSchemeFactory implements SchemeFactory {
public PresetNetRuleStandardScheme getScheme() {
return new PresetNetRuleStandardScheme();
}
}
private static class PresetNetRuleStandardScheme extends StandardScheme<PresetNetRule> {
public void read(org.apache.thrift.protocol.TProtocol iprot, PresetNetRule 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: // RULE_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.ruleId = iprot.readI32();
struct.setRuleIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // DISPLAY_NAME
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: // NET_RULES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list98 = iprot.readListBegin();
struct.netRules = new ArrayList<NetRule>(_list98.size);
NetRule _elem99;
for (int _i100 = 0; _i100 < _list98.size; ++_i100)
{
_elem99 = new NetRule();
_elem99.read(iprot);
struct.netRules.add(_elem99);
}
iprot.readListEnd();
}
struct.setNetRulesIsSet(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, PresetNetRule struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(RULE_ID_FIELD_DESC);
oprot.writeI32(struct.ruleId);
oprot.writeFieldEnd();
if (struct.displayName != null) {
oprot.writeFieldBegin(DISPLAY_NAME_FIELD_DESC);
oprot.writeString(struct.displayName);
oprot.writeFieldEnd();
}
if (struct.netRules != null) {
oprot.writeFieldBegin(NET_RULES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.netRules.size()));
for (NetRule _iter101 : struct.netRules)
{
_iter101.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class PresetNetRuleTupleSchemeFactory implements SchemeFactory {
public PresetNetRuleTupleScheme getScheme() {
return new PresetNetRuleTupleScheme();
}
}
private static class PresetNetRuleTupleScheme extends TupleScheme<PresetNetRule> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, PresetNetRule struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetRuleId()) {
optionals.set(0);
}
if (struct.isSetDisplayName()) {
optionals.set(1);
}
if (struct.isSetNetRules()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetRuleId()) {
oprot.writeI32(struct.ruleId);
}
if (struct.isSetDisplayName()) {
oprot.writeString(struct.displayName);
}
if (struct.isSetNetRules()) {
{
oprot.writeI32(struct.netRules.size());
for (NetRule _iter102 : struct.netRules)
{
_iter102.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, PresetNetRule struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.ruleId = iprot.readI32();
struct.setRuleIdIsSet(true);
}
if (incoming.get(1)) {
struct.displayName = iprot.readString();
struct.setDisplayNameIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.netRules = new ArrayList<NetRule>(_list103.size);
NetRule _elem104;
for (int _i105 = 0; _i105 < _list103.size; ++_i105)
{
_elem104 = new NetRule();
_elem104.read(iprot);
struct.netRules.add(_elem104);
}
}
struct.setNetRulesIsSet(true);
}
}
}
}