/** * Autogenerated by Thrift Compiler (0.15.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.openslx.bwlp.thrift.iface; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2021-12-17") public class PresetNetRule 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("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 org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new PresetNetRuleStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new PresetNetRuleTupleSchemeFactory(); public int ruleId; // required public @org.apache.thrift.annotation.Nullable java.lang.String displayName; // required public @org.apache.thrift.annotation.Nullable java.util.List 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 java.util.Map byName = new java.util.HashMap(); static { for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ @org.apache.thrift.annotation.Nullable 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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ @org.apache.thrift.annotation.Nullable public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; private final java.lang.String _fieldName; _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments private static final int __RULEID_ISSET_ID = 0; private byte __isset_bitfield = 0; public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.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 = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PresetNetRule.class, metaDataMap); } public PresetNetRule() { } public PresetNetRule( int ruleId, java.lang.String displayName, java.util.List netRules) { this(); this.ruleId = ruleId; setRuleIdIsSet(true); this.displayName = displayName; this.netRules = netRules; } /** * Performs a deep copy on other. */ public PresetNetRule(PresetNetRule other) { __isset_bitfield = other.__isset_bitfield; this.ruleId = other.ruleId; if (other.isSetDisplayName()) { this.displayName = other.displayName; } if (other.isSetNetRules()) { java.util.List __this__netRules = new java.util.ArrayList(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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __RULEID_ISSET_ID); } public void setRuleIdIsSet(boolean value) { __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __RULEID_ISSET_ID, value); } @org.apache.thrift.annotation.Nullable public java.lang.String getDisplayName() { return this.displayName; } public PresetNetRule setDisplayName(@org.apache.thrift.annotation.Nullable java.lang.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(); } @org.apache.thrift.annotation.Nullable public java.util.Iterator getNetRulesIterator() { return (this.netRules == null) ? null : this.netRules.iterator(); } public void addToNetRules(NetRule elem) { if (this.netRules == null) { this.netRules = new java.util.ArrayList(); } this.netRules.add(elem); } @org.apache.thrift.annotation.Nullable public java.util.List getNetRules() { return this.netRules; } public PresetNetRule setNetRules(@org.apache.thrift.annotation.Nullable java.util.List 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, @org.apache.thrift.annotation.Nullable java.lang.Object value) { switch (field) { case RULE_ID: if (value == null) { unsetRuleId(); } else { setRuleId((java.lang.Integer)value); } break; case DISPLAY_NAME: if (value == null) { unsetDisplayName(); } else { setDisplayName((java.lang.String)value); } break; case NET_RULES: if (value == null) { unsetNetRules(); } else { setNetRules((java.util.List)value); } break; } } @org.apache.thrift.annotation.Nullable public java.lang.Object getFieldValue(_Fields field) { switch (field) { case RULE_ID: return getRuleId(); case DISPLAY_NAME: return getDisplayName(); case NET_RULES: return getNetRules(); } throw new java.lang.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 java.lang.IllegalArgumentException(); } switch (field) { case RULE_ID: return isSetRuleId(); case DISPLAY_NAME: return isSetDisplayName(); case NET_RULES: return isSetNetRules(); } throw new java.lang.IllegalStateException(); } @Override public boolean equals(java.lang.Object that) { if (that instanceof PresetNetRule) return this.equals((PresetNetRule)that); return false; } public boolean equals(PresetNetRule that) { if (that == null) return false; if (this == that) return true; 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() { int hashCode = 1; hashCode = hashCode * 8191 + ruleId; hashCode = hashCode * 8191 + ((isSetDisplayName()) ? 131071 : 524287); if (isSetDisplayName()) hashCode = hashCode * 8191 + displayName.hashCode(); hashCode = hashCode * 8191 + ((isSetNetRules()) ? 131071 : 524287); if (isSetNetRules()) hashCode = hashCode * 8191 + netRules.hashCode(); return hashCode; } @Override public int compareTo(PresetNetRule other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.compare(isSetRuleId(), 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 = java.lang.Boolean.compare(isSetDisplayName(), 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 = java.lang.Boolean.compare(isSetNetRules(), 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; } @org.apache.thrift.annotation.Nullable public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } 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 java.lang.String toString() { java.lang.StringBuilder sb = new java.lang.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, java.lang.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 org.apache.thrift.scheme.SchemeFactory { public PresetNetRuleStandardScheme getScheme() { return new PresetNetRuleStandardScheme(); } } private static class PresetNetRuleStandardScheme extends org.apache.thrift.scheme.StandardScheme { 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 java.util.ArrayList(_list98.size); @org.apache.thrift.annotation.Nullable 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 org.apache.thrift.scheme.SchemeFactory { public PresetNetRuleTupleScheme getScheme() { return new PresetNetRuleTupleScheme(); } } private static class PresetNetRuleTupleScheme extends org.apache.thrift.scheme.TupleScheme { @Override public void write(org.apache.thrift.protocol.TProtocol prot, PresetNetRule struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.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 { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.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 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT); struct.netRules = new java.util.ArrayList(_list103.size); @org.apache.thrift.annotation.Nullable NetRule _elem104; for (int _i105 = 0; _i105 < _list103.size; ++_i105) { _elem104 = new NetRule(); _elem104.read(iprot); struct.netRules.add(_elem104); } } struct.setNetRulesIsSet(true); } } } private static S scheme(org.apache.thrift.protocol.TProtocol proto) { return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); } }