2 * Autogenerated by Thrift Compiler (0.9.1)
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
7 package org.opendaylight.bgpmanager.thrift.gen;
9 import org.apache.thrift.scheme.IScheme;
10 import org.apache.thrift.scheme.SchemeFactory;
11 import org.apache.thrift.scheme.StandardScheme;
13 import org.apache.thrift.scheme.TupleScheme;
14 import org.apache.thrift.protocol.TTupleProtocol;
15 import org.apache.thrift.protocol.TProtocolException;
16 import org.apache.thrift.EncodingUtils;
17 import org.apache.thrift.TException;
18 import org.apache.thrift.async.AsyncMethodCallback;
19 import org.apache.thrift.server.AbstractNonblockingServer.*;
20 import java.util.List;
21 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.EnumMap;
26 import java.util.HashSet;
27 import java.util.EnumSet;
28 import java.util.Collections;
29 import java.util.BitSet;
30 import java.nio.ByteBuffer;
31 import java.util.Arrays;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 public class Routes implements org.apache.thrift.TBase<Routes, Routes._Fields>, java.io.Serializable, Cloneable, Comparable<Routes> {
36 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Routes");
38 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);
39 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);
40 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);
42 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
44 schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
45 schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
48 public int errcode; // required
49 public List<Update> updates; // optional
50 public int more; // optional
52 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
53 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
54 ERRCODE((short)1, "errcode"),
55 UPDATES((short)2, "updates"),
56 MORE((short)4, "more");
58 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
61 for (_Fields field : EnumSet.allOf(_Fields.class)) {
62 byName.put(field.getFieldName(), field);
67 * Find the _Fields constant that matches fieldId, or null if its not found.
69 public static _Fields findByThriftId(int fieldId) {
83 * Find the _Fields constant that matches fieldId, throwing an exception
86 public static _Fields findByThriftIdOrThrow(int fieldId) {
87 _Fields fields = findByThriftId(fieldId);
88 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
93 * Find the _Fields constant that matches name, or null if its not found.
95 public static _Fields findByName(String name) {
96 return byName.get(name);
99 private final short _thriftId;
100 private final String _fieldName;
102 _Fields(short thriftId, String fieldName) {
103 _thriftId = thriftId;
104 _fieldName = fieldName;
107 public short getThriftFieldId() {
111 public String getFieldName() {
116 // isset id assignments
117 private static final int __ERRCODE_ISSET_ID = 0;
118 private static final int __MORE_ISSET_ID = 1;
119 private byte __isset_bitfield = 0;
120 private _Fields optionals[] = {_Fields.UPDATES,_Fields.MORE};
121 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
123 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
124 tmpMap.put(_Fields.ERRCODE, new org.apache.thrift.meta_data.FieldMetaData("errcode", org.apache.thrift.TFieldRequirementType.DEFAULT,
125 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
126 tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.OPTIONAL,
127 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
128 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Update.class))));
129 tmpMap.put(_Fields.MORE, new org.apache.thrift.meta_data.FieldMetaData("more", org.apache.thrift.TFieldRequirementType.OPTIONAL,
130 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
131 metaDataMap = Collections.unmodifiableMap(tmpMap);
132 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Routes.class, metaDataMap);
142 this.errcode = errcode;
143 setErrcodeIsSet(true);
147 * Performs a deep copy on <i>other</i>.
149 public Routes(Routes other) {
150 __isset_bitfield = other.__isset_bitfield;
151 this.errcode = other.errcode;
152 if (other.isSetUpdates()) {
153 List<Update> __this__updates = new ArrayList<Update>(other.updates.size());
154 for (Update other_element : other.updates) {
155 __this__updates.add(new Update(other_element));
157 this.updates = __this__updates;
159 this.more = other.more;
162 public Routes deepCopy() {
163 return new Routes(this);
167 public void clear() {
168 setErrcodeIsSet(false);
175 public int getErrcode() {
179 public Routes setErrcode(int errcode) {
180 this.errcode = errcode;
181 setErrcodeIsSet(true);
185 public void unsetErrcode() {
186 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRCODE_ISSET_ID);
189 /** Returns true if field errcode is set (has been assigned a value) and false otherwise */
190 public boolean isSetErrcode() {
191 return EncodingUtils.testBit(__isset_bitfield, __ERRCODE_ISSET_ID);
194 public void setErrcodeIsSet(boolean value) {
195 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRCODE_ISSET_ID, value);
198 public int getUpdatesSize() {
199 return (this.updates == null) ? 0 : this.updates.size();
202 public java.util.Iterator<Update> getUpdatesIterator() {
203 return (this.updates == null) ? null : this.updates.iterator();
206 public void addToUpdates(Update elem) {
207 if (this.updates == null) {
208 this.updates = new ArrayList<Update>();
210 this.updates.add(elem);
213 public List<Update> getUpdates() {
217 public Routes setUpdates(List<Update> updates) {
218 this.updates = updates;
222 public void unsetUpdates() {
226 /** Returns true if field updates is set (has been assigned a value) and false otherwise */
227 public boolean isSetUpdates() {
228 return this.updates != null;
231 public void setUpdatesIsSet(boolean value) {
237 public int getMore() {
241 public Routes setMore(int more) {
247 public void unsetMore() {
248 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
251 /** Returns true if field more is set (has been assigned a value) and false otherwise */
252 public boolean isSetMore() {
253 return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
256 public void setMoreIsSet(boolean value) {
257 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
260 public void setFieldValue(_Fields field, Object value) {
266 setErrcode((Integer)value);
274 setUpdates((List<Update>)value);
282 setMore((Integer)value);
289 public Object getFieldValue(_Fields field) {
292 return Integer.valueOf(getErrcode());
298 return Integer.valueOf(getMore());
301 throw new IllegalStateException();
304 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
305 public boolean isSet(_Fields field) {
307 throw new IllegalArgumentException();
312 return isSetErrcode();
314 return isSetUpdates();
318 throw new IllegalStateException();
322 public boolean equals(Object that) {
325 if (that instanceof Routes)
326 return this.equals((Routes)that);
330 public boolean equals(Routes that) {
334 boolean this_present_errcode = true;
335 boolean that_present_errcode = true;
336 if (this_present_errcode || that_present_errcode) {
337 if (!(this_present_errcode && that_present_errcode))
339 if (this.errcode != that.errcode)
343 boolean this_present_updates = true && this.isSetUpdates();
344 boolean that_present_updates = true && that.isSetUpdates();
345 if (this_present_updates || that_present_updates) {
346 if (!(this_present_updates && that_present_updates))
348 if (!this.updates.equals(that.updates))
352 boolean this_present_more = true && this.isSetMore();
353 boolean that_present_more = true && that.isSetMore();
354 if (this_present_more || that_present_more) {
355 if (!(this_present_more && that_present_more))
357 if (this.more != that.more)
365 public int hashCode() {
370 public int compareTo(Routes other) {
371 if (!getClass().equals(other.getClass())) {
372 return getClass().getName().compareTo(other.getClass().getName());
375 int lastComparison = 0;
377 lastComparison = Boolean.valueOf(isSetErrcode()).compareTo(other.isSetErrcode());
378 if (lastComparison != 0) {
379 return lastComparison;
381 if (isSetErrcode()) {
382 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errcode, other.errcode);
383 if (lastComparison != 0) {
384 return lastComparison;
387 lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
388 if (lastComparison != 0) {
389 return lastComparison;
391 if (isSetUpdates()) {
392 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
393 if (lastComparison != 0) {
394 return lastComparison;
397 lastComparison = Boolean.valueOf(isSetMore()).compareTo(other.isSetMore());
398 if (lastComparison != 0) {
399 return lastComparison;
402 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, other.more);
403 if (lastComparison != 0) {
404 return lastComparison;
410 public _Fields fieldForId(int fieldId) {
411 return _Fields.findByThriftId(fieldId);
414 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
415 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
418 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
419 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
423 public String toString() {
424 StringBuilder sb = new StringBuilder("Routes(");
425 boolean first = true;
427 sb.append("errcode:");
428 sb.append(this.errcode);
430 if (isSetUpdates()) {
431 if (!first) sb.append(", ");
432 sb.append("updates:");
433 if (this.updates == null) {
436 sb.append(this.updates);
441 if (!first) sb.append(", ");
443 sb.append(this.more);
447 return sb.toString();
450 public void validate() throws org.apache.thrift.TException {
451 // check for required fields
452 // check for sub-struct validity
455 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
457 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
458 } catch (org.apache.thrift.TException te) {
459 throw new java.io.IOException(te);
463 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
465 // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
466 __isset_bitfield = 0;
467 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
468 } catch (org.apache.thrift.TException te) {
469 throw new java.io.IOException(te);
473 private static class RoutesStandardSchemeFactory implements SchemeFactory {
474 public RoutesStandardScheme getScheme() {
475 return new RoutesStandardScheme();
479 private static class RoutesStandardScheme extends StandardScheme<Routes> {
481 public void read(org.apache.thrift.protocol.TProtocol iprot, Routes struct) throws org.apache.thrift.TException {
482 org.apache.thrift.protocol.TField schemeField;
483 iprot.readStructBegin();
486 schemeField = iprot.readFieldBegin();
487 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
490 switch (schemeField.id) {
492 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
493 struct.errcode = iprot.readI32();
494 struct.setErrcodeIsSet(true);
496 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
500 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
502 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
503 struct.updates = new ArrayList<Update>(_list0.size);
504 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
507 _elem2 = new Update();
509 struct.updates.add(_elem2);
513 struct.setUpdatesIsSet(true);
515 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
519 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
520 struct.more = iprot.readI32();
521 struct.setMoreIsSet(true);
523 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
527 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
529 iprot.readFieldEnd();
531 iprot.readStructEnd();
533 // check for required fields of primitive type, which can't be checked in the validate method
537 public void write(org.apache.thrift.protocol.TProtocol oprot, Routes struct) throws org.apache.thrift.TException {
540 oprot.writeStructBegin(STRUCT_DESC);
541 oprot.writeFieldBegin(ERRCODE_FIELD_DESC);
542 oprot.writeI32(struct.errcode);
543 oprot.writeFieldEnd();
544 if (struct.updates != null) {
545 if (struct.isSetUpdates()) {
546 oprot.writeFieldBegin(UPDATES_FIELD_DESC);
548 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
549 for (Update _iter3 : struct.updates)
553 oprot.writeListEnd();
555 oprot.writeFieldEnd();
558 if (struct.isSetMore()) {
559 oprot.writeFieldBegin(MORE_FIELD_DESC);
560 oprot.writeI32(struct.more);
561 oprot.writeFieldEnd();
563 oprot.writeFieldStop();
564 oprot.writeStructEnd();
569 private static class RoutesTupleSchemeFactory implements SchemeFactory {
570 public RoutesTupleScheme getScheme() {
571 return new RoutesTupleScheme();
575 private static class RoutesTupleScheme extends TupleScheme<Routes> {
578 public void write(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
579 TTupleProtocol oprot = (TTupleProtocol) prot;
580 BitSet optionals = new BitSet();
581 if (struct.isSetErrcode()) {
584 if (struct.isSetUpdates()) {
587 if (struct.isSetMore()) {
590 oprot.writeBitSet(optionals, 3);
591 if (struct.isSetErrcode()) {
592 oprot.writeI32(struct.errcode);
594 if (struct.isSetUpdates()) {
596 oprot.writeI32(struct.updates.size());
597 for (Update _iter4 : struct.updates)
603 if (struct.isSetMore()) {
604 oprot.writeI32(struct.more);
609 public void read(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
610 TTupleProtocol iprot = (TTupleProtocol) prot;
611 BitSet incoming = iprot.readBitSet(3);
612 if (incoming.get(0)) {
613 struct.errcode = iprot.readI32();
614 struct.setErrcodeIsSet(true);
616 if (incoming.get(1)) {
618 org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
619 struct.updates = new ArrayList<Update>(_list5.size);
620 for (int _i6 = 0; _i6 < _list5.size; ++_i6)
623 _elem7 = new Update();
625 struct.updates.add(_elem7);
628 struct.setUpdatesIsSet(true);
630 if (incoming.get(2)) {
631 struct.more = iprot.readI32();
632 struct.setMoreIsSet(true);