Subversion Repositories SmartDukaan

Rev

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

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