Subversion Repositories SmartDukaan

Rev

Rev 1847 | Go to most recent revision | Details | Compare with Previous | 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);
1860 vikas 33
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)5);
1847 vikas 34
 
35
  private long id;
36
  private String name;
37
  private String url;
38
  private long masterAffiliateId;
1860 vikas 39
  private long addedOn;
1847 vikas 40
 
41
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
42
  public enum _Fields implements TFieldIdEnum {
43
    ID((short)1, "id"),
44
    NAME((short)2, "name"),
45
    URL((short)3, "url"),
1860 vikas 46
    MASTER_AFFILIATE_ID((short)4, "masterAffiliateId"),
47
    ADDED_ON((short)5, "addedOn");
1847 vikas 48
 
49
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
50
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
51
 
52
    static {
53
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
54
        byId.put((int)field._thriftId, field);
55
        byName.put(field.getFieldName(), field);
56
      }
57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, or null if its not found.
61
     */
62
    public static _Fields findByThriftId(int fieldId) {
63
      return byId.get(fieldId);
64
    }
65
 
66
    /**
67
     * Find the _Fields constant that matches fieldId, throwing an exception
68
     * if it is not found.
69
     */
70
    public static _Fields findByThriftIdOrThrow(int fieldId) {
71
      _Fields fields = findByThriftId(fieldId);
72
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
73
      return fields;
74
    }
75
 
76
    /**
77
     * Find the _Fields constant that matches name, or null if its not found.
78
     */
79
    public static _Fields findByName(String name) {
80
      return byName.get(name);
81
    }
82
 
83
    private final short _thriftId;
84
    private final String _fieldName;
85
 
86
    _Fields(short thriftId, String fieldName) {
87
      _thriftId = thriftId;
88
      _fieldName = fieldName;
89
    }
90
 
91
    public short getThriftFieldId() {
92
      return _thriftId;
93
    }
94
 
95
    public String getFieldName() {
96
      return _fieldName;
97
    }
98
  }
99
 
100
  // isset id assignments
101
  private static final int __ID_ISSET_ID = 0;
102
  private static final int __MASTERAFFILIATEID_ISSET_ID = 1;
1860 vikas 103
  private static final int __ADDEDON_ISSET_ID = 2;
104
  private BitSet __isset_bit_vector = new BitSet(3);
1847 vikas 105
 
106
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
107
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
108
        new FieldValueMetaData(TType.I64)));
109
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.STRING)));
111
    put(_Fields.URL, new FieldMetaData("url", TFieldRequirementType.DEFAULT, 
112
        new FieldValueMetaData(TType.STRING)));
113
    put(_Fields.MASTER_AFFILIATE_ID, new FieldMetaData("masterAffiliateId", TFieldRequirementType.DEFAULT, 
114
        new FieldValueMetaData(TType.I64)));
1860 vikas 115
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
116
        new FieldValueMetaData(TType.I64)));
1847 vikas 117
  }});
118
 
119
  static {
120
    FieldMetaData.addStructMetaDataMap(Affiliate.class, metaDataMap);
121
  }
122
 
123
  public Affiliate() {
124
  }
125
 
126
  public Affiliate(
127
    long id,
128
    String name,
129
    String url,
1860 vikas 130
    long masterAffiliateId,
131
    long addedOn)
1847 vikas 132
  {
133
    this();
134
    this.id = id;
135
    setIdIsSet(true);
136
    this.name = name;
137
    this.url = url;
138
    this.masterAffiliateId = masterAffiliateId;
139
    setMasterAffiliateIdIsSet(true);
1860 vikas 140
    this.addedOn = addedOn;
141
    setAddedOnIsSet(true);
1847 vikas 142
  }
143
 
144
  /**
145
   * Performs a deep copy on <i>other</i>.
146
   */
147
  public Affiliate(Affiliate other) {
148
    __isset_bit_vector.clear();
149
    __isset_bit_vector.or(other.__isset_bit_vector);
150
    this.id = other.id;
151
    if (other.isSetName()) {
152
      this.name = other.name;
153
    }
154
    if (other.isSetUrl()) {
155
      this.url = other.url;
156
    }
157
    this.masterAffiliateId = other.masterAffiliateId;
1860 vikas 158
    this.addedOn = other.addedOn;
1847 vikas 159
  }
160
 
161
  public Affiliate deepCopy() {
162
    return new Affiliate(this);
163
  }
164
 
165
  @Deprecated
166
  public Affiliate clone() {
167
    return new Affiliate(this);
168
  }
169
 
170
  public long getId() {
171
    return this.id;
172
  }
173
 
174
  public Affiliate setId(long id) {
175
    this.id = id;
176
    setIdIsSet(true);
177
    return this;
178
  }
179
 
180
  public void unsetId() {
181
    __isset_bit_vector.clear(__ID_ISSET_ID);
182
  }
183
 
184
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
185
  public boolean isSetId() {
186
    return __isset_bit_vector.get(__ID_ISSET_ID);
187
  }
188
 
189
  public void setIdIsSet(boolean value) {
190
    __isset_bit_vector.set(__ID_ISSET_ID, value);
191
  }
192
 
193
  public String getName() {
194
    return this.name;
195
  }
196
 
197
  public Affiliate setName(String name) {
198
    this.name = name;
199
    return this;
200
  }
201
 
202
  public void unsetName() {
203
    this.name = null;
204
  }
205
 
206
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
207
  public boolean isSetName() {
208
    return this.name != null;
209
  }
210
 
211
  public void setNameIsSet(boolean value) {
212
    if (!value) {
213
      this.name = null;
214
    }
215
  }
216
 
217
  public String getUrl() {
218
    return this.url;
219
  }
220
 
221
  public Affiliate setUrl(String url) {
222
    this.url = url;
223
    return this;
224
  }
225
 
226
  public void unsetUrl() {
227
    this.url = null;
228
  }
229
 
230
  /** Returns true if field url is set (has been asigned a value) and false otherwise */
231
  public boolean isSetUrl() {
232
    return this.url != null;
233
  }
234
 
235
  public void setUrlIsSet(boolean value) {
236
    if (!value) {
237
      this.url = null;
238
    }
239
  }
240
 
241
  public long getMasterAffiliateId() {
242
    return this.masterAffiliateId;
243
  }
244
 
245
  public Affiliate setMasterAffiliateId(long masterAffiliateId) {
246
    this.masterAffiliateId = masterAffiliateId;
247
    setMasterAffiliateIdIsSet(true);
248
    return this;
249
  }
250
 
251
  public void unsetMasterAffiliateId() {
252
    __isset_bit_vector.clear(__MASTERAFFILIATEID_ISSET_ID);
253
  }
254
 
255
  /** Returns true if field masterAffiliateId is set (has been asigned a value) and false otherwise */
256
  public boolean isSetMasterAffiliateId() {
257
    return __isset_bit_vector.get(__MASTERAFFILIATEID_ISSET_ID);
258
  }
259
 
260
  public void setMasterAffiliateIdIsSet(boolean value) {
261
    __isset_bit_vector.set(__MASTERAFFILIATEID_ISSET_ID, value);
262
  }
263
 
1860 vikas 264
  public long getAddedOn() {
265
    return this.addedOn;
266
  }
267
 
268
  public Affiliate setAddedOn(long addedOn) {
269
    this.addedOn = addedOn;
270
    setAddedOnIsSet(true);
271
    return this;
272
  }
273
 
274
  public void unsetAddedOn() {
275
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
276
  }
277
 
278
  /** Returns true if field addedOn is set (has been asigned a value) and false otherwise */
279
  public boolean isSetAddedOn() {
280
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
281
  }
282
 
283
  public void setAddedOnIsSet(boolean value) {
284
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
285
  }
286
 
1847 vikas 287
  public void setFieldValue(_Fields field, Object value) {
288
    switch (field) {
289
    case ID:
290
      if (value == null) {
291
        unsetId();
292
      } else {
293
        setId((Long)value);
294
      }
295
      break;
296
 
297
    case NAME:
298
      if (value == null) {
299
        unsetName();
300
      } else {
301
        setName((String)value);
302
      }
303
      break;
304
 
305
    case URL:
306
      if (value == null) {
307
        unsetUrl();
308
      } else {
309
        setUrl((String)value);
310
      }
311
      break;
312
 
313
    case MASTER_AFFILIATE_ID:
314
      if (value == null) {
315
        unsetMasterAffiliateId();
316
      } else {
317
        setMasterAffiliateId((Long)value);
318
      }
319
      break;
320
 
1860 vikas 321
    case ADDED_ON:
322
      if (value == null) {
323
        unsetAddedOn();
324
      } else {
325
        setAddedOn((Long)value);
326
      }
327
      break;
328
 
1847 vikas 329
    }
330
  }
331
 
332
  public void setFieldValue(int fieldID, Object value) {
333
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
334
  }
335
 
336
  public Object getFieldValue(_Fields field) {
337
    switch (field) {
338
    case ID:
339
      return new Long(getId());
340
 
341
    case NAME:
342
      return getName();
343
 
344
    case URL:
345
      return getUrl();
346
 
347
    case MASTER_AFFILIATE_ID:
348
      return new Long(getMasterAffiliateId());
349
 
1860 vikas 350
    case ADDED_ON:
351
      return new Long(getAddedOn());
352
 
1847 vikas 353
    }
354
    throw new IllegalStateException();
355
  }
356
 
357
  public Object getFieldValue(int fieldId) {
358
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
359
  }
360
 
361
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
362
  public boolean isSet(_Fields field) {
363
    switch (field) {
364
    case ID:
365
      return isSetId();
366
    case NAME:
367
      return isSetName();
368
    case URL:
369
      return isSetUrl();
370
    case MASTER_AFFILIATE_ID:
371
      return isSetMasterAffiliateId();
1860 vikas 372
    case ADDED_ON:
373
      return isSetAddedOn();
1847 vikas 374
    }
375
    throw new IllegalStateException();
376
  }
377
 
378
  public boolean isSet(int fieldID) {
379
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
380
  }
381
 
382
  @Override
383
  public boolean equals(Object that) {
384
    if (that == null)
385
      return false;
386
    if (that instanceof Affiliate)
387
      return this.equals((Affiliate)that);
388
    return false;
389
  }
390
 
391
  public boolean equals(Affiliate that) {
392
    if (that == null)
393
      return false;
394
 
395
    boolean this_present_id = true;
396
    boolean that_present_id = true;
397
    if (this_present_id || that_present_id) {
398
      if (!(this_present_id && that_present_id))
399
        return false;
400
      if (this.id != that.id)
401
        return false;
402
    }
403
 
404
    boolean this_present_name = true && this.isSetName();
405
    boolean that_present_name = true && that.isSetName();
406
    if (this_present_name || that_present_name) {
407
      if (!(this_present_name && that_present_name))
408
        return false;
409
      if (!this.name.equals(that.name))
410
        return false;
411
    }
412
 
413
    boolean this_present_url = true && this.isSetUrl();
414
    boolean that_present_url = true && that.isSetUrl();
415
    if (this_present_url || that_present_url) {
416
      if (!(this_present_url && that_present_url))
417
        return false;
418
      if (!this.url.equals(that.url))
419
        return false;
420
    }
421
 
422
    boolean this_present_masterAffiliateId = true;
423
    boolean that_present_masterAffiliateId = true;
424
    if (this_present_masterAffiliateId || that_present_masterAffiliateId) {
425
      if (!(this_present_masterAffiliateId && that_present_masterAffiliateId))
426
        return false;
427
      if (this.masterAffiliateId != that.masterAffiliateId)
428
        return false;
429
    }
430
 
1860 vikas 431
    boolean this_present_addedOn = true;
432
    boolean that_present_addedOn = true;
433
    if (this_present_addedOn || that_present_addedOn) {
434
      if (!(this_present_addedOn && that_present_addedOn))
435
        return false;
436
      if (this.addedOn != that.addedOn)
437
        return false;
438
    }
439
 
1847 vikas 440
    return true;
441
  }
442
 
443
  @Override
444
  public int hashCode() {
445
    return 0;
446
  }
447
 
448
  public int compareTo(Affiliate other) {
449
    if (!getClass().equals(other.getClass())) {
450
      return getClass().getName().compareTo(other.getClass().getName());
451
    }
452
 
453
    int lastComparison = 0;
454
    Affiliate typedOther = (Affiliate)other;
455
 
456
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
457
    if (lastComparison != 0) {
458
      return lastComparison;
459
    }
460
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
461
    if (lastComparison != 0) {
462
      return lastComparison;
463
    }
464
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
465
    if (lastComparison != 0) {
466
      return lastComparison;
467
    }
468
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
469
    if (lastComparison != 0) {
470
      return lastComparison;
471
    }
472
    lastComparison = Boolean.valueOf(isSetUrl()).compareTo(isSetUrl());
473
    if (lastComparison != 0) {
474
      return lastComparison;
475
    }
476
    lastComparison = TBaseHelper.compareTo(url, typedOther.url);
477
    if (lastComparison != 0) {
478
      return lastComparison;
479
    }
480
    lastComparison = Boolean.valueOf(isSetMasterAffiliateId()).compareTo(isSetMasterAffiliateId());
481
    if (lastComparison != 0) {
482
      return lastComparison;
483
    }
484
    lastComparison = TBaseHelper.compareTo(masterAffiliateId, typedOther.masterAffiliateId);
485
    if (lastComparison != 0) {
486
      return lastComparison;
487
    }
1860 vikas 488
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(isSetAddedOn());
489
    if (lastComparison != 0) {
490
      return lastComparison;
491
    }
492
    lastComparison = TBaseHelper.compareTo(addedOn, typedOther.addedOn);
493
    if (lastComparison != 0) {
494
      return lastComparison;
495
    }
1847 vikas 496
    return 0;
497
  }
498
 
499
  public void read(TProtocol iprot) throws TException {
500
    TField field;
501
    iprot.readStructBegin();
502
    while (true)
503
    {
504
      field = iprot.readFieldBegin();
505
      if (field.type == TType.STOP) { 
506
        break;
507
      }
508
      _Fields fieldId = _Fields.findByThriftId(field.id);
509
      if (fieldId == null) {
510
        TProtocolUtil.skip(iprot, field.type);
511
      } else {
512
        switch (fieldId) {
513
          case ID:
514
            if (field.type == TType.I64) {
515
              this.id = iprot.readI64();
516
              setIdIsSet(true);
517
            } else { 
518
              TProtocolUtil.skip(iprot, field.type);
519
            }
520
            break;
521
          case NAME:
522
            if (field.type == TType.STRING) {
523
              this.name = iprot.readString();
524
            } else { 
525
              TProtocolUtil.skip(iprot, field.type);
526
            }
527
            break;
528
          case URL:
529
            if (field.type == TType.STRING) {
530
              this.url = iprot.readString();
531
            } else { 
532
              TProtocolUtil.skip(iprot, field.type);
533
            }
534
            break;
535
          case MASTER_AFFILIATE_ID:
536
            if (field.type == TType.I64) {
537
              this.masterAffiliateId = iprot.readI64();
538
              setMasterAffiliateIdIsSet(true);
539
            } else { 
540
              TProtocolUtil.skip(iprot, field.type);
541
            }
542
            break;
1860 vikas 543
          case ADDED_ON:
544
            if (field.type == TType.I64) {
545
              this.addedOn = iprot.readI64();
546
              setAddedOnIsSet(true);
547
            } else { 
548
              TProtocolUtil.skip(iprot, field.type);
549
            }
550
            break;
1847 vikas 551
        }
552
        iprot.readFieldEnd();
553
      }
554
    }
555
    iprot.readStructEnd();
556
    validate();
557
  }
558
 
559
  public void write(TProtocol oprot) throws TException {
560
    validate();
561
 
562
    oprot.writeStructBegin(STRUCT_DESC);
563
    oprot.writeFieldBegin(ID_FIELD_DESC);
564
    oprot.writeI64(this.id);
565
    oprot.writeFieldEnd();
566
    if (this.name != null) {
567
      oprot.writeFieldBegin(NAME_FIELD_DESC);
568
      oprot.writeString(this.name);
569
      oprot.writeFieldEnd();
570
    }
571
    if (this.url != null) {
572
      oprot.writeFieldBegin(URL_FIELD_DESC);
573
      oprot.writeString(this.url);
574
      oprot.writeFieldEnd();
575
    }
576
    oprot.writeFieldBegin(MASTER_AFFILIATE_ID_FIELD_DESC);
577
    oprot.writeI64(this.masterAffiliateId);
578
    oprot.writeFieldEnd();
1860 vikas 579
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
580
    oprot.writeI64(this.addedOn);
581
    oprot.writeFieldEnd();
1847 vikas 582
    oprot.writeFieldStop();
583
    oprot.writeStructEnd();
584
  }
585
 
586
  @Override
587
  public String toString() {
588
    StringBuilder sb = new StringBuilder("Affiliate(");
589
    boolean first = true;
590
 
591
    sb.append("id:");
592
    sb.append(this.id);
593
    first = false;
594
    if (!first) sb.append(", ");
595
    sb.append("name:");
596
    if (this.name == null) {
597
      sb.append("null");
598
    } else {
599
      sb.append(this.name);
600
    }
601
    first = false;
602
    if (!first) sb.append(", ");
603
    sb.append("url:");
604
    if (this.url == null) {
605
      sb.append("null");
606
    } else {
607
      sb.append(this.url);
608
    }
609
    first = false;
610
    if (!first) sb.append(", ");
611
    sb.append("masterAffiliateId:");
612
    sb.append(this.masterAffiliateId);
613
    first = false;
1860 vikas 614
    if (!first) sb.append(", ");
615
    sb.append("addedOn:");
616
    sb.append(this.addedOn);
617
    first = false;
1847 vikas 618
    sb.append(")");
619
    return sb.toString();
620
  }
621
 
622
  public void validate() throws TException {
623
    // check for required fields
624
  }
625
 
626
}
627