Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | 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);
412 ashish 32
 
33
  private long id;
34
  private String name;
668 chandransh 35
  private String accountNo;
412 ashish 36
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
39
    ID((short)1, "id"),
668 chandransh 40
    NAME((short)2, "name"),
41
    ACCOUNT_NO((short)3, "accountNo");
412 ashish 42
 
43
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
44
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
45
 
46
    static {
47
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
48
        byId.put((int)field._thriftId, field);
49
        byName.put(field.getFieldName(), field);
50
      }
51
    }
52
 
53
    /**
54
     * Find the _Fields constant that matches fieldId, or null if its not found.
55
     */
56
    public static _Fields findByThriftId(int fieldId) {
57
      return byId.get(fieldId);
58
    }
59
 
60
    /**
61
     * Find the _Fields constant that matches fieldId, throwing an exception
62
     * if it is not found.
63
     */
64
    public static _Fields findByThriftIdOrThrow(int fieldId) {
65
      _Fields fields = findByThriftId(fieldId);
66
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
67
      return fields;
68
    }
69
 
70
    /**
71
     * Find the _Fields constant that matches name, or null if its not found.
72
     */
73
    public static _Fields findByName(String name) {
74
      return byName.get(name);
75
    }
76
 
77
    private final short _thriftId;
78
    private final String _fieldName;
79
 
80
    _Fields(short thriftId, String fieldName) {
81
      _thriftId = thriftId;
82
      _fieldName = fieldName;
83
    }
84
 
85
    public short getThriftFieldId() {
86
      return _thriftId;
87
    }
88
 
89
    public String getFieldName() {
90
      return _fieldName;
91
    }
92
  }
93
 
94
  // isset id assignments
95
  private static final int __ID_ISSET_ID = 0;
96
  private BitSet __isset_bit_vector = new BitSet(1);
97
 
98
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
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)));
668 chandransh 103
    put(_Fields.ACCOUNT_NO, new FieldMetaData("accountNo", TFieldRequirementType.DEFAULT, 
104
        new FieldValueMetaData(TType.STRING)));
412 ashish 105
  }});
106
 
107
  static {
108
    FieldMetaData.addStructMetaDataMap(Provider.class, metaDataMap);
109
  }
110
 
111
  public Provider() {
112
  }
113
 
114
  public Provider(
115
    long id,
668 chandransh 116
    String name,
117
    String accountNo)
412 ashish 118
  {
119
    this();
120
    this.id = id;
121
    setIdIsSet(true);
122
    this.name = name;
668 chandransh 123
    this.accountNo = accountNo;
412 ashish 124
  }
125
 
126
  /**
127
   * Performs a deep copy on <i>other</i>.
128
   */
129
  public Provider(Provider other) {
130
    __isset_bit_vector.clear();
131
    __isset_bit_vector.or(other.__isset_bit_vector);
132
    this.id = other.id;
133
    if (other.isSetName()) {
134
      this.name = other.name;
135
    }
668 chandransh 136
    if (other.isSetAccountNo()) {
137
      this.accountNo = other.accountNo;
138
    }
412 ashish 139
  }
140
 
141
  public Provider deepCopy() {
142
    return new Provider(this);
143
  }
144
 
145
  @Deprecated
146
  public Provider clone() {
147
    return new Provider(this);
148
  }
149
 
150
  public long getId() {
151
    return this.id;
152
  }
153
 
154
  public Provider setId(long id) {
155
    this.id = id;
156
    setIdIsSet(true);
157
    return this;
158
  }
159
 
160
  public void unsetId() {
161
    __isset_bit_vector.clear(__ID_ISSET_ID);
162
  }
163
 
164
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
165
  public boolean isSetId() {
166
    return __isset_bit_vector.get(__ID_ISSET_ID);
167
  }
168
 
169
  public void setIdIsSet(boolean value) {
170
    __isset_bit_vector.set(__ID_ISSET_ID, value);
171
  }
172
 
173
  public String getName() {
174
    return this.name;
175
  }
176
 
177
  public Provider setName(String name) {
178
    this.name = name;
179
    return this;
180
  }
181
 
182
  public void unsetName() {
183
    this.name = null;
184
  }
185
 
186
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
187
  public boolean isSetName() {
188
    return this.name != null;
189
  }
190
 
191
  public void setNameIsSet(boolean value) {
192
    if (!value) {
193
      this.name = null;
194
    }
195
  }
196
 
668 chandransh 197
  public String getAccountNo() {
198
    return this.accountNo;
199
  }
200
 
201
  public Provider setAccountNo(String accountNo) {
202
    this.accountNo = accountNo;
203
    return this;
204
  }
205
 
206
  public void unsetAccountNo() {
207
    this.accountNo = null;
208
  }
209
 
210
  /** Returns true if field accountNo is set (has been asigned a value) and false otherwise */
211
  public boolean isSetAccountNo() {
212
    return this.accountNo != null;
213
  }
214
 
215
  public void setAccountNoIsSet(boolean value) {
216
    if (!value) {
217
      this.accountNo = null;
218
    }
219
  }
220
 
412 ashish 221
  public void setFieldValue(_Fields field, Object value) {
222
    switch (field) {
223
    case ID:
224
      if (value == null) {
225
        unsetId();
226
      } else {
227
        setId((Long)value);
228
      }
229
      break;
230
 
231
    case NAME:
232
      if (value == null) {
233
        unsetName();
234
      } else {
235
        setName((String)value);
236
      }
237
      break;
238
 
668 chandransh 239
    case ACCOUNT_NO:
240
      if (value == null) {
241
        unsetAccountNo();
242
      } else {
243
        setAccountNo((String)value);
244
      }
245
      break;
246
 
412 ashish 247
    }
248
  }
249
 
250
  public void setFieldValue(int fieldID, Object value) {
251
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
252
  }
253
 
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
256
    case ID:
257
      return new Long(getId());
258
 
259
    case NAME:
260
      return getName();
261
 
668 chandransh 262
    case ACCOUNT_NO:
263
      return getAccountNo();
264
 
412 ashish 265
    }
266
    throw new IllegalStateException();
267
  }
268
 
269
  public Object getFieldValue(int fieldId) {
270
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
271
  }
272
 
273
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
274
  public boolean isSet(_Fields field) {
275
    switch (field) {
276
    case ID:
277
      return isSetId();
278
    case NAME:
279
      return isSetName();
668 chandransh 280
    case ACCOUNT_NO:
281
      return isSetAccountNo();
412 ashish 282
    }
283
    throw new IllegalStateException();
284
  }
285
 
286
  public boolean isSet(int fieldID) {
287
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
288
  }
289
 
290
  @Override
291
  public boolean equals(Object that) {
292
    if (that == null)
293
      return false;
294
    if (that instanceof Provider)
295
      return this.equals((Provider)that);
296
    return false;
297
  }
298
 
299
  public boolean equals(Provider that) {
300
    if (that == null)
301
      return false;
302
 
303
    boolean this_present_id = true;
304
    boolean that_present_id = true;
305
    if (this_present_id || that_present_id) {
306
      if (!(this_present_id && that_present_id))
307
        return false;
308
      if (this.id != that.id)
309
        return false;
310
    }
311
 
312
    boolean this_present_name = true && this.isSetName();
313
    boolean that_present_name = true && that.isSetName();
314
    if (this_present_name || that_present_name) {
315
      if (!(this_present_name && that_present_name))
316
        return false;
317
      if (!this.name.equals(that.name))
318
        return false;
319
    }
320
 
668 chandransh 321
    boolean this_present_accountNo = true && this.isSetAccountNo();
322
    boolean that_present_accountNo = true && that.isSetAccountNo();
323
    if (this_present_accountNo || that_present_accountNo) {
324
      if (!(this_present_accountNo && that_present_accountNo))
325
        return false;
326
      if (!this.accountNo.equals(that.accountNo))
327
        return false;
328
    }
329
 
412 ashish 330
    return true;
331
  }
332
 
333
  @Override
334
  public int hashCode() {
335
    return 0;
336
  }
337
 
338
  public int compareTo(Provider other) {
339
    if (!getClass().equals(other.getClass())) {
340
      return getClass().getName().compareTo(other.getClass().getName());
341
    }
342
 
343
    int lastComparison = 0;
344
    Provider typedOther = (Provider)other;
345
 
346
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
347
    if (lastComparison != 0) {
348
      return lastComparison;
349
    }
350
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
351
    if (lastComparison != 0) {
352
      return lastComparison;
353
    }
354
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
355
    if (lastComparison != 0) {
356
      return lastComparison;
357
    }
358
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
359
    if (lastComparison != 0) {
360
      return lastComparison;
361
    }
668 chandransh 362
    lastComparison = Boolean.valueOf(isSetAccountNo()).compareTo(isSetAccountNo());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    lastComparison = TBaseHelper.compareTo(accountNo, typedOther.accountNo);
367
    if (lastComparison != 0) {
368
      return lastComparison;
369
    }
412 ashish 370
    return 0;
371
  }
372
 
373
  public void read(TProtocol iprot) throws TException {
374
    TField field;
375
    iprot.readStructBegin();
376
    while (true)
377
    {
378
      field = iprot.readFieldBegin();
379
      if (field.type == TType.STOP) { 
380
        break;
381
      }
382
      _Fields fieldId = _Fields.findByThriftId(field.id);
383
      if (fieldId == null) {
384
        TProtocolUtil.skip(iprot, field.type);
385
      } else {
386
        switch (fieldId) {
387
          case ID:
388
            if (field.type == TType.I64) {
389
              this.id = iprot.readI64();
390
              setIdIsSet(true);
391
            } else { 
392
              TProtocolUtil.skip(iprot, field.type);
393
            }
394
            break;
395
          case NAME:
396
            if (field.type == TType.STRING) {
397
              this.name = iprot.readString();
398
            } else { 
399
              TProtocolUtil.skip(iprot, field.type);
400
            }
401
            break;
668 chandransh 402
          case ACCOUNT_NO:
403
            if (field.type == TType.STRING) {
404
              this.accountNo = iprot.readString();
405
            } else { 
406
              TProtocolUtil.skip(iprot, field.type);
407
            }
408
            break;
412 ashish 409
        }
410
        iprot.readFieldEnd();
411
      }
412
    }
413
    iprot.readStructEnd();
414
    validate();
415
  }
416
 
417
  public void write(TProtocol oprot) throws TException {
418
    validate();
419
 
420
    oprot.writeStructBegin(STRUCT_DESC);
421
    oprot.writeFieldBegin(ID_FIELD_DESC);
422
    oprot.writeI64(this.id);
423
    oprot.writeFieldEnd();
424
    if (this.name != null) {
425
      oprot.writeFieldBegin(NAME_FIELD_DESC);
426
      oprot.writeString(this.name);
427
      oprot.writeFieldEnd();
428
    }
668 chandransh 429
    if (this.accountNo != null) {
430
      oprot.writeFieldBegin(ACCOUNT_NO_FIELD_DESC);
431
      oprot.writeString(this.accountNo);
432
      oprot.writeFieldEnd();
433
    }
412 ashish 434
    oprot.writeFieldStop();
435
    oprot.writeStructEnd();
436
  }
437
 
438
  @Override
439
  public String toString() {
440
    StringBuilder sb = new StringBuilder("Provider(");
441
    boolean first = true;
442
 
443
    sb.append("id:");
444
    sb.append(this.id);
445
    first = false;
446
    if (!first) sb.append(", ");
447
    sb.append("name:");
448
    if (this.name == null) {
449
      sb.append("null");
450
    } else {
451
      sb.append(this.name);
452
    }
453
    first = false;
668 chandransh 454
    if (!first) sb.append(", ");
455
    sb.append("accountNo:");
456
    if (this.accountNo == null) {
457
      sb.append("null");
458
    } else {
459
      sb.append(this.accountNo);
460
    }
461
    first = false;
412 ashish 462
    sb.append(")");
463
    return sb.toString();
464
  }
465
 
466
  public void validate() throws TException {
467
    // check for required fields
468
  }
469
 
470
}
471