Subversion Repositories SmartDukaan

Rev

Rev 20818 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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