Subversion Repositories SmartDukaan

Rev

Rev 3044 | Rev 5527 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3044 Rev 3430
Line 1... Line 1...
1
/**
1
/**
2
 * Autogenerated by Thrift
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
5
 */
6
package in.shop2020.logistics;
6
package in.shop2020.logistics;
7
 
7
 
Line 13... Line 13...
13
import java.util.Set;
13
import java.util.Set;
14
import java.util.HashSet;
14
import java.util.HashSet;
15
import java.util.EnumSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
16
import java.util.Collections;
17
import java.util.BitSet;
17
import java.util.BitSet;
-
 
18
import java.nio.ByteBuffer;
18
import java.util.Arrays;
19
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
21
 
22
 
22
import org.apache.thrift.*;
-
 
23
import org.apache.thrift.meta_data.*;
-
 
24
import org.apache.thrift.protocol.*;
-
 
25
 
-
 
26
public class Provider implements TBase<Provider._Fields>, java.io.Serializable, Cloneable {
23
public class Provider implements org.apache.thrift.TBase<Provider, Provider._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("Provider");
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Provider");
28
 
25
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
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);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
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);
31
  private static final TField DETAILS_FIELD_DESC = new TField("details", TType.MAP, (short)3);
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);
32
 
29
 
33
  private long id;
30
  private long id; // required
34
  private String name;
31
  private String name; // required
35
  private Map<DeliveryType,ProviderDetails> details;
32
  private Map<DeliveryType,ProviderDetails> details; // required
36
 
33
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
39
    ID((short)1, "id"),
36
    ID((short)1, "id"),
40
    NAME((short)2, "name"),
37
    NAME((short)2, "name"),
41
    DETAILS((short)3, "details");
38
    DETAILS((short)3, "details");
42
 
39
 
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
45
 
41
 
46
    static {
42
    static {
47
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
48
        byId.put((int)field._thriftId, field);
-
 
49
        byName.put(field.getFieldName(), field);
44
        byName.put(field.getFieldName(), field);
50
      }
45
      }
51
    }
46
    }
52
 
47
 
53
    /**
48
    /**
54
     * Find the _Fields constant that matches fieldId, or null if its not found.
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
55
     */
50
     */
56
    public static _Fields findByThriftId(int fieldId) {
51
    public static _Fields findByThriftId(int fieldId) {
57
      return byId.get(fieldId);
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
      }
58
    }
62
    }
59
 
63
 
60
    /**
64
    /**
61
     * Find the _Fields constant that matches fieldId, throwing an exception
65
     * Find the _Fields constant that matches fieldId, throwing an exception
62
     * if it is not found.
66
     * if it is not found.
Line 93... Line 97...
93
 
97
 
94
  // isset id assignments
98
  // isset id assignments
95
  private static final int __ID_ISSET_ID = 0;
99
  private static final int __ID_ISSET_ID = 0;
96
  private BitSet __isset_bit_vector = new BitSet(1);
100
  private BitSet __isset_bit_vector = new BitSet(1);
97
 
101
 
98
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
102
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
99
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
-
 
100
        new FieldValueMetaData(TType.I64)));
-
 
101
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
-
 
102
        new FieldValueMetaData(TType.STRING)));
-
 
103
    put(_Fields.DETAILS, new FieldMetaData("details", TFieldRequirementType.DEFAULT, 
-
 
104
        new MapMetaData(TType.MAP, 
-
 
105
            new EnumMetaData(TType.ENUM, DeliveryType.class), 
-
 
106
            new StructMetaData(TType.STRUCT, ProviderDetails.class))));
-
 
107
  }});
-
 
108
 
-
 
109
  static {
103
  static {
-
 
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);
110
    FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
114
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
111
  }
115
  }
112
 
116
 
113
  public Provider() {
117
  public Provider() {
114
  }
118
  }
115
 
119
 
Line 154... Line 158...
154
 
158
 
155
  public Provider deepCopy() {
159
  public Provider deepCopy() {
156
    return new Provider(this);
160
    return new Provider(this);
157
  }
161
  }
158
 
162
 
159
  @Deprecated
163
  @Override
160
  public Provider clone() {
164
  public void clear() {
161
    return new Provider(this);
165
    setIdIsSet(false);
-
 
166
    this.id = 0;
-
 
167
    this.name = null;
-
 
168
    this.details = null;
162
  }
169
  }
163
 
170
 
164
  public long getId() {
171
  public long getId() {
165
    return this.id;
172
    return this.id;
166
  }
173
  }
167
 
174
 
168
  public Provider setId(long id) {
175
  public void setId(long id) {
169
    this.id = id;
176
    this.id = id;
170
    setIdIsSet(true);
177
    setIdIsSet(true);
171
    return this;
-
 
172
  }
178
  }
173
 
179
 
174
  public void unsetId() {
180
  public void unsetId() {
175
    __isset_bit_vector.clear(__ID_ISSET_ID);
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
176
  }
182
  }
177
 
183
 
178
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
184
  /** Returns true if field id is set (has been assigned a value) and false otherwise */
179
  public boolean isSetId() {
185
  public boolean isSetId() {
180
    return __isset_bit_vector.get(__ID_ISSET_ID);
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
181
  }
187
  }
182
 
188
 
183
  public void setIdIsSet(boolean value) {
189
  public void setIdIsSet(boolean value) {
Line 186... Line 192...
186
 
192
 
187
  public String getName() {
193
  public String getName() {
188
    return this.name;
194
    return this.name;
189
  }
195
  }
190
 
196
 
191
  public Provider setName(String name) {
197
  public void setName(String name) {
192
    this.name = name;
198
    this.name = name;
193
    return this;
-
 
194
  }
199
  }
195
 
200
 
196
  public void unsetName() {
201
  public void unsetName() {
197
    this.name = null;
202
    this.name = null;
198
  }
203
  }
199
 
204
 
200
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
205
  /** Returns true if field name is set (has been assigned a value) and false otherwise */
201
  public boolean isSetName() {
206
  public boolean isSetName() {
202
    return this.name != null;
207
    return this.name != null;
203
  }
208
  }
204
 
209
 
205
  public void setNameIsSet(boolean value) {
210
  public void setNameIsSet(boolean value) {
Line 221... Line 226...
221
 
226
 
222
  public Map<DeliveryType,ProviderDetails> getDetails() {
227
  public Map<DeliveryType,ProviderDetails> getDetails() {
223
    return this.details;
228
    return this.details;
224
  }
229
  }
225
 
230
 
226
  public Provider setDetails(Map<DeliveryType,ProviderDetails> details) {
231
  public void setDetails(Map<DeliveryType,ProviderDetails> details) {
227
    this.details = details;
232
    this.details = details;
228
    return this;
-
 
229
  }
233
  }
230
 
234
 
231
  public void unsetDetails() {
235
  public void unsetDetails() {
232
    this.details = null;
236
    this.details = null;
233
  }
237
  }
234
 
238
 
235
  /** Returns true if field details is set (has been asigned a value) and false otherwise */
239
  /** Returns true if field details is set (has been assigned a value) and false otherwise */
236
  public boolean isSetDetails() {
240
  public boolean isSetDetails() {
237
    return this.details != null;
241
    return this.details != null;
238
  }
242
  }
239
 
243
 
240
  public void setDetailsIsSet(boolean value) {
244
  public void setDetailsIsSet(boolean value) {
Line 270... Line 274...
270
      break;
274
      break;
271
 
275
 
272
    }
276
    }
273
  }
277
  }
274
 
278
 
275
  public void setFieldValue(int fieldID, Object value) {
-
 
276
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
277
  }
-
 
278
 
-
 
279
  public Object getFieldValue(_Fields field) {
279
  public Object getFieldValue(_Fields field) {
280
    switch (field) {
280
    switch (field) {
281
    case ID:
281
    case ID:
282
      return new Long(getId());
282
      return Long.valueOf(getId());
283
 
283
 
284
    case NAME:
284
    case NAME:
285
      return getName();
285
      return getName();
286
 
286
 
287
    case DETAILS:
287
    case DETAILS:
Line 289... Line 289...
289
 
289
 
290
    }
290
    }
291
    throw new IllegalStateException();
291
    throw new IllegalStateException();
292
  }
292
  }
293
 
293
 
294
  public Object getFieldValue(int fieldId) {
-
 
295
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
296
  }
-
 
297
 
-
 
298
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
294
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
299
  public boolean isSet(_Fields field) {
295
  public boolean isSet(_Fields field) {
-
 
296
    if (field == null) {
-
 
297
      throw new IllegalArgumentException();
-
 
298
    }
-
 
299
 
300
    switch (field) {
300
    switch (field) {
301
    case ID:
301
    case ID:
302
      return isSetId();
302
      return isSetId();
303
    case NAME:
303
    case NAME:
304
      return isSetName();
304
      return isSetName();
Line 306... Line 306...
306
      return isSetDetails();
306
      return isSetDetails();
307
    }
307
    }
308
    throw new IllegalStateException();
308
    throw new IllegalStateException();
309
  }
309
  }
310
 
310
 
311
  public boolean isSet(int fieldID) {
-
 
312
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
313
  }
-
 
314
 
-
 
315
  @Override
311
  @Override
316
  public boolean equals(Object that) {
312
  public boolean equals(Object that) {
317
    if (that == null)
313
    if (that == null)
318
      return false;
314
      return false;
319
    if (that instanceof Provider)
315
    if (that instanceof Provider)
Line 358... Line 354...
358
  @Override
354
  @Override
359
  public int hashCode() {
355
  public int hashCode() {
360
    return 0;
356
    return 0;
361
  }
357
  }
362
 
358
 
363
  public void read(TProtocol iprot) throws TException {
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
    }
364
    TField field;
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;
365
    iprot.readStructBegin();
406
    iprot.readStructBegin();
366
    while (true)
407
    while (true)
367
    {
408
    {
368
      field = iprot.readFieldBegin();
409
      field = iprot.readFieldBegin();
369
      if (field.type == TType.STOP) { 
410
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
370
        break;
411
        break;
371
      }
412
      }
372
      _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
373
      if (fieldId == null) {
-
 
374
        TProtocolUtil.skip(iprot, field.type);
-
 
375
      } else {
-
 
376
        switch (fieldId) {
413
      switch (field.id) {
377
          case ID:
414
        case 1: // ID
378
            if (field.type == TType.I64) {
415
          if (field.type == org.apache.thrift.protocol.TType.I64) {
379
              this.id = iprot.readI64();
416
            this.id = iprot.readI64();
380
              setIdIsSet(true);
417
            setIdIsSet(true);
381
            } else { 
418
          } else { 
382
              TProtocolUtil.skip(iprot, field.type);
419
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
383
            }
420
          }
384
            break;
421
          break;
385
          case NAME:
422
        case 2: // NAME
386
            if (field.type == TType.STRING) {
423
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
387
              this.name = iprot.readString();
424
            this.name = iprot.readString();
388
            } else { 
425
          } else { 
389
              TProtocolUtil.skip(iprot, field.type);
426
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
390
            }
427
          }
391
            break;
428
          break;
392
          case DETAILS:
429
        case 3: // DETAILS
393
            if (field.type == TType.MAP) {
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)
394
              {
435
              {
395
                TMap _map0 = iprot.readMapBegin();
-
 
396
                this.details = new HashMap<DeliveryType,ProviderDetails>(2*_map0.size);
-
 
397
                for (int _i1 = 0; _i1 < _map0.size; ++_i1)
-
 
398
                {
-
 
399
                  DeliveryType _key2;
436
                DeliveryType _key2; // required
400
                  ProviderDetails _val3;
437
                ProviderDetails _val3; // required
401
                  _key2 = DeliveryType.findByValue(iprot.readI32());
438
                _key2 = DeliveryType.findByValue(iprot.readI32());
402
                  _val3 = new ProviderDetails();
439
                _val3 = new ProviderDetails();
403
                  _val3.read(iprot);
440
                _val3.read(iprot);
404
                  this.details.put(_key2, _val3);
441
                this.details.put(_key2, _val3);
405
                }
-
 
406
                iprot.readMapEnd();
-
 
407
              }
442
              }
408
            } else { 
443
              iprot.readMapEnd();
409
              TProtocolUtil.skip(iprot, field.type);
-
 
410
            }
444
            }
411
            break;
445
          } else { 
-
 
446
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
412
        }
447
          }
413
        iprot.readFieldEnd();
448
          break;
-
 
449
        default:
-
 
450
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
414
      }
451
      }
-
 
452
      iprot.readFieldEnd();
415
    }
453
    }
416
    iprot.readStructEnd();
454
    iprot.readStructEnd();
417
    validate();
455
    validate();
418
  }
456
  }
419
 
457
 
420
  public void write(TProtocol oprot) throws TException {
458
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
421
    validate();
459
    validate();
422
 
460
 
423
    oprot.writeStructBegin(STRUCT_DESC);
461
    oprot.writeStructBegin(STRUCT_DESC);
424
    oprot.writeFieldBegin(ID_FIELD_DESC);
462
    oprot.writeFieldBegin(ID_FIELD_DESC);
425
    oprot.writeI64(this.id);
463
    oprot.writeI64(this.id);
Line 430... Line 468...
430
      oprot.writeFieldEnd();
468
      oprot.writeFieldEnd();
431
    }
469
    }
432
    if (this.details != null) {
470
    if (this.details != null) {
433
      oprot.writeFieldBegin(DETAILS_FIELD_DESC);
471
      oprot.writeFieldBegin(DETAILS_FIELD_DESC);
434
      {
472
      {
435
        oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, this.details.size()));
473
        oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, this.details.size()));
436
        for (Map.Entry<DeliveryType, ProviderDetails> _iter4 : this.details.entrySet())
474
        for (Map.Entry<DeliveryType, ProviderDetails> _iter4 : this.details.entrySet())
437
        {
475
        {
438
          oprot.writeI32(_iter4.getKey().getValue());
476
          oprot.writeI32(_iter4.getKey().getValue());
439
          _iter4.getValue().write(oprot);
477
          _iter4.getValue().write(oprot);
440
        }
478
        }
Line 472... Line 510...
472
    first = false;
510
    first = false;
473
    sb.append(")");
511
    sb.append(")");
474
    return sb.toString();
512
    return sb.toString();
475
  }
513
  }
476
 
514
 
477
  public void validate() throws TException {
515
  public void validate() throws org.apache.thrift.TException {
478
    // check for required fields
516
    // check for required fields
479
  }
517
  }
480
 
518
 
-
 
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
 
481
}
537
}
482
 
538