blob: 8e4d989a8fce05c6756e3b0d09c80b50c20f7168 [file] [log] [blame]
Umesh Krishnaswamy9b5c59e2012-12-27 19:39:51 -08001/**
2 * Autogenerated by Thrift Compiler (0.7.0)
3 *
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 */
6package net.floodlightcontroller.packetstreamer.thrift;
7
8import java.util.List;
9import java.util.ArrayList;
10import java.util.Map;
11import java.util.HashMap;
12import java.util.EnumMap;
13import java.util.Set;
14import java.util.HashSet;
15import java.util.EnumSet;
16import java.util.Collections;
17import java.util.BitSet;
18import java.nio.ByteBuffer;
19import java.util.Arrays;
20import org.slf4j.Logger;
21import org.slf4j.LoggerFactory;
22
23@SuppressWarnings("all") public class Message implements org.apache.thrift.TBase<Message, Message._Fields>, java.io.Serializable, Cloneable {
24 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Message");
25
26 private static final org.apache.thrift.protocol.TField SESSION_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionIDs", org.apache.thrift.protocol.TType.LIST, (short)1);
27 private static final org.apache.thrift.protocol.TField PACKET_FIELD_DESC = new org.apache.thrift.protocol.TField("packet", org.apache.thrift.protocol.TType.STRUCT, (short)2);
28
29 public List<String> sessionIDs; // required
30 public Packet packet; // required
31
32 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
33 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
34 SESSION_IDS((short)1, "sessionIDs"),
35 PACKET((short)2, "packet");
36
37 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
38
39 static {
40 for (_Fields field : EnumSet.allOf(_Fields.class)) {
41 byName.put(field.getFieldName(), field);
42 }
43 }
44
45 /**
46 * Find the _Fields constant that matches fieldId, or null if its not found.
47 */
48 public static _Fields findByThriftId(int fieldId) {
49 switch(fieldId) {
50 case 1: // SESSION_IDS
51 return SESSION_IDS;
52 case 2: // PACKET
53 return PACKET;
54 default:
55 return null;
56 }
57 }
58
59 /**
60 * Find the _Fields constant that matches fieldId, throwing an exception
61 * if it is not found.
62 */
63 public static _Fields findByThriftIdOrThrow(int fieldId) {
64 _Fields fields = findByThriftId(fieldId);
65 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
66 return fields;
67 }
68
69 /**
70 * Find the _Fields constant that matches name, or null if its not found.
71 */
72 public static _Fields findByName(String name) {
73 return byName.get(name);
74 }
75
76 private final short _thriftId;
77 private final String _fieldName;
78
79 _Fields(short thriftId, String fieldName) {
80 _thriftId = thriftId;
81 _fieldName = fieldName;
82 }
83
84 public short getThriftFieldId() {
85 return _thriftId;
86 }
87
88 public String getFieldName() {
89 return _fieldName;
90 }
91 }
92
93 // isset id assignments
94
95 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
96 static {
97 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
98 tmpMap.put(_Fields.SESSION_IDS, new org.apache.thrift.meta_data.FieldMetaData("sessionIDs", org.apache.thrift.TFieldRequirementType.DEFAULT,
99 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
100 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
101 tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
102 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Packet.class)));
103 metaDataMap = Collections.unmodifiableMap(tmpMap);
104 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Message.class, metaDataMap);
105 }
106
107 public Message() {
108 }
109
110 public Message(
111 List<String> sessionIDs,
112 Packet packet)
113 {
114 this();
115 this.sessionIDs = sessionIDs;
116 this.packet = packet;
117 }
118
119 /**
120 * Performs a deep copy on <i>other</i>.
121 */
122 public Message(Message other) {
123 if (other.isSetSessionIDs()) {
124 List<String> __this__sessionIDs = new ArrayList<String>();
125 for (String other_element : other.sessionIDs) {
126 __this__sessionIDs.add(other_element);
127 }
128 this.sessionIDs = __this__sessionIDs;
129 }
130 if (other.isSetPacket()) {
131 this.packet = new Packet(other.packet);
132 }
133 }
134
135 public Message deepCopy() {
136 return new Message(this);
137 }
138
139 @Override
140 public void clear() {
141 this.sessionIDs = null;
142 this.packet = null;
143 }
144
145 public int getSessionIDsSize() {
146 return (this.sessionIDs == null) ? 0 : this.sessionIDs.size();
147 }
148
149 public java.util.Iterator<String> getSessionIDsIterator() {
150 return (this.sessionIDs == null) ? null : this.sessionIDs.iterator();
151 }
152
153 public void addToSessionIDs(String elem) {
154 if (this.sessionIDs == null) {
155 this.sessionIDs = new ArrayList<String>();
156 }
157 this.sessionIDs.add(elem);
158 }
159
160 public List<String> getSessionIDs() {
161 return this.sessionIDs;
162 }
163
164 public Message setSessionIDs(List<String> sessionIDs) {
165 this.sessionIDs = sessionIDs;
166 return this;
167 }
168
169 public void unsetSessionIDs() {
170 this.sessionIDs = null;
171 }
172
173 /** Returns true if field sessionIDs is set (has been assigned a value) and false otherwise */
174 public boolean isSetSessionIDs() {
175 return this.sessionIDs != null;
176 }
177
178 public void setSessionIDsIsSet(boolean value) {
179 if (!value) {
180 this.sessionIDs = null;
181 }
182 }
183
184 public Packet getPacket() {
185 return this.packet;
186 }
187
188 public Message setPacket(Packet packet) {
189 this.packet = packet;
190 return this;
191 }
192
193 public void unsetPacket() {
194 this.packet = null;
195 }
196
197 /** Returns true if field packet is set (has been assigned a value) and false otherwise */
198 public boolean isSetPacket() {
199 return this.packet != null;
200 }
201
202 public void setPacketIsSet(boolean value) {
203 if (!value) {
204 this.packet = null;
205 }
206 }
207
208 public void setFieldValue(_Fields field, Object value) {
209 switch (field) {
210 case SESSION_IDS:
211 if (value == null) {
212 unsetSessionIDs();
213 } else {
214 setSessionIDs((List<String>)value);
215 }
216 break;
217
218 case PACKET:
219 if (value == null) {
220 unsetPacket();
221 } else {
222 setPacket((Packet)value);
223 }
224 break;
225
226 }
227 }
228
229 public Object getFieldValue(_Fields field) {
230 switch (field) {
231 case SESSION_IDS:
232 return getSessionIDs();
233
234 case PACKET:
235 return getPacket();
236
237 }
238 throw new IllegalStateException();
239 }
240
241 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
242 public boolean isSet(_Fields field) {
243 if (field == null) {
244 throw new IllegalArgumentException();
245 }
246
247 switch (field) {
248 case SESSION_IDS:
249 return isSetSessionIDs();
250 case PACKET:
251 return isSetPacket();
252 }
253 throw new IllegalStateException();
254 }
255
256 @Override
257 public boolean equals(Object that) {
258 if (that == null)
259 return false;
260 if (that instanceof Message)
261 return this.equals((Message)that);
262 return false;
263 }
264
265 public boolean equals(Message that) {
266 if (that == null)
267 return false;
268
269 boolean this_present_sessionIDs = true && this.isSetSessionIDs();
270 boolean that_present_sessionIDs = true && that.isSetSessionIDs();
271 if (this_present_sessionIDs || that_present_sessionIDs) {
272 if (!(this_present_sessionIDs && that_present_sessionIDs))
273 return false;
274 if (!this.sessionIDs.equals(that.sessionIDs))
275 return false;
276 }
277
278 boolean this_present_packet = true && this.isSetPacket();
279 boolean that_present_packet = true && that.isSetPacket();
280 if (this_present_packet || that_present_packet) {
281 if (!(this_present_packet && that_present_packet))
282 return false;
283 if (!this.packet.equals(that.packet))
284 return false;
285 }
286
287 return true;
288 }
289
290 @Override
291 public int hashCode() {
292 return 0;
293 }
294
295 public int compareTo(Message other) {
296 if (!getClass().equals(other.getClass())) {
297 return getClass().getName().compareTo(other.getClass().getName());
298 }
299
300 int lastComparison = 0;
301 Message typedOther = (Message)other;
302
303 lastComparison = Boolean.valueOf(isSetSessionIDs()).compareTo(typedOther.isSetSessionIDs());
304 if (lastComparison != 0) {
305 return lastComparison;
306 }
307 if (isSetSessionIDs()) {
308 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionIDs, typedOther.sessionIDs);
309 if (lastComparison != 0) {
310 return lastComparison;
311 }
312 }
313 lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
314 if (lastComparison != 0) {
315 return lastComparison;
316 }
317 if (isSetPacket()) {
318 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
319 if (lastComparison != 0) {
320 return lastComparison;
321 }
322 }
323 return 0;
324 }
325
326 public _Fields fieldForId(int fieldId) {
327 return _Fields.findByThriftId(fieldId);
328 }
329
330 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
331 org.apache.thrift.protocol.TField field;
332 iprot.readStructBegin();
333 while (true)
334 {
335 field = iprot.readFieldBegin();
336 if (field.type == org.apache.thrift.protocol.TType.STOP) {
337 break;
338 }
339 switch (field.id) {
340 case 1: // SESSION_IDS
341 if (field.type == org.apache.thrift.protocol.TType.LIST) {
342 {
343 org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
344 this.sessionIDs = new ArrayList<String>(_list0.size);
345 for (int _i1 = 0; _i1 < _list0.size; ++_i1)
346 {
347 String _elem2; // required
348 _elem2 = iprot.readString();
349 this.sessionIDs.add(_elem2);
350 }
351 iprot.readListEnd();
352 }
353 } else {
354 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
355 }
356 break;
357 case 2: // PACKET
358 if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
359 this.packet = new Packet();
360 this.packet.read(iprot);
361 } else {
362 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
363 }
364 break;
365 default:
366 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
367 }
368 iprot.readFieldEnd();
369 }
370 iprot.readStructEnd();
371
372 // check for required fields of primitive type, which can't be checked in the validate method
373 validate();
374 }
375
376 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
377 validate();
378
379 oprot.writeStructBegin(STRUCT_DESC);
380 if (this.sessionIDs != null) {
381 oprot.writeFieldBegin(SESSION_IDS_FIELD_DESC);
382 {
383 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.sessionIDs.size()));
384 for (String _iter3 : this.sessionIDs)
385 {
386 oprot.writeString(_iter3);
387 }
388 oprot.writeListEnd();
389 }
390 oprot.writeFieldEnd();
391 }
392 if (this.packet != null) {
393 oprot.writeFieldBegin(PACKET_FIELD_DESC);
394 this.packet.write(oprot);
395 oprot.writeFieldEnd();
396 }
397 oprot.writeFieldStop();
398 oprot.writeStructEnd();
399 }
400
401 @Override
402 public String toString() {
403 StringBuilder sb = new StringBuilder("Message(");
404 boolean first = true;
405
406 sb.append("sessionIDs:");
407 if (this.sessionIDs == null) {
408 sb.append("null");
409 } else {
410 sb.append(this.sessionIDs);
411 }
412 first = false;
413 if (!first) sb.append(", ");
414 sb.append("packet:");
415 if (this.packet == null) {
416 sb.append("null");
417 } else {
418 sb.append(this.packet);
419 }
420 first = false;
421 sb.append(")");
422 return sb.toString();
423 }
424
425 public void validate() throws org.apache.thrift.TException {
426 // check for required fields
427 }
428
429 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
430 try {
431 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
432 } catch (org.apache.thrift.TException te) {
433 throw new java.io.IOException(te);
434 }
435 }
436
437 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
438 try {
439 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
440 } catch (org.apache.thrift.TException te) {
441 throw new java.io.IOException(te);
442 }
443 }
444
445}
446