Subversion Repositories SmartDukaan

Rev

Rev 3044 | 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);
28
  private static final org.apache.thrift.protocol.TField DETAILS_FIELD_DESC = new org.apache.thrift.protocol.TField("details", org.apache.thrift.protocol.TType.MAP, (short)3);
412 ashish 29
 
3430 rajveer 30
  private long id; // required
31
  private String name; // required
32
  private Map<DeliveryType,ProviderDetails> details; // required
412 ashish 33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
412 ashish 36
    ID((short)1, "id"),
668 chandransh 37
    NAME((short)2, "name"),
3044 chandransh 38
    DETAILS((short)3, "details");
412 ashish 39
 
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
 
42
    static {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
44
        byName.put(field.getFieldName(), field);
45
      }
46
    }
47
 
48
    /**
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
50
     */
51
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 52
      switch(fieldId) {
53
        case 1: // ID
54
          return ID;
55
        case 2: // NAME
56
          return NAME;
57
        case 3: // DETAILS
58
          return DETAILS;
59
        default:
60
          return null;
61
      }
412 ashish 62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches fieldId, throwing an exception
66
     * if it is not found.
67
     */
68
    public static _Fields findByThriftIdOrThrow(int fieldId) {
69
      _Fields fields = findByThriftId(fieldId);
70
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
71
      return fields;
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches name, or null if its not found.
76
     */
77
    public static _Fields findByName(String name) {
78
      return byName.get(name);
79
    }
80
 
81
    private final short _thriftId;
82
    private final String _fieldName;
83
 
84
    _Fields(short thriftId, String fieldName) {
85
      _thriftId = thriftId;
86
      _fieldName = fieldName;
87
    }
88
 
89
    public short getThriftFieldId() {
90
      return _thriftId;
91
    }
92
 
93
    public String getFieldName() {
94
      return _fieldName;
95
    }
96
  }
97
 
98
  // isset id assignments
99
  private static final int __ID_ISSET_ID = 0;
100
  private BitSet __isset_bit_vector = new BitSet(1);
101
 
3430 rajveer 102
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
412 ashish 103
  static {
3430 rajveer 104
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
105
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
106
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
107
    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
109
    tmpMap.put(_Fields.DETAILS, new org.apache.thrift.meta_data.FieldMetaData("details", org.apache.thrift.TFieldRequirementType.DEFAULT, 
110
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
111
            new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DeliveryType.class), 
112
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ProviderDetails.class))));
113
    metaDataMap = Collections.unmodifiableMap(tmpMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
412 ashish 115
  }
116
 
117
  public Provider() {
118
  }
119
 
120
  public Provider(
121
    long id,
668 chandransh 122
    String name,
3044 chandransh 123
    Map<DeliveryType,ProviderDetails> details)
412 ashish 124
  {
125
    this();
126
    this.id = id;
127
    setIdIsSet(true);
128
    this.name = name;
3044 chandransh 129
    this.details = details;
412 ashish 130
  }
131
 
132
  /**
133
   * Performs a deep copy on <i>other</i>.
134
   */
135
  public Provider(Provider other) {
136
    __isset_bit_vector.clear();
137
    __isset_bit_vector.or(other.__isset_bit_vector);
138
    this.id = other.id;
139
    if (other.isSetName()) {
140
      this.name = other.name;
141
    }
3044 chandransh 142
    if (other.isSetDetails()) {
143
      Map<DeliveryType,ProviderDetails> __this__details = new HashMap<DeliveryType,ProviderDetails>();
144
      for (Map.Entry<DeliveryType, ProviderDetails> other_element : other.details.entrySet()) {
145
 
146
        DeliveryType other_element_key = other_element.getKey();
147
        ProviderDetails other_element_value = other_element.getValue();
148
 
149
        DeliveryType __this__details_copy_key = other_element_key;
150
 
151
        ProviderDetails __this__details_copy_value = new ProviderDetails(other_element_value);
152
 
153
        __this__details.put(__this__details_copy_key, __this__details_copy_value);
154
      }
155
      this.details = __this__details;
668 chandransh 156
    }
412 ashish 157
  }
158
 
159
  public Provider deepCopy() {
160
    return new Provider(this);
161
  }
162
 
3430 rajveer 163
  @Override
164
  public void clear() {
165
    setIdIsSet(false);
166
    this.id = 0;
167
    this.name = null;
168
    this.details = null;
412 ashish 169
  }
170
 
171
  public long getId() {
172
    return this.id;
173
  }
174
 
3430 rajveer 175
  public void setId(long id) {
412 ashish 176
    this.id = id;
177
    setIdIsSet(true);
178
  }
179
 
180
  public void unsetId() {
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
182
  }
183
 
3430 rajveer 184
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
412 ashish 185
  public boolean isSetId() {
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
187
  }
188
 
189
  public void setIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__ID_ISSET_ID, value);
191
  }
192
 
193
  public String getName() {
194
    return this.name;
195
  }
196
 
3430 rajveer 197
  public void setName(String name) {
412 ashish 198
    this.name = name;
199
  }
200
 
201
  public void unsetName() {
202
    this.name = null;
203
  }
204
 
3430 rajveer 205
  /** Returns true if field name is set (has been assigned a value) and false otherwise */
412 ashish 206
  public boolean isSetName() {
207
    return this.name != null;
208
  }
209
 
210
  public void setNameIsSet(boolean value) {
211
    if (!value) {
212
      this.name = null;
213
    }
214
  }
215
 
3044 chandransh 216
  public int getDetailsSize() {
217
    return (this.details == null) ? 0 : this.details.size();
668 chandransh 218
  }
219
 
3044 chandransh 220
  public void putToDetails(DeliveryType key, ProviderDetails val) {
221
    if (this.details == null) {
222
      this.details = new HashMap<DeliveryType,ProviderDetails>();
668 chandransh 223
    }
3044 chandransh 224
    this.details.put(key, val);
668 chandransh 225
  }
226
 
3044 chandransh 227
  public Map<DeliveryType,ProviderDetails> getDetails() {
228
    return this.details;
2515 chandransh 229
  }
230
 
3430 rajveer 231
  public void setDetails(Map<DeliveryType,ProviderDetails> details) {
3044 chandransh 232
    this.details = details;
2515 chandransh 233
  }
234
 
3044 chandransh 235
  public void unsetDetails() {
236
    this.details = null;
2515 chandransh 237
  }
238
 
3430 rajveer 239
  /** Returns true if field details is set (has been assigned a value) and false otherwise */
3044 chandransh 240
  public boolean isSetDetails() {
241
    return this.details != null;
2515 chandransh 242
  }
243
 
3044 chandransh 244
  public void setDetailsIsSet(boolean value) {
2515 chandransh 245
    if (!value) {
3044 chandransh 246
      this.details = null;
2515 chandransh 247
    }
248
  }
249
 
412 ashish 250
  public void setFieldValue(_Fields field, Object value) {
251
    switch (field) {
252
    case ID:
253
      if (value == null) {
254
        unsetId();
255
      } else {
256
        setId((Long)value);
257
      }
258
      break;
259
 
260
    case NAME:
261
      if (value == null) {
262
        unsetName();
263
      } else {
264
        setName((String)value);
265
      }
266
      break;
267
 
3044 chandransh 268
    case DETAILS:
668 chandransh 269
      if (value == null) {
3044 chandransh 270
        unsetDetails();
668 chandransh 271
      } else {
3044 chandransh 272
        setDetails((Map<DeliveryType,ProviderDetails>)value);
668 chandransh 273
      }
274
      break;
275
 
412 ashish 276
    }
277
  }
278
 
279
  public Object getFieldValue(_Fields field) {
280
    switch (field) {
281
    case ID:
3430 rajveer 282
      return Long.valueOf(getId());
412 ashish 283
 
284
    case NAME:
285
      return getName();
286
 
3044 chandransh 287
    case DETAILS:
288
      return getDetails();
668 chandransh 289
 
412 ashish 290
    }
291
    throw new IllegalStateException();
292
  }
293
 
3430 rajveer 294
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
295
  public boolean isSet(_Fields field) {
296
    if (field == null) {
297
      throw new IllegalArgumentException();
298
    }
412 ashish 299
 
300
    switch (field) {
301
    case ID:
302
      return isSetId();
303
    case NAME:
304
      return isSetName();
3044 chandransh 305
    case DETAILS:
306
      return isSetDetails();
412 ashish 307
    }
308
    throw new IllegalStateException();
309
  }
310
 
311
  @Override
312
  public boolean equals(Object that) {
313
    if (that == null)
314
      return false;
315
    if (that instanceof Provider)
316
      return this.equals((Provider)that);
317
    return false;
318
  }
319
 
320
  public boolean equals(Provider that) {
321
    if (that == null)
322
      return false;
323
 
324
    boolean this_present_id = true;
325
    boolean that_present_id = true;
326
    if (this_present_id || that_present_id) {
327
      if (!(this_present_id && that_present_id))
328
        return false;
329
      if (this.id != that.id)
330
        return false;
331
    }
332
 
333
    boolean this_present_name = true && this.isSetName();
334
    boolean that_present_name = true && that.isSetName();
335
    if (this_present_name || that_present_name) {
336
      if (!(this_present_name && that_present_name))
337
        return false;
338
      if (!this.name.equals(that.name))
339
        return false;
340
    }
341
 
3044 chandransh 342
    boolean this_present_details = true && this.isSetDetails();
343
    boolean that_present_details = true && that.isSetDetails();
344
    if (this_present_details || that_present_details) {
345
      if (!(this_present_details && that_present_details))
668 chandransh 346
        return false;
3044 chandransh 347
      if (!this.details.equals(that.details))
668 chandransh 348
        return false;
349
    }
350
 
412 ashish 351
    return true;
352
  }
353
 
354
  @Override
355
  public int hashCode() {
356
    return 0;
357
  }
358
 
3430 rajveer 359
  public int compareTo(Provider other) {
360
    if (!getClass().equals(other.getClass())) {
361
      return getClass().getName().compareTo(other.getClass().getName());
362
    }
363
 
364
    int lastComparison = 0;
365
    Provider typedOther = (Provider)other;
366
 
367
    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
368
    if (lastComparison != 0) {
369
      return lastComparison;
370
    }
371
    if (isSetId()) {
372
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
373
      if (lastComparison != 0) {
374
        return lastComparison;
375
      }
376
    }
377
    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
378
    if (lastComparison != 0) {
379
      return lastComparison;
380
    }
381
    if (isSetName()) {
382
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
383
      if (lastComparison != 0) {
384
        return lastComparison;
385
      }
386
    }
387
    lastComparison = Boolean.valueOf(isSetDetails()).compareTo(typedOther.isSetDetails());
388
    if (lastComparison != 0) {
389
      return lastComparison;
390
    }
391
    if (isSetDetails()) {
392
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.details, typedOther.details);
393
      if (lastComparison != 0) {
394
        return lastComparison;
395
      }
396
    }
397
    return 0;
398
  }
399
 
400
  public _Fields fieldForId(int fieldId) {
401
    return _Fields.findByThriftId(fieldId);
402
  }
403
 
404
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
405
    org.apache.thrift.protocol.TField field;
412 ashish 406
    iprot.readStructBegin();
407
    while (true)
408
    {
409
      field = iprot.readFieldBegin();
3430 rajveer 410
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
412 ashish 411
        break;
412
      }
3430 rajveer 413
      switch (field.id) {
414
        case 1: // ID
415
          if (field.type == org.apache.thrift.protocol.TType.I64) {
416
            this.id = iprot.readI64();
417
            setIdIsSet(true);
418
          } else { 
419
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
420
          }
421
          break;
422
        case 2: // NAME
423
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
424
            this.name = iprot.readString();
425
          } else { 
426
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
427
          }
428
          break;
429
        case 3: // DETAILS
430
          if (field.type == org.apache.thrift.protocol.TType.MAP) {
431
            {
432
              org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
433
              this.details = new HashMap<DeliveryType,ProviderDetails>(2*_map0.size);
434
              for (int _i1 = 0; _i1 < _map0.size; ++_i1)
3044 chandransh 435
              {
3430 rajveer 436
                DeliveryType _key2; // required
437
                ProviderDetails _val3; // required
438
                _key2 = DeliveryType.findByValue(iprot.readI32());
439
                _val3 = new ProviderDetails();
440
                _val3.read(iprot);
441
                this.details.put(_key2, _val3);
3044 chandransh 442
              }
3430 rajveer 443
              iprot.readMapEnd();
668 chandransh 444
            }
3430 rajveer 445
          } else { 
446
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
447
          }
448
          break;
449
        default:
450
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
412 ashish 451
      }
3430 rajveer 452
      iprot.readFieldEnd();
412 ashish 453
    }
454
    iprot.readStructEnd();
455
    validate();
456
  }
457
 
3430 rajveer 458
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
412 ashish 459
    validate();
460
 
461
    oprot.writeStructBegin(STRUCT_DESC);
462
    oprot.writeFieldBegin(ID_FIELD_DESC);
463
    oprot.writeI64(this.id);
464
    oprot.writeFieldEnd();
465
    if (this.name != null) {
466
      oprot.writeFieldBegin(NAME_FIELD_DESC);
467
      oprot.writeString(this.name);
468
      oprot.writeFieldEnd();
469
    }
3044 chandransh 470
    if (this.details != null) {
471
      oprot.writeFieldBegin(DETAILS_FIELD_DESC);
472
      {
3430 rajveer 473
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, this.details.size()));
3044 chandransh 474
        for (Map.Entry<DeliveryType, ProviderDetails> _iter4 : this.details.entrySet())
475
        {
476
          oprot.writeI32(_iter4.getKey().getValue());
477
          _iter4.getValue().write(oprot);
478
        }
479
        oprot.writeMapEnd();
480
      }
668 chandransh 481
      oprot.writeFieldEnd();
482
    }
412 ashish 483
    oprot.writeFieldStop();
484
    oprot.writeStructEnd();
485
  }
486
 
487
  @Override
488
  public String toString() {
489
    StringBuilder sb = new StringBuilder("Provider(");
490
    boolean first = true;
491
 
492
    sb.append("id:");
493
    sb.append(this.id);
494
    first = false;
495
    if (!first) sb.append(", ");
496
    sb.append("name:");
497
    if (this.name == null) {
498
      sb.append("null");
499
    } else {
500
      sb.append(this.name);
501
    }
502
    first = false;
668 chandransh 503
    if (!first) sb.append(", ");
3044 chandransh 504
    sb.append("details:");
505
    if (this.details == null) {
668 chandransh 506
      sb.append("null");
507
    } else {
3044 chandransh 508
      sb.append(this.details);
668 chandransh 509
    }
510
    first = false;
412 ashish 511
    sb.append(")");
512
    return sb.toString();
513
  }
514
 
3430 rajveer 515
  public void validate() throws org.apache.thrift.TException {
412 ashish 516
    // check for required fields
517
  }
518
 
3430 rajveer 519
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
520
    try {
521
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
522
    } catch (org.apache.thrift.TException te) {
523
      throw new java.io.IOException(te);
524
    }
525
  }
526
 
527
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
528
    try {
529
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
530
      __isset_bit_vector = new BitSet(1);
531
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
532
    } catch (org.apache.thrift.TException te) {
533
      throw new java.io.IOException(te);
534
    }
535
  }
536
 
412 ashish 537
}
538