Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
412 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.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;
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 Provider implements TBase<Provider._Fields>, java.io.Serializable, Cloneable, Comparable<Provider> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Provider");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
668 chandransh 31
  private static final TField ACCOUNT_NO_FIELD_DESC = new TField("accountNo", TType.STRING, (short)3);
2515 chandransh 32
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)4);
412 ashish 33
 
34
  private long id;
35
  private String name;
668 chandransh 36
  private String accountNo;
2515 chandransh 37
  private String email;
412 ashish 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
    ID((short)1, "id"),
668 chandransh 42
    NAME((short)2, "name"),
2515 chandransh 43
    ACCOUNT_NO((short)3, "accountNo"),
44
    EMAIL((short)4, "email");
412 ashish 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 __ID_ISSET_ID = 0;
99
  private BitSet __isset_bit_vector = new BitSet(1);
100
 
101
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
102
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
103
        new FieldValueMetaData(TType.I64)));
104
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.STRING)));
668 chandransh 106
    put(_Fields.ACCOUNT_NO, new FieldMetaData("accountNo", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.STRING)));
2515 chandransh 108
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.STRING)));
412 ashish 110
  }});
111
 
112
  static {
113
    FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
114
  }
115
 
116
  public Provider() {
117
  }
118
 
119
  public Provider(
120
    long id,
668 chandransh 121
    String name,
2515 chandransh 122
    String accountNo,
123
    String email)
412 ashish 124
  {
125
    this();
126
    this.id = id;
127
    setIdIsSet(true);
128
    this.name = name;
668 chandransh 129
    this.accountNo = accountNo;
2515 chandransh 130
    this.email = email;
412 ashish 131
  }
132
 
133
  /**
134
   * Performs a deep copy on <i>other</i>.
135
   */
136
  public Provider(Provider other) {
137
    __isset_bit_vector.clear();
138
    __isset_bit_vector.or(other.__isset_bit_vector);
139
    this.id = other.id;
140
    if (other.isSetName()) {
141
      this.name = other.name;
142
    }
668 chandransh 143
    if (other.isSetAccountNo()) {
144
      this.accountNo = other.accountNo;
145
    }
2515 chandransh 146
    if (other.isSetEmail()) {
147
      this.email = other.email;
148
    }
412 ashish 149
  }
150
 
151
  public Provider deepCopy() {
152
    return new Provider(this);
153
  }
154
 
155
  @Deprecated
156
  public Provider clone() {
157
    return new Provider(this);
158
  }
159
 
160
  public long getId() {
161
    return this.id;
162
  }
163
 
164
  public Provider setId(long id) {
165
    this.id = id;
166
    setIdIsSet(true);
167
    return this;
168
  }
169
 
170
  public void unsetId() {
171
    __isset_bit_vector.clear(__ID_ISSET_ID);
172
  }
173
 
174
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
175
  public boolean isSetId() {
176
    return __isset_bit_vector.get(__ID_ISSET_ID);
177
  }
178
 
179
  public void setIdIsSet(boolean value) {
180
    __isset_bit_vector.set(__ID_ISSET_ID, value);
181
  }
182
 
183
  public String getName() {
184
    return this.name;
185
  }
186
 
187
  public Provider setName(String name) {
188
    this.name = name;
189
    return this;
190
  }
191
 
192
  public void unsetName() {
193
    this.name = null;
194
  }
195
 
196
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
197
  public boolean isSetName() {
198
    return this.name != null;
199
  }
200
 
201
  public void setNameIsSet(boolean value) {
202
    if (!value) {
203
      this.name = null;
204
    }
205
  }
206
 
668 chandransh 207
  public String getAccountNo() {
208
    return this.accountNo;
209
  }
210
 
211
  public Provider setAccountNo(String accountNo) {
212
    this.accountNo = accountNo;
213
    return this;
214
  }
215
 
216
  public void unsetAccountNo() {
217
    this.accountNo = null;
218
  }
219
 
220
  /** Returns true if field accountNo is set (has been asigned a value) and false otherwise */
221
  public boolean isSetAccountNo() {
222
    return this.accountNo != null;
223
  }
224
 
225
  public void setAccountNoIsSet(boolean value) {
226
    if (!value) {
227
      this.accountNo = null;
228
    }
229
  }
230
 
2515 chandransh 231
  public String getEmail() {
232
    return this.email;
233
  }
234
 
235
  public Provider setEmail(String email) {
236
    this.email = email;
237
    return this;
238
  }
239
 
240
  public void unsetEmail() {
241
    this.email = null;
242
  }
243
 
244
  /** Returns true if field email is set (has been asigned a value) and false otherwise */
245
  public boolean isSetEmail() {
246
    return this.email != null;
247
  }
248
 
249
  public void setEmailIsSet(boolean value) {
250
    if (!value) {
251
      this.email = null;
252
    }
253
  }
254
 
412 ashish 255
  public void setFieldValue(_Fields field, Object value) {
256
    switch (field) {
257
    case ID:
258
      if (value == null) {
259
        unsetId();
260
      } else {
261
        setId((Long)value);
262
      }
263
      break;
264
 
265
    case NAME:
266
      if (value == null) {
267
        unsetName();
268
      } else {
269
        setName((String)value);
270
      }
271
      break;
272
 
668 chandransh 273
    case ACCOUNT_NO:
274
      if (value == null) {
275
        unsetAccountNo();
276
      } else {
277
        setAccountNo((String)value);
278
      }
279
      break;
280
 
2515 chandransh 281
    case EMAIL:
282
      if (value == null) {
283
        unsetEmail();
284
      } else {
285
        setEmail((String)value);
286
      }
287
      break;
288
 
412 ashish 289
    }
290
  }
291
 
292
  public void setFieldValue(int fieldID, Object value) {
293
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
294
  }
295
 
296
  public Object getFieldValue(_Fields field) {
297
    switch (field) {
298
    case ID:
299
      return new Long(getId());
300
 
301
    case NAME:
302
      return getName();
303
 
668 chandransh 304
    case ACCOUNT_NO:
305
      return getAccountNo();
306
 
2515 chandransh 307
    case EMAIL:
308
      return getEmail();
309
 
412 ashish 310
    }
311
    throw new IllegalStateException();
312
  }
313
 
314
  public Object getFieldValue(int fieldId) {
315
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
316
  }
317
 
318
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
319
  public boolean isSet(_Fields field) {
320
    switch (field) {
321
    case ID:
322
      return isSetId();
323
    case NAME:
324
      return isSetName();
668 chandransh 325
    case ACCOUNT_NO:
326
      return isSetAccountNo();
2515 chandransh 327
    case EMAIL:
328
      return isSetEmail();
412 ashish 329
    }
330
    throw new IllegalStateException();
331
  }
332
 
333
  public boolean isSet(int fieldID) {
334
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
335
  }
336
 
337
  @Override
338
  public boolean equals(Object that) {
339
    if (that == null)
340
      return false;
341
    if (that instanceof Provider)
342
      return this.equals((Provider)that);
343
    return false;
344
  }
345
 
346
  public boolean equals(Provider that) {
347
    if (that == null)
348
      return false;
349
 
350
    boolean this_present_id = true;
351
    boolean that_present_id = true;
352
    if (this_present_id || that_present_id) {
353
      if (!(this_present_id && that_present_id))
354
        return false;
355
      if (this.id != that.id)
356
        return false;
357
    }
358
 
359
    boolean this_present_name = true && this.isSetName();
360
    boolean that_present_name = true && that.isSetName();
361
    if (this_present_name || that_present_name) {
362
      if (!(this_present_name && that_present_name))
363
        return false;
364
      if (!this.name.equals(that.name))
365
        return false;
366
    }
367
 
668 chandransh 368
    boolean this_present_accountNo = true && this.isSetAccountNo();
369
    boolean that_present_accountNo = true && that.isSetAccountNo();
370
    if (this_present_accountNo || that_present_accountNo) {
371
      if (!(this_present_accountNo && that_present_accountNo))
372
        return false;
373
      if (!this.accountNo.equals(that.accountNo))
374
        return false;
375
    }
376
 
2515 chandransh 377
    boolean this_present_email = true && this.isSetEmail();
378
    boolean that_present_email = true && that.isSetEmail();
379
    if (this_present_email || that_present_email) {
380
      if (!(this_present_email && that_present_email))
381
        return false;
382
      if (!this.email.equals(that.email))
383
        return false;
384
    }
385
 
412 ashish 386
    return true;
387
  }
388
 
389
  @Override
390
  public int hashCode() {
391
    return 0;
392
  }
393
 
394
  public int compareTo(Provider other) {
395
    if (!getClass().equals(other.getClass())) {
396
      return getClass().getName().compareTo(other.getClass().getName());
397
    }
398
 
399
    int lastComparison = 0;
400
    Provider typedOther = (Provider)other;
401
 
402
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
403
    if (lastComparison != 0) {
404
      return lastComparison;
405
    }
406
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
407
    if (lastComparison != 0) {
408
      return lastComparison;
409
    }
410
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
415
    if (lastComparison != 0) {
416
      return lastComparison;
417
    }
668 chandransh 418
    lastComparison = Boolean.valueOf(isSetAccountNo()).compareTo(isSetAccountNo());
419
    if (lastComparison != 0) {
420
      return lastComparison;
421
    }
422
    lastComparison = TBaseHelper.compareTo(accountNo, typedOther.accountNo);
423
    if (lastComparison != 0) {
424
      return lastComparison;
425
    }
2515 chandransh 426
    lastComparison = Boolean.valueOf(isSetEmail()).compareTo(isSetEmail());
427
    if (lastComparison != 0) {
428
      return lastComparison;
429
    }
430
    lastComparison = TBaseHelper.compareTo(email, typedOther.email);
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
412 ashish 434
    return 0;
435
  }
436
 
437
  public void read(TProtocol iprot) throws TException {
438
    TField field;
439
    iprot.readStructBegin();
440
    while (true)
441
    {
442
      field = iprot.readFieldBegin();
443
      if (field.type == TType.STOP) { 
444
        break;
445
      }
446
      _Fields fieldId = _Fields.findByThriftId(field.id);
447
      if (fieldId == null) {
448
        TProtocolUtil.skip(iprot, field.type);
449
      } else {
450
        switch (fieldId) {
451
          case ID:
452
            if (field.type == TType.I64) {
453
              this.id = iprot.readI64();
454
              setIdIsSet(true);
455
            } else { 
456
              TProtocolUtil.skip(iprot, field.type);
457
            }
458
            break;
459
          case NAME:
460
            if (field.type == TType.STRING) {
461
              this.name = iprot.readString();
462
            } else { 
463
              TProtocolUtil.skip(iprot, field.type);
464
            }
465
            break;
668 chandransh 466
          case ACCOUNT_NO:
467
            if (field.type == TType.STRING) {
468
              this.accountNo = iprot.readString();
469
            } else { 
470
              TProtocolUtil.skip(iprot, field.type);
471
            }
472
            break;
2515 chandransh 473
          case EMAIL:
474
            if (field.type == TType.STRING) {
475
              this.email = iprot.readString();
476
            } else { 
477
              TProtocolUtil.skip(iprot, field.type);
478
            }
479
            break;
412 ashish 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
    oprot.writeFieldBegin(ID_FIELD_DESC);
493
    oprot.writeI64(this.id);
494
    oprot.writeFieldEnd();
495
    if (this.name != null) {
496
      oprot.writeFieldBegin(NAME_FIELD_DESC);
497
      oprot.writeString(this.name);
498
      oprot.writeFieldEnd();
499
    }
668 chandransh 500
    if (this.accountNo != null) {
501
      oprot.writeFieldBegin(ACCOUNT_NO_FIELD_DESC);
502
      oprot.writeString(this.accountNo);
503
      oprot.writeFieldEnd();
504
    }
2515 chandransh 505
    if (this.email != null) {
506
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
507
      oprot.writeString(this.email);
508
      oprot.writeFieldEnd();
509
    }
412 ashish 510
    oprot.writeFieldStop();
511
    oprot.writeStructEnd();
512
  }
513
 
514
  @Override
515
  public String toString() {
516
    StringBuilder sb = new StringBuilder("Provider(");
517
    boolean first = true;
518
 
519
    sb.append("id:");
520
    sb.append(this.id);
521
    first = false;
522
    if (!first) sb.append(", ");
523
    sb.append("name:");
524
    if (this.name == null) {
525
      sb.append("null");
526
    } else {
527
      sb.append(this.name);
528
    }
529
    first = false;
668 chandransh 530
    if (!first) sb.append(", ");
531
    sb.append("accountNo:");
532
    if (this.accountNo == null) {
533
      sb.append("null");
534
    } else {
535
      sb.append(this.accountNo);
536
    }
537
    first = false;
2515 chandransh 538
    if (!first) sb.append(", ");
539
    sb.append("email:");
540
    if (this.email == null) {
541
      sb.append("null");
542
    } else {
543
      sb.append(this.email);
544
    }
545
    first = false;
412 ashish 546
    sb.append(")");
547
    return sb.toString();
548
  }
549
 
550
  public void validate() throws TException {
551
    // check for required fields
552
  }
553
 
554
}
555