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.netvirt.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.EncodingUtils;
17 import java.util.List;
18 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.EnumMap;
22 import java.util.EnumSet;
23 import java.util.Collections;
24 import java.util.BitSet;
26 public class Routes implements org.apache.thrift.TBase<Routes, Routes._Fields>, java.io.Serializable, Cloneable, Comparable<Routes> {
27 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Routes");
29 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);
30 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);
31 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);
33 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
35 schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
36 schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
39 public int errcode; // required
40 public List<Update> updates; // optional
41 public int more; // optional
43 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
44 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
45 ERRCODE((short)1, "errcode"),
46 UPDATES((short)2, "updates"),
47 MORE((short)4, "more");
49 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
52 for (_Fields field : EnumSet.allOf(_Fields.class)) {
53 byName.put(field.getFieldName(), field);
58 * Find the _Fields constant that matches fieldId, or null if its not found.
60 public static _Fields findByThriftId(int fieldId) {
74 * Find the _Fields constant that matches fieldId, throwing an exception
77 public static _Fields findByThriftIdOrThrow(int fieldId) {
78 _Fields fields = findByThriftId(fieldId);
79 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
84 * Find the _Fields constant that matches name, or null if its not found.
86 public static _Fields findByName(String name) {
87 return byName.get(name);
90 private final short _thriftId;
91 private final String _fieldName;
93 _Fields(short thriftId, String fieldName) {
95 _fieldName = fieldName;
98 public short getThriftFieldId() {
102 public String getFieldName() {
107 // isset id assignments
108 private static final int __ERRCODE_ISSET_ID = 0;
109 private static final int __MORE_ISSET_ID = 1;
110 private byte __isset_bitfield = 0;
111 private _Fields optionals[] = {_Fields.UPDATES,_Fields.MORE};
112 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
114 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
115 tmpMap.put(_Fields.ERRCODE, new org.apache.thrift.meta_data.FieldMetaData("errcode", org.apache.thrift.TFieldRequirementType.DEFAULT,
116 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
117 tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", org.apache.thrift.TFieldRequirementType.OPTIONAL,
118 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
119 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Update.class))));
120 tmpMap.put(_Fields.MORE, new org.apache.thrift.meta_data.FieldMetaData("more", org.apache.thrift.TFieldRequirementType.OPTIONAL,
121 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
122 metaDataMap = Collections.unmodifiableMap(tmpMap);
123 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Routes.class, metaDataMap);
133 this.errcode = errcode;
134 setErrcodeIsSet(true);
138 * Performs a deep copy on <i>other</i>.
140 public Routes(Routes other) {
141 __isset_bitfield = other.__isset_bitfield;
142 this.errcode = other.errcode;
143 if (other.isSetUpdates()) {
144 List<Update> __this__updates = new ArrayList<Update>(other.updates.size());
145 for (Update other_element : other.updates) {
146 __this__updates.add(new Update(other_element));
148 this.updates = __this__updates;
150 this.more = other.more;
153 public Routes deepCopy() {
154 return new Routes(this);
158 public void clear() {
159 setErrcodeIsSet(false);
166 public int getErrcode() {
170 public Routes setErrcode(int errcode) {
171 this.errcode = errcode;
172 setErrcodeIsSet(true);
176 public void unsetErrcode() {
177 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRCODE_ISSET_ID);
180 /** Returns true if field errcode is set (has been assigned a value) and false otherwise */
181 public boolean isSetErrcode() {
182 return EncodingUtils.testBit(__isset_bitfield, __ERRCODE_ISSET_ID);
185 public void setErrcodeIsSet(boolean value) {
186 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRCODE_ISSET_ID, value);
189 public int getUpdatesSize() {
190 return (this.updates == null) ? 0 : this.updates.size();
193 public java.util.Iterator<Update> getUpdatesIterator() {
194 return (this.updates == null) ? null : this.updates.iterator();
197 public void addToUpdates(Update elem) {
198 if (this.updates == null) {
199 this.updates = new ArrayList<Update>();
201 this.updates.add(elem);
204 public List<Update> getUpdates() {
208 public Routes setUpdates(List<Update> updates) {
209 this.updates = updates;
213 public void unsetUpdates() {
217 /** Returns true if field updates is set (has been assigned a value) and false otherwise */
218 public boolean isSetUpdates() {
219 return this.updates != null;
222 public void setUpdatesIsSet(boolean value) {
228 public int getMore() {
232 public Routes setMore(int more) {
238 public void unsetMore() {
239 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
242 /** Returns true if field more is set (has been assigned a value) and false otherwise */
243 public boolean isSetMore() {
244 return EncodingUtils.testBit(__isset_bitfield, __MORE_ISSET_ID);
247 public void setMoreIsSet(boolean value) {
248 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
251 public void setFieldValue(_Fields field, Object value) {
257 setErrcode((Integer)value);
265 setUpdates((List<Update>)value);
273 setMore((Integer)value);
280 public Object getFieldValue(_Fields field) {
283 return Integer.valueOf(getErrcode());
289 return Integer.valueOf(getMore());
292 throw new IllegalStateException();
295 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
296 public boolean isSet(_Fields field) {
298 throw new IllegalArgumentException();
303 return isSetErrcode();
305 return isSetUpdates();
309 throw new IllegalStateException();
313 public boolean equals(Object that) {
316 if (that instanceof Routes)
317 return this.equals((Routes)that);
321 public boolean equals(Routes that) {
325 boolean this_present_errcode = true;
326 boolean that_present_errcode = true;
327 if (this_present_errcode || that_present_errcode) {
328 if (!(this_present_errcode && that_present_errcode))
330 if (this.errcode != that.errcode)
334 boolean this_present_updates = true && this.isSetUpdates();
335 boolean that_present_updates = true && that.isSetUpdates();
336 if (this_present_updates || that_present_updates) {
337 if (!(this_present_updates && that_present_updates))
339 if (!this.updates.equals(that.updates))
343 boolean this_present_more = true && this.isSetMore();
344 boolean that_present_more = true && that.isSetMore();
345 if (this_present_more || that_present_more) {
346 if (!(this_present_more && that_present_more))
348 if (this.more != that.more)
356 public int hashCode() {
361 public int compareTo(Routes other) {
362 if (!getClass().equals(other.getClass())) {
363 return getClass().getName().compareTo(other.getClass().getName());
366 int lastComparison = 0;
368 lastComparison = Boolean.valueOf(isSetErrcode()).compareTo(other.isSetErrcode());
369 if (lastComparison != 0) {
370 return lastComparison;
372 if (isSetErrcode()) {
373 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errcode, other.errcode);
374 if (lastComparison != 0) {
375 return lastComparison;
378 lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
379 if (lastComparison != 0) {
380 return lastComparison;
382 if (isSetUpdates()) {
383 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
384 if (lastComparison != 0) {
385 return lastComparison;
388 lastComparison = Boolean.valueOf(isSetMore()).compareTo(other.isSetMore());
389 if (lastComparison != 0) {
390 return lastComparison;
393 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, other.more);
394 if (lastComparison != 0) {
395 return lastComparison;
401 public _Fields fieldForId(int fieldId) {
402 return _Fields.findByThriftId(fieldId);
405 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
406 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
409 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
410 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
414 public String toString() {
415 StringBuilder sb = new StringBuilder("Routes(");
416 boolean first = true;
418 sb.append("errcode:");
419 sb.append(this.errcode);
421 if (isSetUpdates()) {
422 if (!first) sb.append(", ");
423 sb.append("updates:");
424 if (this.updates == null) {
427 sb.append(this.updates);
432 if (!first) sb.append(", ");
434 sb.append(this.more);
438 return sb.toString();
441 public void validate() throws org.apache.thrift.TException {
442 // check for required fields
443 // check for sub-struct validity
446 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
448 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
449 } catch (org.apache.thrift.TException te) {
450 throw new java.io.IOException(te);
454 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
456 // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
457 __isset_bitfield = 0;
458 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
459 } catch (org.apache.thrift.TException te) {
460 throw new java.io.IOException(te);
464 private static class RoutesStandardSchemeFactory implements SchemeFactory {
465 public RoutesStandardScheme getScheme() {
466 return new RoutesStandardScheme();
470 private static class RoutesStandardScheme extends StandardScheme<Routes> {
472 public void read(org.apache.thrift.protocol.TProtocol iprot, Routes struct) throws org.apache.thrift.TException {
473 org.apache.thrift.protocol.TField schemeField;
474 iprot.readStructBegin();
477 schemeField = iprot.readFieldBegin();
478 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
481 switch (schemeField.id) {
483 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
484 struct.errcode = iprot.readI32();
485 struct.setErrcodeIsSet(true);
487 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
491 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
493 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
494 struct.updates = new ArrayList<Update>(_list0.size);
495 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
498 _elem2 = new Update();
500 struct.updates.add(_elem2);
504 struct.setUpdatesIsSet(true);
506 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
510 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
511 struct.more = iprot.readI32();
512 struct.setMoreIsSet(true);
514 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
518 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
520 iprot.readFieldEnd();
522 iprot.readStructEnd();
524 // check for required fields of primitive type, which can't be checked in the validate method
528 public void write(org.apache.thrift.protocol.TProtocol oprot, Routes struct) throws org.apache.thrift.TException {
531 oprot.writeStructBegin(STRUCT_DESC);
532 oprot.writeFieldBegin(ERRCODE_FIELD_DESC);
533 oprot.writeI32(struct.errcode);
534 oprot.writeFieldEnd();
535 if (struct.updates != null) {
536 if (struct.isSetUpdates()) {
537 oprot.writeFieldBegin(UPDATES_FIELD_DESC);
539 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
540 for (Update _iter3 : struct.updates)
544 oprot.writeListEnd();
546 oprot.writeFieldEnd();
549 if (struct.isSetMore()) {
550 oprot.writeFieldBegin(MORE_FIELD_DESC);
551 oprot.writeI32(struct.more);
552 oprot.writeFieldEnd();
554 oprot.writeFieldStop();
555 oprot.writeStructEnd();
560 private static class RoutesTupleSchemeFactory implements SchemeFactory {
561 public RoutesTupleScheme getScheme() {
562 return new RoutesTupleScheme();
566 private static class RoutesTupleScheme extends TupleScheme<Routes> {
569 public void write(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
570 TTupleProtocol oprot = (TTupleProtocol) prot;
571 BitSet optionals = new BitSet();
572 if (struct.isSetErrcode()) {
575 if (struct.isSetUpdates()) {
578 if (struct.isSetMore()) {
581 oprot.writeBitSet(optionals, 3);
582 if (struct.isSetErrcode()) {
583 oprot.writeI32(struct.errcode);
585 if (struct.isSetUpdates()) {
587 oprot.writeI32(struct.updates.size());
588 for (Update _iter4 : struct.updates)
594 if (struct.isSetMore()) {
595 oprot.writeI32(struct.more);
600 public void read(org.apache.thrift.protocol.TProtocol prot, Routes struct) throws org.apache.thrift.TException {
601 TTupleProtocol iprot = (TTupleProtocol) prot;
602 BitSet incoming = iprot.readBitSet(3);
603 if (incoming.get(0)) {
604 struct.errcode = iprot.readI32();
605 struct.setErrcodeIsSet(true);
607 if (incoming.get(1)) {
609 org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
610 struct.updates = new ArrayList<Update>(_list5.size);
611 for (int _i6 = 0; _i6 < _list5.size; ++_i6)
614 _elem7 = new Update();
616 struct.updates.add(_elem7);
619 struct.setUpdatesIsSet(true);
621 if (incoming.get(2)) {
622 struct.more = iprot.readI32();
623 struct.setMoreIsSet(true);