Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
412 ashish 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
412 ashish 3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.logistics;
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;
412 ashish 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class Provider implements org.apache.thrift.TBase<Provider, Provider._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Provider");
412 ashish 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
7792 anupam.sin 28
  private static final org.apache.thrift.protocol.TField DETAILS_FIELD_DESC = new org.apache.thrift.protocol.TField("details", org.apache.thrift.protocol.TType.LIST, (short)3);
5527 anupam.sin 29
  private static final org.apache.thrift.protocol.TField PICKUP_FIELD_DESC = new org.apache.thrift.protocol.TField("pickup", org.apache.thrift.protocol.TType.I32, (short)4);
412 ashish 30
 
3430 rajveer 31
  private long id; // required
32
  private String name; // required
7792 anupam.sin 33
  private List<ProviderDetails> details; // required
5527 anupam.sin 34
  private PickUpType pickup; // required
412 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 {
412 ashish 38
    ID((short)1, "id"),
668 chandransh 39
    NAME((short)2, "name"),
5527 anupam.sin 40
    DETAILS((short)3, "details"),
41
    /**
42
     * 
43
     * @see PickUpType
44
     */
45
    PICKUP((short)4, "pickup");
412 ashish 46
 
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byName.put(field.getFieldName(), field);
52
      }
53
    }
54
 
55
    /**
56
     * Find the _Fields constant that matches fieldId, or null if its not found.
57
     */
58
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 59
      switch(fieldId) {
60
        case 1: // ID
61
          return ID;
62
        case 2: // NAME
63
          return NAME;
64
        case 3: // DETAILS
65
          return DETAILS;
5527 anupam.sin 66
        case 4: // PICKUP
67
          return PICKUP;
3430 rajveer 68
        default:
69
          return null;
70
      }
412 ashish 71
    }
72
 
73
    /**
74
     * Find the _Fields constant that matches fieldId, throwing an exception
75
     * if it is not found.
76
     */
77
    public static _Fields findByThriftIdOrThrow(int fieldId) {
78
      _Fields fields = findByThriftId(fieldId);
79
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
80
      return fields;
81
    }
82
 
83
    /**
84
     * Find the _Fields constant that matches name, or null if its not found.
85
     */
86
    public static _Fields findByName(String name) {
87
      return byName.get(name);
88
    }
89
 
90
    private final short _thriftId;
91
    private final String _fieldName;
92
 
93
    _Fields(short thriftId, String fieldName) {
94
      _thriftId = thriftId;
95
      _fieldName = fieldName;
96
    }
97
 
98
    public short getThriftFieldId() {
99
      return _thriftId;
100
    }
101
 
102
    public String getFieldName() {
103
      return _fieldName;
104
    }
105
  }
106
 
107
  // isset id assignments
108
  private static final int __ID_ISSET_ID = 0;
109
  private BitSet __isset_bit_vector = new BitSet(1);
110
 
3430 rajveer 111
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
412 ashish 112
  static {
3430 rajveer 113
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
114
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
116
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
118
    tmpMap.put(_Fields.DETAILS, new org.apache.thrift.meta_data.FieldMetaData("details", org.apache.thrift.TFieldRequirementType.DEFAULT, 
7792 anupam.sin 119
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
3430 rajveer 120
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ProviderDetails.class))));
5527 anupam.sin 121
    tmpMap.put(_Fields.PICKUP, new org.apache.thrift.meta_data.FieldMetaData("pickup", org.apache.thrift.TFieldRequirementType.DEFAULT, 
122
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PickUpType.class)));
3430 rajveer 123
    metaDataMap = Collections.unmodifiableMap(tmpMap);
124
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
412 ashish 125
  }
126
 
127
  public Provider() {
128
  }
129
 
130
  public Provider(
131
    long id,
668 chandransh 132
    String name,
7792 anupam.sin 133
    List<ProviderDetails> details,
5527 anupam.sin 134
    PickUpType pickup)
412 ashish 135
  {
136
    this();
137
    this.id = id;
138
    setIdIsSet(true);
139
    this.name = name;
3044 chandransh 140
    this.details = details;
5527 anupam.sin 141
    this.pickup = pickup;
412 ashish 142
  }
143
 
144
  /**
145
   * Performs a deep copy on <i>other</i>.
146
   */
147
  public Provider(Provider other) {
148
    __isset_bit_vector.clear();
149
    __isset_bit_vector.or(other.__isset_bit_vector);
150
    this.id = other.id;
151
    if (other.isSetName()) {
152
      this.name = other.name;
153
    }
3044 chandransh 154
    if (other.isSetDetails()) {
7792 anupam.sin 155
      List<ProviderDetails> __this__details = new ArrayList<ProviderDetails>();
156
      for (ProviderDetails other_element : other.details) {
157
        __this__details.add(new ProviderDetails(other_element));
3044 chandransh 158
      }
159
      this.details = __this__details;
668 chandransh 160
    }
5527 anupam.sin 161
    if (other.isSetPickup()) {
162
      this.pickup = other.pickup;
163
    }
412 ashish 164
  }
165
 
166
  public Provider deepCopy() {
167
    return new Provider(this);
168
  }
169
 
3430 rajveer 170
  @Override
171
  public void clear() {
172
    setIdIsSet(false);
173
    this.id = 0;
174
    this.name = null;
175
    this.details = null;
5527 anupam.sin 176
    this.pickup = null;
412 ashish 177
  }
178
 
179
  public long getId() {
180
    return this.id;
181
  }
182
 
3430 rajveer 183
  public void setId(long id) {
412 ashish 184
    this.id = id;
185
    setIdIsSet(true);
186
  }
187
 
188
  public void unsetId() {
189
    __isset_bit_vector.clear(__ID_ISSET_ID);
190
  }
191
 
3430 rajveer 192
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
412 ashish 193
  public boolean isSetId() {
194
    return __isset_bit_vector.get(__ID_ISSET_ID);
195
  }
196
 
197
  public void setIdIsSet(boolean value) {
198
    __isset_bit_vector.set(__ID_ISSET_ID, value);
199
  }
200
 
201
  public String getName() {
202
    return this.name;
203
  }
204
 
3430 rajveer 205
  public void setName(String name) {
412 ashish 206
    this.name = name;
207
  }
208
 
209
  public void unsetName() {
210
    this.name = null;
211
  }
212
 
3430 rajveer 213
  /** Returns true if field name is set (has been assigned a value) and false otherwise */
412 ashish 214
  public boolean isSetName() {
215
    return this.name != null;
216
  }
217
 
218
  public void setNameIsSet(boolean value) {
219
    if (!value) {
220
      this.name = null;
221
    }
222
  }
223
 
3044 chandransh 224
  public int getDetailsSize() {
225
    return (this.details == null) ? 0 : this.details.size();
668 chandransh 226
  }
227
 
7792 anupam.sin 228
  public java.util.Iterator<ProviderDetails> getDetailsIterator() {
229
    return (this.details == null) ? null : this.details.iterator();
230
  }
231
 
232
  public void addToDetails(ProviderDetails elem) {
3044 chandransh 233
    if (this.details == null) {
7792 anupam.sin 234
      this.details = new ArrayList<ProviderDetails>();
668 chandransh 235
    }
7792 anupam.sin 236
    this.details.add(elem);
668 chandransh 237
  }
238
 
7792 anupam.sin 239
  public List<ProviderDetails> getDetails() {
3044 chandransh 240
    return this.details;
2515 chandransh 241
  }
242
 
7792 anupam.sin 243
  public void setDetails(List<ProviderDetails> details) {
3044 chandransh 244
    this.details = details;
2515 chandransh 245
  }
246
 
3044 chandransh 247
  public void unsetDetails() {
248
    this.details = null;
2515 chandransh 249
  }
250
 
3430 rajveer 251
  /** Returns true if field details is set (has been assigned a value) and false otherwise */
3044 chandransh 252
  public boolean isSetDetails() {
253
    return this.details != null;
2515 chandransh 254
  }
255
 
3044 chandransh 256
  public void setDetailsIsSet(boolean value) {
2515 chandransh 257
    if (!value) {
3044 chandransh 258
      this.details = null;
2515 chandransh 259
    }
260
  }
261
 
5527 anupam.sin 262
  /**
263
   * 
264
   * @see PickUpType
265
   */
266
  public PickUpType getPickup() {
267
    return this.pickup;
268
  }
269
 
270
  /**
271
   * 
272
   * @see PickUpType
273
   */
274
  public void setPickup(PickUpType pickup) {
275
    this.pickup = pickup;
276
  }
277
 
278
  public void unsetPickup() {
279
    this.pickup = null;
280
  }
281
 
282
  /** Returns true if field pickup is set (has been assigned a value) and false otherwise */
283
  public boolean isSetPickup() {
284
    return this.pickup != null;
285
  }
286
 
287
  public void setPickupIsSet(boolean value) {
288
    if (!value) {
289
      this.pickup = null;
290
    }
291
  }
292
 
412 ashish 293
  public void setFieldValue(_Fields field, Object value) {
294
    switch (field) {
295
    case ID:
296
      if (value == null) {
297
        unsetId();
298
      } else {
299
        setId((Long)value);
300
      }
301
      break;
302
 
303
    case NAME:
304
      if (value == null) {
305
        unsetName();
306
      } else {
307
        setName((String)value);
308
      }
309
      break;
310
 
3044 chandransh 311
    case DETAILS:
668 chandransh 312
      if (value == null) {
3044 chandransh 313
        unsetDetails();
668 chandransh 314
      } else {
7792 anupam.sin 315
        setDetails((List<ProviderDetails>)value);
668 chandransh 316
      }
317
      break;
318
 
5527 anupam.sin 319
    case PICKUP:
320
      if (value == null) {
321
        unsetPickup();
322
      } else {
323
        setPickup((PickUpType)value);
324
      }
325
      break;
326
 
412 ashish 327
    }
328
  }
329
 
330
  public Object getFieldValue(_Fields field) {
331
    switch (field) {
332
    case ID:
3430 rajveer 333
      return Long.valueOf(getId());
412 ashish 334
 
335
    case NAME:
336
      return getName();
337
 
3044 chandransh 338
    case DETAILS:
339
      return getDetails();
668 chandransh 340
 
5527 anupam.sin 341
    case PICKUP:
342
      return getPickup();
343
 
412 ashish 344
    }
345
    throw new IllegalStateException();
346
  }
347
 
3430 rajveer 348
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
349
  public boolean isSet(_Fields field) {
350
    if (field == null) {
351
      throw new IllegalArgumentException();
352
    }
412 ashish 353
 
354
    switch (field) {
355
    case ID:
356
      return isSetId();
357
    case NAME:
358
      return isSetName();
3044 chandransh 359
    case DETAILS:
360
      return isSetDetails();
5527 anupam.sin 361
    case PICKUP:
362
      return isSetPickup();
412 ashish 363
    }
364
    throw new IllegalStateException();
365
  }
366
 
367
  @Override
368
  public boolean equals(Object that) {
369
    if (that == null)
370
      return false;
371
    if (that instanceof Provider)
372
      return this.equals((Provider)that);
373
    return false;
374
  }
375
 
376
  public boolean equals(Provider that) {
377
    if (that == null)
378
      return false;
379
 
380
    boolean this_present_id = true;
381
    boolean that_present_id = true;
382
    if (this_present_id || that_present_id) {
383
      if (!(this_present_id && that_present_id))
384
        return false;
385
      if (this.id != that.id)
386
        return false;
387
    }
388
 
389
    boolean this_present_name = true && this.isSetName();
390
    boolean that_present_name = true && that.isSetName();
391
    if (this_present_name || that_present_name) {
392
      if (!(this_present_name && that_present_name))
393
        return false;
394
      if (!this.name.equals(that.name))
395
        return false;
396
    }
397
 
3044 chandransh 398
    boolean this_present_details = true && this.isSetDetails();
399
    boolean that_present_details = true && that.isSetDetails();
400
    if (this_present_details || that_present_details) {
401
      if (!(this_present_details && that_present_details))
668 chandransh 402
        return false;
3044 chandransh 403
      if (!this.details.equals(that.details))
668 chandransh 404
        return false;
405
    }
406
 
5527 anupam.sin 407
    boolean this_present_pickup = true && this.isSetPickup();
408
    boolean that_present_pickup = true && that.isSetPickup();
409
    if (this_present_pickup || that_present_pickup) {
410
      if (!(this_present_pickup && that_present_pickup))
411
        return false;
412
      if (!this.pickup.equals(that.pickup))
413
        return false;
414
    }
415
 
412 ashish 416
    return true;
417
  }
418
 
419
  @Override
420
  public int hashCode() {
421
    return 0;
422
  }
423
 
3430 rajveer 424
  public int compareTo(Provider other) {
425
    if (!getClass().equals(other.getClass())) {
426
      return getClass().getName().compareTo(other.getClass().getName());
427
    }
428
 
429
    int lastComparison = 0;
430
    Provider typedOther = (Provider)other;
431
 
432
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
433
    if (lastComparison != 0) {
434
      return lastComparison;
435
    }
436
    if (isSetId()) {
437
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
438
      if (lastComparison != 0) {
439
        return lastComparison;
440
      }
441
    }
442
    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
443
    if (lastComparison != 0) {
444
      return lastComparison;
445
    }
446
    if (isSetName()) {
447
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
448
      if (lastComparison != 0) {
449
        return lastComparison;
450
      }
451
    }
452
    lastComparison = Boolean.valueOf(isSetDetails()).compareTo(typedOther.isSetDetails());
453
    if (lastComparison != 0) {
454
      return lastComparison;
455
    }
456
    if (isSetDetails()) {
457
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.details, typedOther.details);
458
      if (lastComparison != 0) {
459
        return lastComparison;
460
      }
461
    }
5527 anupam.sin 462
    lastComparison = Boolean.valueOf(isSetPickup()).compareTo(typedOther.isSetPickup());
463
    if (lastComparison != 0) {
464
      return lastComparison;
465
    }
466
    if (isSetPickup()) {
467
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pickup, typedOther.pickup);
468
      if (lastComparison != 0) {
469
        return lastComparison;
470
      }
471
    }
3430 rajveer 472
    return 0;
473
  }
474
 
475
  public _Fields fieldForId(int fieldId) {
476
    return _Fields.findByThriftId(fieldId);
477
  }
478
 
479
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
480
    org.apache.thrift.protocol.TField field;
412 ashish 481
    iprot.readStructBegin();
482
    while (true)
483
    {
484
      field = iprot.readFieldBegin();
3430 rajveer 485
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
412 ashish 486
        break;
487
      }
3430 rajveer 488
      switch (field.id) {
489
        case 1: // ID
490
          if (field.type == org.apache.thrift.protocol.TType.I64) {
491
            this.id = iprot.readI64();
492
            setIdIsSet(true);
493
          } else { 
494
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
495
          }
496
          break;
497
        case 2: // NAME
498
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
499
            this.name = iprot.readString();
500
          } else { 
501
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
502
          }
503
          break;
504
        case 3: // DETAILS
7792 anupam.sin 505
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
3430 rajveer 506
            {
7792 anupam.sin 507
              org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
508
              this.details = new ArrayList<ProviderDetails>(_list0.size);
509
              for (int _i1 = 0; _i1 < _list0.size; ++_i1)
3044 chandransh 510
              {
7792 anupam.sin 511
                ProviderDetails _elem2; // required
512
                _elem2 = new ProviderDetails();
513
                _elem2.read(iprot);
514
                this.details.add(_elem2);
3044 chandransh 515
              }
7792 anupam.sin 516
              iprot.readListEnd();
668 chandransh 517
            }
3430 rajveer 518
          } else { 
519
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
520
          }
521
          break;
5527 anupam.sin 522
        case 4: // PICKUP
523
          if (field.type == org.apache.thrift.protocol.TType.I32) {
524
            this.pickup = PickUpType.findByValue(iprot.readI32());
525
          } else { 
526
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
527
          }
528
          break;
3430 rajveer 529
        default:
530
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
412 ashish 531
      }
3430 rajveer 532
      iprot.readFieldEnd();
412 ashish 533
    }
534
    iprot.readStructEnd();
535
    validate();
536
  }
537
 
3430 rajveer 538
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
412 ashish 539
    validate();
540
 
541
    oprot.writeStructBegin(STRUCT_DESC);
542
    oprot.writeFieldBegin(ID_FIELD_DESC);
543
    oprot.writeI64(this.id);
544
    oprot.writeFieldEnd();
545
    if (this.name != null) {
546
      oprot.writeFieldBegin(NAME_FIELD_DESC);
547
      oprot.writeString(this.name);
548
      oprot.writeFieldEnd();
549
    }
3044 chandransh 550
    if (this.details != null) {
551
      oprot.writeFieldBegin(DETAILS_FIELD_DESC);
552
      {
7792 anupam.sin 553
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.details.size()));
554
        for (ProviderDetails _iter3 : this.details)
3044 chandransh 555
        {
7792 anupam.sin 556
          _iter3.write(oprot);
3044 chandransh 557
        }
7792 anupam.sin 558
        oprot.writeListEnd();
3044 chandransh 559
      }
668 chandransh 560
      oprot.writeFieldEnd();
561
    }
5527 anupam.sin 562
    if (this.pickup != null) {
563
      oprot.writeFieldBegin(PICKUP_FIELD_DESC);
564
      oprot.writeI32(this.pickup.getValue());
565
      oprot.writeFieldEnd();
566
    }
412 ashish 567
    oprot.writeFieldStop();
568
    oprot.writeStructEnd();
569
  }
570
 
571
  @Override
572
  public String toString() {
573
    StringBuilder sb = new StringBuilder("Provider(");
574
    boolean first = true;
575
 
576
    sb.append("id:");
577
    sb.append(this.id);
578
    first = false;
579
    if (!first) sb.append(", ");
580
    sb.append("name:");
581
    if (this.name == null) {
582
      sb.append("null");
583
    } else {
584
      sb.append(this.name);
585
    }
586
    first = false;
668 chandransh 587
    if (!first) sb.append(", ");
3044 chandransh 588
    sb.append("details:");
589
    if (this.details == null) {
668 chandransh 590
      sb.append("null");
591
    } else {
3044 chandransh 592
      sb.append(this.details);
668 chandransh 593
    }
594
    first = false;
5527 anupam.sin 595
    if (!first) sb.append(", ");
596
    sb.append("pickup:");
597
    if (this.pickup == null) {
598
      sb.append("null");
599
    } else {
600
      sb.append(this.pickup);
601
    }
602
    first = false;
412 ashish 603
    sb.append(")");
604
    return sb.toString();
605
  }
606
 
3430 rajveer 607
  public void validate() throws org.apache.thrift.TException {
412 ashish 608
    // check for required fields
609
  }
610
 
3430 rajveer 611
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
612
    try {
613
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
614
    } catch (org.apache.thrift.TException te) {
615
      throw new java.io.IOException(te);
616
    }
617
  }
618
 
619
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
620
    try {
621
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
622
      __isset_bit_vector = new BitSet(1);
623
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
624
    } catch (org.apache.thrift.TException te) {
625
      throw new java.io.IOException(te);
626
    }
627
  }
628
 
412 ashish 629
}
630