Subversion Repositories SmartDukaan

Rev

Rev 352 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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