Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
6849 kshitij.so 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.catalog;
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 Banner implements org.apache.thrift.TBase<Banner, Banner._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Banner");
25
 
26
  private static final org.apache.thrift.protocol.TField BANNER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("bannerName", org.apache.thrift.protocol.TType.STRING, (short)1);
27
  private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField LINK_FIELD_DESC = new org.apache.thrift.protocol.TField("link", org.apache.thrift.protocol.TType.STRING, (short)3);
29
  private static final org.apache.thrift.protocol.TField PRIORITY_FIELD_DESC = new org.apache.thrift.protocol.TField("priority", org.apache.thrift.protocol.TType.I64, (short)4);
8579 kshitij.so 30
  private static final org.apache.thrift.protocol.TField HAS_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("hasMap", org.apache.thrift.protocol.TType.BOOL, (short)5);
6849 kshitij.so 31
 
32
  private String bannerName; // required
33
  private String imageName; // required
34
  private String link; // required
35
  private long priority; // required
36
  private boolean hasMap; // 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
    BANNER_NAME((short)1, "bannerName"),
41
    IMAGE_NAME((short)2, "imageName"),
42
    LINK((short)3, "link"),
43
    PRIORITY((short)4, "priority"),
8579 kshitij.so 44
    HAS_MAP((short)5, "hasMap");
6849 kshitij.so 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: // BANNER_NAME
60
          return BANNER_NAME;
61
        case 2: // IMAGE_NAME
62
          return IMAGE_NAME;
63
        case 3: // LINK
64
          return LINK;
65
        case 4: // PRIORITY
66
          return PRIORITY;
8579 kshitij.so 67
        case 5: // HAS_MAP
6849 kshitij.so 68
          return HAS_MAP;
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 __PRIORITY_ISSET_ID = 0;
8579 kshitij.so 110
  private static final int __HASMAP_ISSET_ID = 1;
111
  private BitSet __isset_bit_vector = new BitSet(2);
6849 kshitij.so 112
 
113
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
114
  static {
115
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
116
    tmpMap.put(_Fields.BANNER_NAME, new org.apache.thrift.meta_data.FieldMetaData("bannerName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
118
    tmpMap.put(_Fields.IMAGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("imageName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
119
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
120
    tmpMap.put(_Fields.LINK, new org.apache.thrift.meta_data.FieldMetaData("link", org.apache.thrift.TFieldRequirementType.DEFAULT, 
121
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
122
    tmpMap.put(_Fields.PRIORITY, new org.apache.thrift.meta_data.FieldMetaData("priority", org.apache.thrift.TFieldRequirementType.DEFAULT, 
123
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
124
    tmpMap.put(_Fields.HAS_MAP, new org.apache.thrift.meta_data.FieldMetaData("hasMap", org.apache.thrift.TFieldRequirementType.DEFAULT, 
125
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
126
    metaDataMap = Collections.unmodifiableMap(tmpMap);
127
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Banner.class, metaDataMap);
128
  }
129
 
130
  public Banner() {
131
  }
132
 
133
  public Banner(
134
    String bannerName,
135
    String imageName,
136
    String link,
137
    long priority,
138
    boolean hasMap)
139
  {
140
    this();
141
    this.bannerName = bannerName;
142
    this.imageName = imageName;
143
    this.link = link;
144
    this.priority = priority;
145
    setPriorityIsSet(true);
146
    this.hasMap = hasMap;
147
    setHasMapIsSet(true);
148
  }
149
 
150
  /**
151
   * Performs a deep copy on <i>other</i>.
152
   */
153
  public Banner(Banner other) {
154
    __isset_bit_vector.clear();
155
    __isset_bit_vector.or(other.__isset_bit_vector);
156
    if (other.isSetBannerName()) {
157
      this.bannerName = other.bannerName;
158
    }
159
    if (other.isSetImageName()) {
160
      this.imageName = other.imageName;
161
    }
162
    if (other.isSetLink()) {
163
      this.link = other.link;
164
    }
165
    this.priority = other.priority;
166
    this.hasMap = other.hasMap;
167
  }
168
 
169
  public Banner deepCopy() {
170
    return new Banner(this);
171
  }
172
 
173
  @Override
174
  public void clear() {
175
    this.bannerName = null;
176
    this.imageName = null;
177
    this.link = null;
178
    setPriorityIsSet(false);
179
    this.priority = 0;
180
    setHasMapIsSet(false);
181
    this.hasMap = false;
182
  }
183
 
184
  public String getBannerName() {
185
    return this.bannerName;
186
  }
187
 
188
  public void setBannerName(String bannerName) {
189
    this.bannerName = bannerName;
190
  }
191
 
192
  public void unsetBannerName() {
193
    this.bannerName = null;
194
  }
195
 
196
  /** Returns true if field bannerName is set (has been assigned a value) and false otherwise */
197
  public boolean isSetBannerName() {
198
    return this.bannerName != null;
199
  }
200
 
201
  public void setBannerNameIsSet(boolean value) {
202
    if (!value) {
203
      this.bannerName = null;
204
    }
205
  }
206
 
207
  public String getImageName() {
208
    return this.imageName;
209
  }
210
 
211
  public void setImageName(String imageName) {
212
    this.imageName = imageName;
213
  }
214
 
215
  public void unsetImageName() {
216
    this.imageName = null;
217
  }
218
 
219
  /** Returns true if field imageName is set (has been assigned a value) and false otherwise */
220
  public boolean isSetImageName() {
221
    return this.imageName != null;
222
  }
223
 
224
  public void setImageNameIsSet(boolean value) {
225
    if (!value) {
226
      this.imageName = null;
227
    }
228
  }
229
 
230
  public String getLink() {
231
    return this.link;
232
  }
233
 
234
  public void setLink(String link) {
235
    this.link = link;
236
  }
237
 
238
  public void unsetLink() {
239
    this.link = null;
240
  }
241
 
242
  /** Returns true if field link is set (has been assigned a value) and false otherwise */
243
  public boolean isSetLink() {
244
    return this.link != null;
245
  }
246
 
247
  public void setLinkIsSet(boolean value) {
248
    if (!value) {
249
      this.link = null;
250
    }
251
  }
252
 
253
  public long getPriority() {
254
    return this.priority;
255
  }
256
 
257
  public void setPriority(long priority) {
258
    this.priority = priority;
259
    setPriorityIsSet(true);
260
  }
261
 
262
  public void unsetPriority() {
263
    __isset_bit_vector.clear(__PRIORITY_ISSET_ID);
264
  }
265
 
266
  /** Returns true if field priority is set (has been assigned a value) and false otherwise */
267
  public boolean isSetPriority() {
268
    return __isset_bit_vector.get(__PRIORITY_ISSET_ID);
269
  }
270
 
271
  public void setPriorityIsSet(boolean value) {
272
    __isset_bit_vector.set(__PRIORITY_ISSET_ID, value);
273
  }
274
 
275
  public boolean isHasMap() {
276
    return this.hasMap;
277
  }
278
 
279
  public void setHasMap(boolean hasMap) {
280
    this.hasMap = hasMap;
281
    setHasMapIsSet(true);
282
  }
283
 
284
  public void unsetHasMap() {
285
    __isset_bit_vector.clear(__HASMAP_ISSET_ID);
286
  }
287
 
288
  /** Returns true if field hasMap is set (has been assigned a value) and false otherwise */
289
  public boolean isSetHasMap() {
290
    return __isset_bit_vector.get(__HASMAP_ISSET_ID);
291
  }
292
 
293
  public void setHasMapIsSet(boolean value) {
294
    __isset_bit_vector.set(__HASMAP_ISSET_ID, value);
295
  }
296
 
297
  public void setFieldValue(_Fields field, Object value) {
298
    switch (field) {
299
    case BANNER_NAME:
300
      if (value == null) {
301
        unsetBannerName();
302
      } else {
303
        setBannerName((String)value);
304
      }
305
      break;
306
 
307
    case IMAGE_NAME:
308
      if (value == null) {
309
        unsetImageName();
310
      } else {
311
        setImageName((String)value);
312
      }
313
      break;
314
 
315
    case LINK:
316
      if (value == null) {
317
        unsetLink();
318
      } else {
319
        setLink((String)value);
320
      }
321
      break;
322
 
323
    case PRIORITY:
324
      if (value == null) {
325
        unsetPriority();
326
      } else {
327
        setPriority((Long)value);
328
      }
329
      break;
330
 
331
    case HAS_MAP:
332
      if (value == null) {
333
        unsetHasMap();
334
      } else {
335
        setHasMap((Boolean)value);
336
      }
337
      break;
338
 
339
    }
340
  }
341
 
342
  public Object getFieldValue(_Fields field) {
343
    switch (field) {
344
    case BANNER_NAME:
345
      return getBannerName();
346
 
347
    case IMAGE_NAME:
348
      return getImageName();
349
 
350
    case LINK:
351
      return getLink();
352
 
353
    case PRIORITY:
354
      return Long.valueOf(getPriority());
355
 
356
    case HAS_MAP:
357
      return Boolean.valueOf(isHasMap());
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 BANNER_NAME:
371
      return isSetBannerName();
372
    case IMAGE_NAME:
373
      return isSetImageName();
374
    case LINK:
375
      return isSetLink();
376
    case PRIORITY:
377
      return isSetPriority();
378
    case HAS_MAP:
379
      return isSetHasMap();
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 Banner)
389
      return this.equals((Banner)that);
390
    return false;
391
  }
392
 
393
  public boolean equals(Banner that) {
394
    if (that == null)
395
      return false;
396
 
397
    boolean this_present_bannerName = true && this.isSetBannerName();
398
    boolean that_present_bannerName = true && that.isSetBannerName();
399
    if (this_present_bannerName || that_present_bannerName) {
400
      if (!(this_present_bannerName && that_present_bannerName))
401
        return false;
402
      if (!this.bannerName.equals(that.bannerName))
403
        return false;
404
    }
405
 
406
    boolean this_present_imageName = true && this.isSetImageName();
407
    boolean that_present_imageName = true && that.isSetImageName();
408
    if (this_present_imageName || that_present_imageName) {
409
      if (!(this_present_imageName && that_present_imageName))
410
        return false;
411
      if (!this.imageName.equals(that.imageName))
412
        return false;
413
    }
414
 
415
    boolean this_present_link = true && this.isSetLink();
416
    boolean that_present_link = true && that.isSetLink();
417
    if (this_present_link || that_present_link) {
418
      if (!(this_present_link && that_present_link))
419
        return false;
420
      if (!this.link.equals(that.link))
421
        return false;
422
    }
423
 
424
    boolean this_present_priority = true;
425
    boolean that_present_priority = true;
426
    if (this_present_priority || that_present_priority) {
427
      if (!(this_present_priority && that_present_priority))
428
        return false;
429
      if (this.priority != that.priority)
430
        return false;
431
    }
432
 
433
    boolean this_present_hasMap = true;
434
    boolean that_present_hasMap = true;
435
    if (this_present_hasMap || that_present_hasMap) {
436
      if (!(this_present_hasMap && that_present_hasMap))
437
        return false;
438
      if (this.hasMap != that.hasMap)
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(Banner other) {
451
    if (!getClass().equals(other.getClass())) {
452
      return getClass().getName().compareTo(other.getClass().getName());
453
    }
454
 
455
    int lastComparison = 0;
456
    Banner typedOther = (Banner)other;
457
 
458
    lastComparison = Boolean.valueOf(isSetBannerName()).compareTo(typedOther.isSetBannerName());
459
    if (lastComparison != 0) {
460
      return lastComparison;
461
    }
462
    if (isSetBannerName()) {
463
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bannerName, typedOther.bannerName);
464
      if (lastComparison != 0) {
465
        return lastComparison;
466
      }
467
    }
468
    lastComparison = Boolean.valueOf(isSetImageName()).compareTo(typedOther.isSetImageName());
469
    if (lastComparison != 0) {
470
      return lastComparison;
471
    }
472
    if (isSetImageName()) {
473
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageName, typedOther.imageName);
474
      if (lastComparison != 0) {
475
        return lastComparison;
476
      }
477
    }
478
    lastComparison = Boolean.valueOf(isSetLink()).compareTo(typedOther.isSetLink());
479
    if (lastComparison != 0) {
480
      return lastComparison;
481
    }
482
    if (isSetLink()) {
483
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.link, typedOther.link);
484
      if (lastComparison != 0) {
485
        return lastComparison;
486
      }
487
    }
488
    lastComparison = Boolean.valueOf(isSetPriority()).compareTo(typedOther.isSetPriority());
489
    if (lastComparison != 0) {
490
      return lastComparison;
491
    }
492
    if (isSetPriority()) {
493
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, typedOther.priority);
494
      if (lastComparison != 0) {
495
        return lastComparison;
496
      }
497
    }
498
    lastComparison = Boolean.valueOf(isSetHasMap()).compareTo(typedOther.isSetHasMap());
499
    if (lastComparison != 0) {
500
      return lastComparison;
501
    }
502
    if (isSetHasMap()) {
503
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasMap, typedOther.hasMap);
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: // BANNER_NAME
526
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
527
            this.bannerName = iprot.readString();
528
          } else { 
529
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
530
          }
531
          break;
532
        case 2: // IMAGE_NAME
533
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
534
            this.imageName = iprot.readString();
535
          } else { 
536
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
537
          }
538
          break;
539
        case 3: // LINK
540
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
541
            this.link = iprot.readString();
542
          } else { 
543
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
544
          }
545
          break;
546
        case 4: // PRIORITY
547
          if (field.type == org.apache.thrift.protocol.TType.I64) {
548
            this.priority = iprot.readI64();
549
            setPriorityIsSet(true);
550
          } else { 
551
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
552
          }
553
          break;
8579 kshitij.so 554
        case 5: // HAS_MAP
6849 kshitij.so 555
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
556
            this.hasMap = iprot.readBool();
557
            setHasMapIsSet(true);
558
          } else { 
559
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
560
          }
561
          break;
562
        default:
563
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
564
      }
565
      iprot.readFieldEnd();
566
    }
567
    iprot.readStructEnd();
568
    validate();
569
  }
570
 
571
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
572
    validate();
573
 
574
    oprot.writeStructBegin(STRUCT_DESC);
575
    if (this.bannerName != null) {
576
      oprot.writeFieldBegin(BANNER_NAME_FIELD_DESC);
577
      oprot.writeString(this.bannerName);
578
      oprot.writeFieldEnd();
579
    }
580
    if (this.imageName != null) {
581
      oprot.writeFieldBegin(IMAGE_NAME_FIELD_DESC);
582
      oprot.writeString(this.imageName);
583
      oprot.writeFieldEnd();
584
    }
585
    if (this.link != null) {
586
      oprot.writeFieldBegin(LINK_FIELD_DESC);
587
      oprot.writeString(this.link);
588
      oprot.writeFieldEnd();
589
    }
590
    oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
591
    oprot.writeI64(this.priority);
592
    oprot.writeFieldEnd();
593
    oprot.writeFieldBegin(HAS_MAP_FIELD_DESC);
594
    oprot.writeBool(this.hasMap);
595
    oprot.writeFieldEnd();
596
    oprot.writeFieldStop();
597
    oprot.writeStructEnd();
598
  }
599
 
600
  @Override
601
  public String toString() {
602
    StringBuilder sb = new StringBuilder("Banner(");
603
    boolean first = true;
604
 
605
    sb.append("bannerName:");
606
    if (this.bannerName == null) {
607
      sb.append("null");
608
    } else {
609
      sb.append(this.bannerName);
610
    }
611
    first = false;
612
    if (!first) sb.append(", ");
613
    sb.append("imageName:");
614
    if (this.imageName == null) {
615
      sb.append("null");
616
    } else {
617
      sb.append(this.imageName);
618
    }
619
    first = false;
620
    if (!first) sb.append(", ");
621
    sb.append("link:");
622
    if (this.link == null) {
623
      sb.append("null");
624
    } else {
625
      sb.append(this.link);
626
    }
627
    first = false;
628
    if (!first) sb.append(", ");
629
    sb.append("priority:");
630
    sb.append(this.priority);
631
    first = false;
632
    if (!first) sb.append(", ");
633
    sb.append("hasMap:");
634
    sb.append(this.hasMap);
635
    first = false;
636
    sb.append(")");
637
    return sb.toString();
638
  }
639
 
640
  public void validate() throws org.apache.thrift.TException {
641
    // check for required fields
642
  }
643
 
644
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
645
    try {
646
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
647
    } catch (org.apache.thrift.TException te) {
648
      throw new java.io.IOException(te);
649
    }
650
  }
651
 
652
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
653
    try {
654
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
655
      __isset_bit_vector = new BitSet(1);
656
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
657
    } catch (org.apache.thrift.TException te) {
658
      throw new java.io.IOException(te);
659
    }
660
  }
661
 
662
}
663