acbac5566d843d8bf97171ef06670d3a3af7e581
[vpnservice.git] / bgpmanager / bgpmanager-impl / src / main / java / org / opendaylight / bgpmanager / thrift / gen / Routes.java
1 /**
2  * Autogenerated by Thrift Compiler (0.9.1)
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated
6  */
7
8 package org.opendaylight.bgpmanager.thrift.gen;
9
10 import org.apache.thrift.scheme.IScheme;
11 import org.apache.thrift.scheme.SchemeFactory;
12 import org.apache.thrift.scheme.StandardScheme;
13
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;
23 import java.util.Map;
24 import java.util.HashMap;
25 import java.util.EnumMap;
26 import java.util.Set;
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;
35
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");
38
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);
42
43   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
44   static {
45     schemes.put(StandardScheme.class, new RoutesStandardSchemeFactory());
46     schemes.put(TupleScheme.class, new RoutesTupleSchemeFactory());
47   }
48
49   public int errcode; // required
50   public List<Update> updates; // optional
51   public int more; // optional
52
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");
58
59     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
60
61     static {
62       for (_Fields field : EnumSet.allOf(_Fields.class)) {
63         byName.put(field.getFieldName(), field);
64       }
65     }
66
67     /**
68      * Find the _Fields constant that matches fieldId, or null if its not found.
69      */
70     public static _Fields findByThriftId(int fieldId) {
71       switch(fieldId) {
72         case 1: // ERRCODE
73           return ERRCODE;
74         case 2: // UPDATES
75           return UPDATES;
76         case 4: // MORE
77           return MORE;
78         default:
79           return null;
80       }
81     }
82
83     /**
84      * Find the _Fields constant that matches fieldId, throwing an exception
85      * if it is not found.
86      */
87     public static _Fields findByThriftIdOrThrow(int fieldId) {
88       _Fields fields = findByThriftId(fieldId);
89       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
90       return fields;
91     }
92
93     /**
94      * Find the _Fields constant that matches name, or null if its not found.
95      */
96     public static _Fields findByName(String name) {
97       return byName.get(name);
98     }
99
100     private final short _thriftId;
101     private final String _fieldName;
102
103     _Fields(short thriftId, String fieldName) {
104       _thriftId = thriftId;
105       _fieldName = fieldName;
106     }
107
108     public short getThriftFieldId() {
109       return _thriftId;
110     }
111
112     public String getFieldName() {
113       return _fieldName;
114     }
115   }
116
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;
123   static {
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);
134   }
135
136   public Routes() {
137   }
138
139   public Routes(
140     int errcode)
141   {
142     this();
143     this.errcode = errcode;
144     setErrcodeIsSet(true);
145   }
146
147   /**
148    * Performs a deep copy on <i>other</i>.
149    */
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));
157       }
158       this.updates = __this__updates;
159     }
160     this.more = other.more;
161   }
162
163   public Routes deepCopy() {
164     return new Routes(this);
165   }
166
167   @Override
168   public void clear() {
169     setErrcodeIsSet(false);
170     this.errcode = 0;
171     this.updates = null;
172     setMoreIsSet(false);
173     this.more = 0;
174   }
175
176   public int getErrcode() {
177     return this.errcode;
178   }
179
180   public Routes setErrcode(int errcode) {
181     this.errcode = errcode;
182     setErrcodeIsSet(true);
183     return this;
184   }
185
186   public void unsetErrcode() {
187     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ERRCODE_ISSET_ID);
188   }
189
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);
193   }
194
195   public void setErrcodeIsSet(boolean value) {
196     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ERRCODE_ISSET_ID, value);
197   }
198
199   public int getUpdatesSize() {
200     return (this.updates == null) ? 0 : this.updates.size();
201   }
202
203   public java.util.Iterator<Update> getUpdatesIterator() {
204     return (this.updates == null) ? null : this.updates.iterator();
205   }
206
207   public void addToUpdates(Update elem) {
208     if (this.updates == null) {
209       this.updates = new ArrayList<Update>();
210     }
211     this.updates.add(elem);
212   }
213
214   public List<Update> getUpdates() {
215     return this.updates;
216   }
217
218   public Routes setUpdates(List<Update> updates) {
219     this.updates = updates;
220     return this;
221   }
222
223   public void unsetUpdates() {
224     this.updates = null;
225   }
226
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;
230   }
231
232   public void setUpdatesIsSet(boolean value) {
233     if (!value) {
234       this.updates = null;
235     }
236   }
237
238   public int getMore() {
239     return this.more;
240   }
241
242   public Routes setMore(int more) {
243     this.more = more;
244     setMoreIsSet(true);
245     return this;
246   }
247
248   public void unsetMore() {
249     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MORE_ISSET_ID);
250   }
251
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);
255   }
256
257   public void setMoreIsSet(boolean value) {
258     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MORE_ISSET_ID, value);
259   }
260
261   public void setFieldValue(_Fields field, Object value) {
262     switch (field) {
263     case ERRCODE:
264       if (value == null) {
265         unsetErrcode();
266       } else {
267         setErrcode((Integer)value);
268       }
269       break;
270
271     case UPDATES:
272       if (value == null) {
273         unsetUpdates();
274       } else {
275         setUpdates((List<Update>)value);
276       }
277       break;
278
279     case MORE:
280       if (value == null) {
281         unsetMore();
282       } else {
283         setMore((Integer)value);
284       }
285       break;
286
287     }
288   }
289
290   public Object getFieldValue(_Fields field) {
291     switch (field) {
292     case ERRCODE:
293       return Integer.valueOf(getErrcode());
294
295     case UPDATES:
296       return getUpdates();
297
298     case MORE:
299       return Integer.valueOf(getMore());
300
301     }
302     throw new IllegalStateException();
303   }
304
305   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
306   public boolean isSet(_Fields field) {
307     if (field == null) {
308       throw new IllegalArgumentException();
309     }
310
311     switch (field) {
312     case ERRCODE:
313       return isSetErrcode();
314     case UPDATES:
315       return isSetUpdates();
316     case MORE:
317       return isSetMore();
318     }
319     throw new IllegalStateException();
320   }
321
322   @Override
323   public boolean equals(Object that) {
324     if (that == null)
325       return false;
326     if (that instanceof Routes)
327       return this.equals((Routes)that);
328     return false;
329   }
330
331   public boolean equals(Routes that) {
332     if (that == null)
333       return false;
334
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))
339         return false;
340       if (this.errcode != that.errcode)
341         return false;
342     }
343
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))
348         return false;
349       if (!this.updates.equals(that.updates))
350         return false;
351     }
352
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))
357         return false;
358       if (this.more != that.more)
359         return false;
360     }
361
362     return true;
363   }
364
365   @Override
366   public int hashCode() {
367     return 0;
368   }
369
370   @Override
371   public int compareTo(Routes other) {
372     if (!getClass().equals(other.getClass())) {
373       return getClass().getName().compareTo(other.getClass().getName());
374     }
375
376     int lastComparison = 0;
377
378     lastComparison = Boolean.valueOf(isSetErrcode()).compareTo(other.isSetErrcode());
379     if (lastComparison != 0) {
380       return lastComparison;
381     }
382     if (isSetErrcode()) {
383       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errcode, other.errcode);
384       if (lastComparison != 0) {
385         return lastComparison;
386       }
387     }
388     lastComparison = Boolean.valueOf(isSetUpdates()).compareTo(other.isSetUpdates());
389     if (lastComparison != 0) {
390       return lastComparison;
391     }
392     if (isSetUpdates()) {
393       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
394       if (lastComparison != 0) {
395         return lastComparison;
396       }
397     }
398     lastComparison = Boolean.valueOf(isSetMore()).compareTo(other.isSetMore());
399     if (lastComparison != 0) {
400       return lastComparison;
401     }
402     if (isSetMore()) {
403       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.more, other.more);
404       if (lastComparison != 0) {
405         return lastComparison;
406       }
407     }
408     return 0;
409   }
410
411   public _Fields fieldForId(int fieldId) {
412     return _Fields.findByThriftId(fieldId);
413   }
414
415   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
416     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
417   }
418
419   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
420     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
421   }
422
423   @Override
424   public String toString() {
425     StringBuilder sb = new StringBuilder("Routes(");
426     boolean first = true;
427
428     sb.append("errcode:");
429     sb.append(this.errcode);
430     first = false;
431     if (isSetUpdates()) {
432       if (!first) sb.append(", ");
433       sb.append("updates:");
434       if (this.updates == null) {
435         sb.append("null");
436       } else {
437         sb.append(this.updates);
438       }
439       first = false;
440     }
441     if (isSetMore()) {
442       if (!first) sb.append(", ");
443       sb.append("more:");
444       sb.append(this.more);
445       first = false;
446     }
447     sb.append(")");
448     return sb.toString();
449   }
450
451   public void validate() throws org.apache.thrift.TException {
452     // check for required fields
453     // check for sub-struct validity
454   }
455
456   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
457     try {
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);
461     }
462   }
463
464   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
465     try {
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);
471     }
472   }
473
474   private static class RoutesStandardSchemeFactory implements SchemeFactory {
475     public RoutesStandardScheme getScheme() {
476       return new RoutesStandardScheme();
477     }
478   }
479
480   private static class RoutesStandardScheme extends StandardScheme<Routes> {
481
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();
485       while (true)
486       {
487         schemeField = iprot.readFieldBegin();
488         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
489           break;
490         }
491         switch (schemeField.id) {
492           case 1: // ERRCODE
493             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
494               struct.errcode = iprot.readI32();
495               struct.setErrcodeIsSet(true);
496             } else { 
497               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
498             }
499             break;
500           case 2: // UPDATES
501             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
502               {
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)
506                 {
507                   Update _elem2;
508                   _elem2 = new Update();
509                   _elem2.read(iprot);
510                   struct.updates.add(_elem2);
511                 }
512                 iprot.readListEnd();
513               }
514               struct.setUpdatesIsSet(true);
515             } else { 
516               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
517             }
518             break;
519           case 4: // MORE
520             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
521               struct.more = iprot.readI32();
522               struct.setMoreIsSet(true);
523             } else { 
524               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
525             }
526             break;
527           default:
528             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
529         }
530         iprot.readFieldEnd();
531       }
532       iprot.readStructEnd();
533
534       // check for required fields of primitive type, which can't be checked in the validate method
535       struct.validate();
536     }
537
538     public void write(org.apache.thrift.protocol.TProtocol oprot, Routes struct) throws org.apache.thrift.TException {
539       struct.validate();
540
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);
548           {
549             oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
550             for (Update _iter3 : struct.updates)
551             {
552               _iter3.write(oprot);
553             }
554             oprot.writeListEnd();
555           }
556           oprot.writeFieldEnd();
557         }
558       }
559       if (struct.isSetMore()) {
560         oprot.writeFieldBegin(MORE_FIELD_DESC);
561         oprot.writeI32(struct.more);
562         oprot.writeFieldEnd();
563       }
564       oprot.writeFieldStop();
565       oprot.writeStructEnd();
566     }
567
568   }
569
570   private static class RoutesTupleSchemeFactory implements SchemeFactory {
571     public RoutesTupleScheme getScheme() {
572       return new RoutesTupleScheme();
573     }
574   }
575
576   private static class RoutesTupleScheme extends TupleScheme<Routes> {
577
578     @Override
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()) {
583         optionals.set(0);
584       }
585       if (struct.isSetUpdates()) {
586         optionals.set(1);
587       }
588       if (struct.isSetMore()) {
589         optionals.set(2);
590       }
591       oprot.writeBitSet(optionals, 3);
592       if (struct.isSetErrcode()) {
593         oprot.writeI32(struct.errcode);
594       }
595       if (struct.isSetUpdates()) {
596         {
597           oprot.writeI32(struct.updates.size());
598           for (Update _iter4 : struct.updates)
599           {
600             _iter4.write(oprot);
601           }
602         }
603       }
604       if (struct.isSetMore()) {
605         oprot.writeI32(struct.more);
606       }
607     }
608
609     @Override
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);
616       }
617       if (incoming.get(1)) {
618         {
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)
622           {
623             Update _elem7;
624             _elem7 = new Update();
625             _elem7.read(iprot);
626             struct.updates.add(_elem7);
627           }
628         }
629         struct.setUpdatesIsSet(true);
630       }
631       if (incoming.get(2)) {
632         struct.more = iprot.readI32();
633         struct.setMoreIsSet(true);
634       }
635     }
636   }
637
638 }
639