2 * Autogenerated by Thrift Compiler (0.9.3)
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
7 package org.opendaylight.netvirt.bgpmanager.thrift.gen;
8 import org.apache.thrift.scheme.IScheme;
9 import org.apache.thrift.scheme.SchemeFactory;
10 import org.apache.thrift.scheme.StandardScheme;
12 import org.apache.thrift.scheme.TupleScheme;
13 import org.apache.thrift.protocol.TTupleProtocol;
14 import org.apache.thrift.protocol.TProtocolException;
15 import org.apache.thrift.EncodingUtils;
16 import org.apache.thrift.TException;
17 import org.apache.thrift.async.AsyncMethodCallback;
18 import org.apache.thrift.server.AbstractNonblockingServer.*;
19 import java.util.List;
20 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.EnumMap;
25 import java.util.HashSet;
26 import java.util.EnumSet;
27 import java.util.Collections;
28 import java.util.BitSet;
29 import java.nio.ByteBuffer;
30 import java.util.Arrays;
31 import javax.annotation.Generated;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
36 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-13")
37 public class Routes implements org.apache.thrift.TBase<Routes, Routes._Fields>, java.io.Serializable, Cloneable, Comparable<Routes> {
38 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Routes");
40 private static final org.apache.thrift.protocol.TField ERRCODE_FIELD_DESC = new org.apache.thrift.protocol.TField("errcode", org.apache.thrift.protocol.TType.I32, (short)1);
41 private static final org.apache.thrift.protocol.TField UPDATES_FIELD_DESC = new org.apache.thrift.protocol.TField("updates", org.apache.thrift.protocol.TType.LIST, (short)2);
42 private static final org.apache.thrift.protocol.TField MORE_FIELD_DESC = new org.apache.thrift.protocol.TField("more", org.apache.thrift.protocol.TType.I32, (short)4);
44 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
46 schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
47 schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
50 public int errcode; // required
51 public List<Update> updates; // optional
52 public int more; // optional
54 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
55 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
56 ERRCODE((short)1, "errcode"),
57 UPDATES((short)2, "updates"),
58 MORE((short)4, "more");
60 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
63 for (_Fields field : EnumSet.allOf(_Fields.class)) {
64 byName.put(field.getFieldName(), field);
69 * Find the _Fields constant that matches fieldId, or null if its not found.
71 public static _Fields findByThriftId(int fieldId) {
85 * Find the _Fields constant that matches fieldId, throwing an exception
88 public static _Fields findByThriftIdOrThrow(int fieldId) {
89 _Fields fields = findByThriftId(fieldId);
90 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
95 * Find the _Fields constant that matches name, or null if its not found.
97 public static _Fields findByName(String name) {
98 return byName.get(name);
101 private final short _thriftId;
102 private final String _fieldName;
104 _Fields(short thriftId, String fieldName) {
105 _thriftId = thriftId;
106 _fieldName = fieldName;
109 public short getThriftFieldId() {
113 public String getFieldName() {
118 // isset id assignments
119 private static final int __ERRCODE_ISSET_ID = 0;
120 private static final int __MORE_ISSET_ID = 1;
121 private byte __isset_bitfield = 0;
122 private static final _Fields optionals[] = {_Fields.UPDATES,_Fields.MORE};
123 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
125 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
126 tmpMap.put(_Fields.ERRCODE, new org.apache.thrift.meta_data.FieldMetaData("errcode", org.apache.thrift.TFieldRequirementType.DEFAULT,
127 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
128 tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.OPTIONAL,
129 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
130 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Update.class))));
131 tmpMap.put(_Fields.MORE, new org.apache.thrift.meta_data.FieldMetaData("more", org.apache.thrift.TFieldRequirementType.OPTIONAL,
132 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
133 metaDataMap = Collections.unmodifiableMap(tmpMap);
134 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Routes.class, metaDataMap);
144 this.errcode = errcode;
145 setErrcodeIsSet(true);
149 * Performs a deep copy on <i>other</i>.
151 public Routes(Routes other) {
152 __isset_bitfield = other.__isset_bitfield;
153 this.errcode = other.errcode;
154 if (other.isSetUpdates()) {
155 List<Update> __this__updates = new ArrayList<Update>(other.updates.size());
156 for (Update other_element : other.updates) {
157 __this__updates.add(new Update(other_element));
159 this.updates = __this__updates;
161 this.more = other.more;
164 public Routes deepCopy() {
165 return new Routes(this);
169 public void clear() {
170 setErrcodeIsSet(false);
177 public int getErrcode() {
181 public Routes setErrcode(int errcode) {
182 this.errcode = errcode;
183 setErrcodeIsSet(true);
187 public void unsetErrcode() {
188 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRCODE_ISSET_ID);
191 /** Returns true if field errcode is set (has been assigned a value) and false otherwise */
192 public boolean isSetErrcode() {
193 return EncodingUtils.testBit(__isset_bitfield, __ERRCODE_ISSET_ID);
196 public void setErrcodeIsSet(boolean value) {
197 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRCODE_ISSET_ID, value);
200 public int getUpdatesSize() {
201 return (this.updates == null) ? 0 : this.updates.size();
204 public java.util.Iterator<Update> getUpdatesIterator() {
205 return (this.updates == null) ? null : this.updates.iterator();
208 public void addToUpdates(Update elem) {
209 if (this.updates == null) {
210 this.updates = new ArrayList<Update>();
212 this.updates.add(elem);
215 public List<Update> getUpdates() {
219 public Routes setUpdates(List<Update> updates) {
220 this.updates = updates;
224 public void unsetUpdates() {
228 /** Returns true if field updates is set (has been assigned a value) and false otherwise */
229 public boolean isSetUpdates() {
230 return this.updates != null;
233 public void setUpdatesIsSet(boolean value) {
239 public int getMore() {
243 public Routes setMore(int more) {
249 public void unsetMore() {
250 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
253 /** Returns true if field more is set (has been assigned a value) and false otherwise */
254 public boolean isSetMore() {
255 return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
258 public void setMoreIsSet(boolean value) {
259 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
262 public void setFieldValue(_Fields field, Object value) {
268 setErrcode((Integer)value);
276 setUpdates((List<Update>)value);
284 setMore((Integer)value);
291 public Object getFieldValue(_Fields field) {
294 return Integer.valueOf(getErrcode());
300 return Integer.valueOf(getMore());
303 throw new IllegalStateException();
306 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
307 public boolean isSet(_Fields field) {
309 throw new IllegalArgumentException();
314 return isSetErrcode();
316 return isSetUpdates();
320 throw new IllegalStateException();
324 public boolean equals(Object that) {
327 if (that instanceof Routes)
328 return this.equals((Routes)that);
332 public boolean equals(Routes that) {
336 boolean this_present_errcode = true;
337 boolean that_present_errcode = true;
338 if (this_present_errcode || that_present_errcode) {
339 if (!(this_present_errcode && that_present_errcode))
341 if (this.errcode != that.errcode)
345 boolean this_present_updates = true && this.isSetUpdates();
346 boolean that_present_updates = true && that.isSetUpdates();
347 if (this_present_updates || that_present_updates) {
348 if (!(this_present_updates && that_present_updates))
350 if (!this.updates.equals(that.updates))
354 boolean this_present_more = true && this.isSetMore();
355 boolean that_present_more = true && that.isSetMore();
356 if (this_present_more || that_present_more) {
357 if (!(this_present_more && that_present_more))
359 if (this.more != that.more)
367 public int hashCode() {
368 List<Object> list = new ArrayList<Object>();
370 boolean present_errcode = true;
371 list.add(present_errcode);
374 boolean present_updates = true && (isSetUpdates());
375 list.add(present_updates);
378 boolean present_more = true && (isSetMore());
379 list.add(present_more);
382 return list.hashCode();
386 public int compareTo(Routes other) {
387 if (!getClass().equals(other.getClass())) {
388 return getClass().getName().compareTo(other.getClass().getName());
391 int lastComparison = 0;
393 lastComparison = Boolean.valueOf(isSetErrcode()).compareTo(other.isSetErrcode());
394 if (lastComparison != 0) {
395 return lastComparison;
397 if (isSetErrcode()) {
398 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errcode, other.errcode);
399 if (lastComparison != 0) {
400 return lastComparison;
403 lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
404 if (lastComparison != 0) {
405 return lastComparison;
407 if (isSetUpdates()) {
408 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
409 if (lastComparison != 0) {
410 return lastComparison;
413 lastComparison = Boolean.valueOf(isSetMore()).compareTo(other.isSetMore());
414 if (lastComparison != 0) {
415 return lastComparison;
418 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, other.more);
419 if (lastComparison != 0) {
420 return lastComparison;
426 public _Fields fieldForId(int fieldId) {
427 return _Fields.findByThriftId(fieldId);
430 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
431 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
434 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
435 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
439 public String toString() {
440 StringBuilder sb = new StringBuilder("Routes(");
441 boolean first = true;
443 sb.append("errcode:");
444 sb.append(this.errcode);
446 if (isSetUpdates()) {
447 if (!first) sb.append(", ");
448 sb.append("updates:");
449 if (this.updates == null) {
452 sb.append(this.updates);
457 if (!first) sb.append(", ");
459 sb.append(this.more);
463 return sb.toString();
466 public void validate() throws org.apache.thrift.TException {
467 // check for required fields
468 // check for sub-struct validity
471 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
473 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
474 } catch (org.apache.thrift.TException te) {
475 throw new java.io.IOException(te);
479 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
481 // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
482 __isset_bitfield = 0;
483 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
484 } catch (org.apache.thrift.TException te) {
485 throw new java.io.IOException(te);
489 private static class RoutesStandardSchemeFactory implements SchemeFactory {
490 public RoutesStandardScheme getScheme() {
491 return new RoutesStandardScheme();
495 private static class RoutesStandardScheme extends StandardScheme<Routes> {
497 public void read(org.apache.thrift.protocol.TProtocol iprot, Routes struct) throws org.apache.thrift.TException {
498 org.apache.thrift.protocol.TField schemeField;
499 iprot.readStructBegin();
502 schemeField = iprot.readFieldBegin();
503 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
506 switch (schemeField.id) {
508 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
509 struct.errcode = iprot.readI32();
510 struct.setErrcodeIsSet(true);
512 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
516 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
518 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
519 struct.updates = new ArrayList<Update>(_list0.size);
520 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
523 _elem2 = new Update();
525 struct.updates.add(_elem2);
529 struct.setUpdatesIsSet(true);
531 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
535 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
536 struct.more = iprot.readI32();
537 struct.setMoreIsSet(true);
539 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
543 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
545 iprot.readFieldEnd();
547 iprot.readStructEnd();
549 // check for required fields of primitive type, which can't be checked in the validate method
553 public void write(org.apache.thrift.protocol.TProtocol oprot, Routes struct) throws org.apache.thrift.TException {
556 oprot.writeStructBegin(STRUCT_DESC);
557 oprot.writeFieldBegin(ERRCODE_FIELD_DESC);
558 oprot.writeI32(struct.errcode);
559 oprot.writeFieldEnd();
560 if (struct.updates != null) {
561 if (struct.isSetUpdates()) {
562 oprot.writeFieldBegin(UPDATES_FIELD_DESC);
564 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
565 for (Update _iter3 : struct.updates)
569 oprot.writeListEnd();
571 oprot.writeFieldEnd();
574 if (struct.isSetMore()) {
575 oprot.writeFieldBegin(MORE_FIELD_DESC);
576 oprot.writeI32(struct.more);
577 oprot.writeFieldEnd();
579 oprot.writeFieldStop();
580 oprot.writeStructEnd();
585 private static class RoutesTupleSchemeFactory implements SchemeFactory {
586 public RoutesTupleScheme getScheme() {
587 return new RoutesTupleScheme();
591 private static class RoutesTupleScheme extends TupleScheme<Routes> {
594 public void write(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
595 TTupleProtocol oprot = (TTupleProtocol) prot;
596 BitSet optionals = new BitSet();
597 if (struct.isSetErrcode()) {
600 if (struct.isSetUpdates()) {
603 if (struct.isSetMore()) {
606 oprot.writeBitSet(optionals, 3);
607 if (struct.isSetErrcode()) {
608 oprot.writeI32(struct.errcode);
610 if (struct.isSetUpdates()) {
612 oprot.writeI32(struct.updates.size());
613 for (Update _iter4 : struct.updates)
619 if (struct.isSetMore()) {
620 oprot.writeI32(struct.more);
625 public void read(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
626 TTupleProtocol iprot = (TTupleProtocol) prot;
627 BitSet incoming = iprot.readBitSet(3);
628 if (incoming.get(0)) {
629 struct.errcode = iprot.readI32();
630 struct.setErrcodeIsSet(true);
632 if (incoming.get(1)) {
634 org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
635 struct.updates = new ArrayList<Update>(_list5.size);
636 for (int _i6 = 0; _i6 < _list5.size; ++_i6)
639 _elem7 = new Update();
641 struct.updates.add(_elem7);
644 struct.setUpdatesIsSet(true);
646 if (incoming.get(2)) {
647 struct.more = iprot.readI32();
648 struct.setMoreIsSet(true);