Subversion Repositories SmartDukaan

Rev

Rev 1013 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
352 ashish 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
352 ashish 3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.utils;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
3430 rajveer 18
import java.nio.ByteBuffer;
352 ashish 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class TextMessage implements org.apache.thrift.TBase<TextMessage, TextMessage._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TextMessage");
352 ashish 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.STRING, (short)1);
27
  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField DISPATCH_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dispatchTime", org.apache.thrift.protocol.TType.I64, (short)3);
29
  private static final org.apache.thrift.protocol.TField DELIVERY_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("deliveryTime", org.apache.thrift.protocol.TType.I64, (short)4);
352 ashish 30
 
3430 rajveer 31
  private String number; // required
32
  private String message; // required
33
  private long dispatchTime; // required
34
  private long deliveryTime; // required
352 ashish 35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
352 ashish 38
    NUMBER((short)1, "number"),
39
    MESSAGE((short)2, "message"),
40
    DISPATCH_TIME((short)3, "dispatchTime"),
41
    DELIVERY_TIME((short)4, "deliveryTime");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 55
      switch(fieldId) {
56
        case 1: // NUMBER
57
          return NUMBER;
58
        case 2: // MESSAGE
59
          return MESSAGE;
60
        case 3: // DISPATCH_TIME
61
          return DISPATCH_TIME;
62
        case 4: // DELIVERY_TIME
63
          return DELIVERY_TIME;
64
        default:
65
          return null;
66
      }
352 ashish 67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __DISPATCHTIME_ISSET_ID = 0;
105
  private static final int __DELIVERYTIME_ISSET_ID = 1;
106
  private BitSet __isset_bit_vector = new BitSet(2);
107
 
3430 rajveer 108
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
352 ashish 109
  static {
3430 rajveer 110
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
111
    tmpMap.put(_Fields.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, 
112
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
113
    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, 
114
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
115
    tmpMap.put(_Fields.DISPATCH_TIME, new org.apache.thrift.meta_data.FieldMetaData("dispatchTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
116
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
117
    tmpMap.put(_Fields.DELIVERY_TIME, new org.apache.thrift.meta_data.FieldMetaData("deliveryTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
118
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
119
    metaDataMap = Collections.unmodifiableMap(tmpMap);
120
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TextMessage.class, metaDataMap);
352 ashish 121
  }
122
 
123
  public TextMessage() {
124
  }
125
 
126
  public TextMessage(
127
    String number,
128
    String message,
129
    long dispatchTime,
130
    long deliveryTime)
131
  {
132
    this();
133
    this.number = number;
134
    this.message = message;
135
    this.dispatchTime = dispatchTime;
136
    setDispatchTimeIsSet(true);
137
    this.deliveryTime = deliveryTime;
138
    setDeliveryTimeIsSet(true);
139
  }
140
 
141
  /**
142
   * Performs a deep copy on <i>other</i>.
143
   */
144
  public TextMessage(TextMessage other) {
145
    __isset_bit_vector.clear();
146
    __isset_bit_vector.or(other.__isset_bit_vector);
147
    if (other.isSetNumber()) {
148
      this.number = other.number;
149
    }
150
    if (other.isSetMessage()) {
151
      this.message = other.message;
152
    }
153
    this.dispatchTime = other.dispatchTime;
154
    this.deliveryTime = other.deliveryTime;
155
  }
156
 
157
  public TextMessage deepCopy() {
158
    return new TextMessage(this);
159
  }
160
 
3430 rajveer 161
  @Override
162
  public void clear() {
163
    this.number = null;
164
    this.message = null;
165
    setDispatchTimeIsSet(false);
166
    this.dispatchTime = 0;
167
    setDeliveryTimeIsSet(false);
168
    this.deliveryTime = 0;
352 ashish 169
  }
170
 
171
  public String getNumber() {
172
    return this.number;
173
  }
174
 
3430 rajveer 175
  public void setNumber(String number) {
352 ashish 176
    this.number = number;
177
  }
178
 
179
  public void unsetNumber() {
180
    this.number = null;
181
  }
182
 
3430 rajveer 183
  /** Returns true if field number is set (has been assigned a value) and false otherwise */
352 ashish 184
  public boolean isSetNumber() {
185
    return this.number != null;
186
  }
187
 
188
  public void setNumberIsSet(boolean value) {
189
    if (!value) {
190
      this.number = null;
191
    }
192
  }
193
 
194
  public String getMessage() {
195
    return this.message;
196
  }
197
 
3430 rajveer 198
  public void setMessage(String message) {
352 ashish 199
    this.message = message;
200
  }
201
 
202
  public void unsetMessage() {
203
    this.message = null;
204
  }
205
 
3430 rajveer 206
  /** Returns true if field message is set (has been assigned a value) and false otherwise */
352 ashish 207
  public boolean isSetMessage() {
208
    return this.message != null;
209
  }
210
 
211
  public void setMessageIsSet(boolean value) {
212
    if (!value) {
213
      this.message = null;
214
    }
215
  }
216
 
217
  public long getDispatchTime() {
218
    return this.dispatchTime;
219
  }
220
 
3430 rajveer 221
  public void setDispatchTime(long dispatchTime) {
352 ashish 222
    this.dispatchTime = dispatchTime;
223
    setDispatchTimeIsSet(true);
224
  }
225
 
226
  public void unsetDispatchTime() {
227
    __isset_bit_vector.clear(__DISPATCHTIME_ISSET_ID);
228
  }
229
 
3430 rajveer 230
  /** Returns true if field dispatchTime is set (has been assigned a value) and false otherwise */
352 ashish 231
  public boolean isSetDispatchTime() {
232
    return __isset_bit_vector.get(__DISPATCHTIME_ISSET_ID);
233
  }
234
 
235
  public void setDispatchTimeIsSet(boolean value) {
236
    __isset_bit_vector.set(__DISPATCHTIME_ISSET_ID, value);
237
  }
238
 
239
  public long getDeliveryTime() {
240
    return this.deliveryTime;
241
  }
242
 
3430 rajveer 243
  public void setDeliveryTime(long deliveryTime) {
352 ashish 244
    this.deliveryTime = deliveryTime;
245
    setDeliveryTimeIsSet(true);
246
  }
247
 
248
  public void unsetDeliveryTime() {
249
    __isset_bit_vector.clear(__DELIVERYTIME_ISSET_ID);
250
  }
251
 
3430 rajveer 252
  /** Returns true if field deliveryTime is set (has been assigned a value) and false otherwise */
352 ashish 253
  public boolean isSetDeliveryTime() {
254
    return __isset_bit_vector.get(__DELIVERYTIME_ISSET_ID);
255
  }
256
 
257
  public void setDeliveryTimeIsSet(boolean value) {
258
    __isset_bit_vector.set(__DELIVERYTIME_ISSET_ID, value);
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case NUMBER:
264
      if (value == null) {
265
        unsetNumber();
266
      } else {
267
        setNumber((String)value);
268
      }
269
      break;
270
 
271
    case MESSAGE:
272
      if (value == null) {
273
        unsetMessage();
274
      } else {
275
        setMessage((String)value);
276
      }
277
      break;
278
 
279
    case DISPATCH_TIME:
280
      if (value == null) {
281
        unsetDispatchTime();
282
      } else {
283
        setDispatchTime((Long)value);
284
      }
285
      break;
286
 
287
    case DELIVERY_TIME:
288
      if (value == null) {
289
        unsetDeliveryTime();
290
      } else {
291
        setDeliveryTime((Long)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case NUMBER:
301
      return getNumber();
302
 
303
    case MESSAGE:
304
      return getMessage();
305
 
306
    case DISPATCH_TIME:
3430 rajveer 307
      return Long.valueOf(getDispatchTime());
352 ashish 308
 
309
    case DELIVERY_TIME:
3430 rajveer 310
      return Long.valueOf(getDeliveryTime());
352 ashish 311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
3430 rajveer 316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
352 ashish 321
 
322
    switch (field) {
323
    case NUMBER:
324
      return isSetNumber();
325
    case MESSAGE:
326
      return isSetMessage();
327
    case DISPATCH_TIME:
328
      return isSetDispatchTime();
329
    case DELIVERY_TIME:
330
      return isSetDeliveryTime();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof TextMessage)
340
      return this.equals((TextMessage)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(TextMessage that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_number = true && this.isSetNumber();
349
    boolean that_present_number = true && that.isSetNumber();
350
    if (this_present_number || that_present_number) {
351
      if (!(this_present_number && that_present_number))
352
        return false;
353
      if (!this.number.equals(that.number))
354
        return false;
355
    }
356
 
357
    boolean this_present_message = true && this.isSetMessage();
358
    boolean that_present_message = true && that.isSetMessage();
359
    if (this_present_message || that_present_message) {
360
      if (!(this_present_message && that_present_message))
361
        return false;
362
      if (!this.message.equals(that.message))
363
        return false;
364
    }
365
 
366
    boolean this_present_dispatchTime = true;
367
    boolean that_present_dispatchTime = true;
368
    if (this_present_dispatchTime || that_present_dispatchTime) {
369
      if (!(this_present_dispatchTime && that_present_dispatchTime))
370
        return false;
371
      if (this.dispatchTime != that.dispatchTime)
372
        return false;
373
    }
374
 
375
    boolean this_present_deliveryTime = true;
376
    boolean that_present_deliveryTime = true;
377
    if (this_present_deliveryTime || that_present_deliveryTime) {
378
      if (!(this_present_deliveryTime && that_present_deliveryTime))
379
        return false;
380
      if (this.deliveryTime != that.deliveryTime)
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(TextMessage other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    TextMessage typedOther = (TextMessage)other;
399
 
3430 rajveer 400
    lastComparison = Boolean.valueOf(isSetNumber()).compareTo(typedOther.isSetNumber());
352 ashish 401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
3430 rajveer 404
    if (isSetNumber()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, typedOther.number);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
352 ashish 409
    }
3430 rajveer 410
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
352 ashish 411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
3430 rajveer 414
    if (isSetMessage()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
352 ashish 419
    }
3430 rajveer 420
    lastComparison = Boolean.valueOf(isSetDispatchTime()).compareTo(typedOther.isSetDispatchTime());
352 ashish 421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
3430 rajveer 424
    if (isSetDispatchTime()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dispatchTime, typedOther.dispatchTime);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
352 ashish 429
    }
3430 rajveer 430
    lastComparison = Boolean.valueOf(isSetDeliveryTime()).compareTo(typedOther.isSetDeliveryTime());
352 ashish 431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
3430 rajveer 434
    if (isSetDeliveryTime()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deliveryTime, typedOther.deliveryTime);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
352 ashish 439
    }
440
    return 0;
441
  }
442
 
3430 rajveer 443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
352 ashish 449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
3430 rajveer 453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
352 ashish 454
        break;
455
      }
3430 rajveer 456
      switch (field.id) {
457
        case 1: // NUMBER
458
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
459
            this.number = iprot.readString();
460
          } else { 
461
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
462
          }
463
          break;
464
        case 2: // MESSAGE
465
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
466
            this.message = iprot.readString();
467
          } else { 
468
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
469
          }
470
          break;
471
        case 3: // DISPATCH_TIME
472
          if (field.type == org.apache.thrift.protocol.TType.I64) {
473
            this.dispatchTime = iprot.readI64();
474
            setDispatchTimeIsSet(true);
475
          } else { 
476
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
477
          }
478
          break;
479
        case 4: // DELIVERY_TIME
480
          if (field.type == org.apache.thrift.protocol.TType.I64) {
481
            this.deliveryTime = iprot.readI64();
482
            setDeliveryTimeIsSet(true);
483
          } else { 
484
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
485
          }
486
          break;
487
        default:
488
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
352 ashish 489
      }
3430 rajveer 490
      iprot.readFieldEnd();
352 ashish 491
    }
492
    iprot.readStructEnd();
493
    validate();
494
  }
495
 
3430 rajveer 496
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
352 ashish 497
    validate();
498
 
499
    oprot.writeStructBegin(STRUCT_DESC);
500
    if (this.number != null) {
501
      oprot.writeFieldBegin(NUMBER_FIELD_DESC);
502
      oprot.writeString(this.number);
503
      oprot.writeFieldEnd();
504
    }
505
    if (this.message != null) {
506
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
507
      oprot.writeString(this.message);
508
      oprot.writeFieldEnd();
509
    }
510
    oprot.writeFieldBegin(DISPATCH_TIME_FIELD_DESC);
511
    oprot.writeI64(this.dispatchTime);
512
    oprot.writeFieldEnd();
513
    oprot.writeFieldBegin(DELIVERY_TIME_FIELD_DESC);
514
    oprot.writeI64(this.deliveryTime);
515
    oprot.writeFieldEnd();
516
    oprot.writeFieldStop();
517
    oprot.writeStructEnd();
518
  }
519
 
520
  @Override
521
  public String toString() {
522
    StringBuilder sb = new StringBuilder("TextMessage(");
523
    boolean first = true;
524
 
525
    sb.append("number:");
526
    if (this.number == null) {
527
      sb.append("null");
528
    } else {
529
      sb.append(this.number);
530
    }
531
    first = false;
532
    if (!first) sb.append(", ");
533
    sb.append("message:");
534
    if (this.message == null) {
535
      sb.append("null");
536
    } else {
537
      sb.append(this.message);
538
    }
539
    first = false;
540
    if (!first) sb.append(", ");
541
    sb.append("dispatchTime:");
542
    sb.append(this.dispatchTime);
543
    first = false;
544
    if (!first) sb.append(", ");
545
    sb.append("deliveryTime:");
546
    sb.append(this.deliveryTime);
547
    first = false;
548
    sb.append(")");
549
    return sb.toString();
550
  }
551
 
3430 rajveer 552
  public void validate() throws org.apache.thrift.TException {
352 ashish 553
    // check for required fields
554
  }
555
 
3430 rajveer 556
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
557
    try {
558
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
559
    } catch (org.apache.thrift.TException te) {
560
      throw new java.io.IOException(te);
561
    }
562
  }
563
 
564
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
565
    try {
566
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
567
      __isset_bit_vector = new BitSet(1);
568
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
569
    } catch (org.apache.thrift.TException te) {
570
      throw new java.io.IOException(te);
571
    }
572
  }
573
 
352 ashish 574
}
575