2 * Autogenerated by Thrift Compiler (0.9.1)
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
8 package org.opendaylight.bgpmanager.thrift.gen;
10 import org.apache.thrift.scheme.IScheme;
11 import org.apache.thrift.scheme.SchemeFactory;
12 import org.apache.thrift.scheme.StandardScheme;
14 import org.apache.thrift.scheme.TupleScheme;
15 import org.apache.thrift.protocol.TTupleProtocol;
16 import org.apache.thrift.protocol.TProtocolException;
17 import org.apache.thrift.EncodingUtils;
18 import org.apache.thrift.TException;
19 import org.apache.thrift.async.AsyncMethodCallback;
20 import org.apache.thrift.server.AbstractNonblockingServer.*;
21 import java.util.List;
22 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.EnumMap;
27 import java.util.HashSet;
28 import java.util.EnumSet;
29 import java.util.Collections;
30 import java.util.BitSet;
31 import java.nio.ByteBuffer;
32 import java.util.Arrays;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
36 public class Routes implements org.apache.thrift.TBase<Routes, Routes._Fields>, java.io.Serializable, Cloneable, Comparable<Routes> {
37 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Routes");
39 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);
40 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);
41 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);
43 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
45 schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
46 schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
49 public int errcode; // required
50 public List<Update> updates; // optional
51 public int more; // optional
53 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
54 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
55 ERRCODE((short)1, "errcode"),
56 UPDATES((short)2, "updates"),
57 MORE((short)4, "more");
59 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
62 for (_Fields field : EnumSet.allOf(_Fields.class)) {
63 byName.put(field.getFieldName(), field);
68 * Find the _Fields constant that matches fieldId, or null if its not found.
70 public static _Fields findByThriftId(int fieldId) {
84 * Find the _Fields constant that matches fieldId, throwing an exception
87 public static _Fields findByThriftIdOrThrow(int fieldId) {
88 _Fields fields = findByThriftId(fieldId);
89 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
94 * Find the _Fields constant that matches name, or null if its not found.
96 public static _Fields findByName(String name) {
97 return byName.get(name);
100 private final short _thriftId;
101 private final String _fieldName;
103 _Fields(short thriftId, String fieldName) {
104 _thriftId = thriftId;
105 _fieldName = fieldName;
108 public short getThriftFieldId() {
112 public String getFieldName() {
117 // isset id assignments
118 private static final int __ERRCODE_ISSET_ID = 0;
119 private static final int __MORE_ISSET_ID = 1;
120 private byte __isset_bitfield = 0;
121 private _Fields optionals[] = {_Fields.UPDATES,_Fields.MORE};
122 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
124 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
125 tmpMap.put(_Fields.ERRCODE, new org.apache.thrift.meta_data.FieldMetaData("errcode", org.apache.thrift.TFieldRequirementType.DEFAULT,
126 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
127 tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.OPTIONAL,
128 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
129 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Update.class))));
130 tmpMap.put(_Fields.MORE, new org.apache.thrift.meta_data.FieldMetaData("more", org.apache.thrift.TFieldRequirementType.OPTIONAL,
131 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
132 metaDataMap = Collections.unmodifiableMap(tmpMap);
133 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Routes.class, metaDataMap);
143 this.errcode = errcode;
144 setErrcodeIsSet(true);
148 * Performs a deep copy on <i>other</i>.
150 public Routes(Routes other) {
151 __isset_bitfield = other.__isset_bitfield;
152 this.errcode = other.errcode;
153 if (other.isSetUpdates()) {
154 List<Update> __this__updates = new ArrayList<Update>(other.updates.size());
155 for (Update other_element : other.updates) {
156 __this__updates.add(new Update(other_element));
158 this.updates = __this__updates;
160 this.more = other.more;
163 public Routes deepCopy() {
164 return new Routes(this);
168 public void clear() {
169 setErrcodeIsSet(false);
176 public int getErrcode() {
180 public Routes setErrcode(int errcode) {
181 this.errcode = errcode;
182 setErrcodeIsSet(true);
186 public void unsetErrcode() {
187 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRCODE_ISSET_ID);
190 /** Returns true if field errcode is set (has been assigned a value) and false otherwise */
191 public boolean isSetErrcode() {
192 return EncodingUtils.testBit(__isset_bitfield, __ERRCODE_ISSET_ID);
195 public void setErrcodeIsSet(boolean value) {
196 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRCODE_ISSET_ID, value);
199 public int getUpdatesSize() {
200 return (this.updates == null) ? 0 : this.updates.size();
203 public java.util.Iterator<Update> getUpdatesIterator() {
204 return (this.updates == null) ? null : this.updates.iterator();
207 public void addToUpdates(Update elem) {
208 if (this.updates == null) {
209 this.updates = new ArrayList<Update>();
211 this.updates.add(elem);
214 public List<Update> getUpdates() {
218 public Routes setUpdates(List<Update> updates) {
219 this.updates = updates;
223 public void unsetUpdates() {
227 /** Returns true if field updates is set (has been assigned a value) and false otherwise */
228 public boolean isSetUpdates() {
229 return this.updates != null;
232 public void setUpdatesIsSet(boolean value) {
238 public int getMore() {
242 public Routes setMore(int more) {
248 public void unsetMore() {
249 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
252 /** Returns true if field more is set (has been assigned a value) and false otherwise */
253 public boolean isSetMore() {
254 return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
257 public void setMoreIsSet(boolean value) {
258 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
261 public void setFieldValue(_Fields field, Object value) {
267 setErrcode((Integer)value);
275 setUpdates((List<Update>)value);
283 setMore((Integer)value);
290 public Object getFieldValue(_Fields field) {
293 return Integer.valueOf(getErrcode());
299 return Integer.valueOf(getMore());
302 throw new IllegalStateException();
305 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
306 public boolean isSet(_Fields field) {
308 throw new IllegalArgumentException();
313 return isSetErrcode();
315 return isSetUpdates();
319 throw new IllegalStateException();
323 public boolean equals(Object that) {
326 if (that instanceof Routes)
327 return this.equals((Routes)that);
331 public boolean equals(Routes that) {
335 boolean this_present_errcode = true;
336 boolean that_present_errcode = true;
337 if (this_present_errcode || that_present_errcode) {
338 if (!(this_present_errcode && that_present_errcode))
340 if (this.errcode != that.errcode)
344 boolean this_present_updates = true && this.isSetUpdates();
345 boolean that_present_updates = true && that.isSetUpdates();
346 if (this_present_updates || that_present_updates) {
347 if (!(this_present_updates && that_present_updates))
349 if (!this.updates.equals(that.updates))
353 boolean this_present_more = true && this.isSetMore();
354 boolean that_present_more = true && that.isSetMore();
355 if (this_present_more || that_present_more) {
356 if (!(this_present_more && that_present_more))
358 if (this.more != that.more)
366 public int hashCode() {
371 public int compareTo(Routes other) {
372 if (!getClass().equals(other.getClass())) {
373 return getClass().getName().compareTo(other.getClass().getName());
376 int lastComparison = 0;
378 lastComparison = Boolean.valueOf(isSetErrcode()).compareTo(other.isSetErrcode());
379 if (lastComparison != 0) {
380 return lastComparison;
382 if (isSetErrcode()) {
383 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errcode, other.errcode);
384 if (lastComparison != 0) {
385 return lastComparison;
388 lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
389 if (lastComparison != 0) {
390 return lastComparison;
392 if (isSetUpdates()) {
393 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
394 if (lastComparison != 0) {
395 return lastComparison;
398 lastComparison = Boolean.valueOf(isSetMore()).compareTo(other.isSetMore());
399 if (lastComparison != 0) {
400 return lastComparison;
403 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, other.more);
404 if (lastComparison != 0) {
405 return lastComparison;
411 public _Fields fieldForId(int fieldId) {
412 return _Fields.findByThriftId(fieldId);
415 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
416 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
419 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
420 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
424 public String toString() {
425 StringBuilder sb = new StringBuilder("Routes(");
426 boolean first = true;
428 sb.append("errcode:");
429 sb.append(this.errcode);
431 if (isSetUpdates()) {
432 if (!first) sb.append(", ");
433 sb.append("updates:");
434 if (this.updates == null) {
437 sb.append(this.updates);
442 if (!first) sb.append(", ");
444 sb.append(this.more);
448 return sb.toString();
451 public void validate() throws org.apache.thrift.TException {
452 // check for required fields
453 // check for sub-struct validity
456 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
458 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
459 } catch (org.apache.thrift.TException te) {
460 throw new java.io.IOException(te);
464 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
466 // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
467 __isset_bitfield = 0;
468 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
469 } catch (org.apache.thrift.TException te) {
470 throw new java.io.IOException(te);
474 private static class RoutesStandardSchemeFactory implements SchemeFactory {
475 public RoutesStandardScheme getScheme() {
476 return new RoutesStandardScheme();
480 private static class RoutesStandardScheme extends StandardScheme<Routes> {
482 public void read(org.apache.thrift.protocol.TProtocol iprot, Routes struct) throws org.apache.thrift.TException {
483 org.apache.thrift.protocol.TField schemeField;
484 iprot.readStructBegin();
487 schemeField = iprot.readFieldBegin();
488 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
491 switch (schemeField.id) {
493 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
494 struct.errcode = iprot.readI32();
495 struct.setErrcodeIsSet(true);
497 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
501 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
503 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
504 struct.updates = new ArrayList<Update>(_list0.size);
505 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
508 _elem2 = new Update();
510 struct.updates.add(_elem2);
514 struct.setUpdatesIsSet(true);
516 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
520 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
521 struct.more = iprot.readI32();
522 struct.setMoreIsSet(true);
524 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
528 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
530 iprot.readFieldEnd();
532 iprot.readStructEnd();
534 // check for required fields of primitive type, which can't be checked in the validate method
538 public void write(org.apache.thrift.protocol.TProtocol oprot, Routes struct) throws org.apache.thrift.TException {
541 oprot.writeStructBegin(STRUCT_DESC);
542 oprot.writeFieldBegin(ERRCODE_FIELD_DESC);
543 oprot.writeI32(struct.errcode);
544 oprot.writeFieldEnd();
545 if (struct.updates != null) {
546 if (struct.isSetUpdates()) {
547 oprot.writeFieldBegin(UPDATES_FIELD_DESC);
549 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
550 for (Update _iter3 : struct.updates)
554 oprot.writeListEnd();
556 oprot.writeFieldEnd();
559 if (struct.isSetMore()) {
560 oprot.writeFieldBegin(MORE_FIELD_DESC);
561 oprot.writeI32(struct.more);
562 oprot.writeFieldEnd();
564 oprot.writeFieldStop();
565 oprot.writeStructEnd();
570 private static class RoutesTupleSchemeFactory implements SchemeFactory {
571 public RoutesTupleScheme getScheme() {
572 return new RoutesTupleScheme();
576 private static class RoutesTupleScheme extends TupleScheme<Routes> {
579 public void write(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
580 TTupleProtocol oprot = (TTupleProtocol) prot;
581 BitSet optionals = new BitSet();
582 if (struct.isSetErrcode()) {
585 if (struct.isSetUpdates()) {
588 if (struct.isSetMore()) {
591 oprot.writeBitSet(optionals, 3);
592 if (struct.isSetErrcode()) {
593 oprot.writeI32(struct.errcode);
595 if (struct.isSetUpdates()) {
597 oprot.writeI32(struct.updates.size());
598 for (Update _iter4 : struct.updates)
604 if (struct.isSetMore()) {
605 oprot.writeI32(struct.more);
610 public void read(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
611 TTupleProtocol iprot = (TTupleProtocol) prot;
612 BitSet incoming = iprot.readBitSet(3);
613 if (incoming.get(0)) {
614 struct.errcode = iprot.readI32();
615 struct.setErrcodeIsSet(true);
617 if (incoming.get(1)) {
619 org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
620 struct.updates = new ArrayList<Update>(_list5.size);
621 for (int _i6 = 0; _i6 < _list5.size; ++_i6)
624 _elem7 = new Update();
626 struct.updates.add(_elem7);
629 struct.setUpdatesIsSet(true);
631 if (incoming.get(2)) {
632 struct.more = iprot.readI32();
633 struct.setMoreIsSet(true);