Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
8579 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 BannerUriMapping implements org.apache.thrift.TBase<BannerUriMapping, BannerUriMapping._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BannerUriMapping");
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 URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField IS_ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("isActive", org.apache.thrift.protocol.TType.BOOL, (short)3);
29
 
30
  private String bannerName; // required
31
  private String uri; // required
32
  private boolean isActive; // required
33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
36
    BANNER_NAME((short)1, "bannerName"),
37
    URI((short)2, "uri"),
38
    IS_ACTIVE((short)3, "isActive");
39
 
40
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
 
42
    static {
43
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
44
        byName.put(field.getFieldName(), field);
45
      }
46
    }
47
 
48
    /**
49
     * Find the _Fields constant that matches fieldId, or null if its not found.
50
     */
51
    public static _Fields findByThriftId(int fieldId) {
52
      switch(fieldId) {
53
        case 1: // BANNER_NAME
54
          return BANNER_NAME;
55
        case 2: // URI
56
          return URI;
57
        case 3: // IS_ACTIVE
58
          return IS_ACTIVE;
59
        default:
60
          return null;
61
      }
62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches fieldId, throwing an exception
66
     * if it is not found.
67
     */
68
    public static _Fields findByThriftIdOrThrow(int fieldId) {
69
      _Fields fields = findByThriftId(fieldId);
70
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
71
      return fields;
72
    }
73
 
74
    /**
75
     * Find the _Fields constant that matches name, or null if its not found.
76
     */
77
    public static _Fields findByName(String name) {
78
      return byName.get(name);
79
    }
80
 
81
    private final short _thriftId;
82
    private final String _fieldName;
83
 
84
    _Fields(short thriftId, String fieldName) {
85
      _thriftId = thriftId;
86
      _fieldName = fieldName;
87
    }
88
 
89
    public short getThriftFieldId() {
90
      return _thriftId;
91
    }
92
 
93
    public String getFieldName() {
94
      return _fieldName;
95
    }
96
  }
97
 
98
  // isset id assignments
99
  private static final int __ISACTIVE_ISSET_ID = 0;
100
  private BitSet __isset_bit_vector = new BitSet(1);
101
 
102
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
103
  static {
104
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
105
    tmpMap.put(_Fields.BANNER_NAME, new org.apache.thrift.meta_data.FieldMetaData("bannerName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
106
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
107
    tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
109
    tmpMap.put(_Fields.IS_ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("isActive", org.apache.thrift.TFieldRequirementType.DEFAULT, 
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
111
    metaDataMap = Collections.unmodifiableMap(tmpMap);
112
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BannerUriMapping.class, metaDataMap);
113
  }
114
 
115
  public BannerUriMapping() {
116
  }
117
 
118
  public BannerUriMapping(
119
    String bannerName,
120
    String uri,
121
    boolean isActive)
122
  {
123
    this();
124
    this.bannerName = bannerName;
125
    this.uri = uri;
126
    this.isActive = isActive;
127
    setIsActiveIsSet(true);
128
  }
129
 
130
  /**
131
   * Performs a deep copy on <i>other</i>.
132
   */
133
  public BannerUriMapping(BannerUriMapping other) {
134
    __isset_bit_vector.clear();
135
    __isset_bit_vector.or(other.__isset_bit_vector);
136
    if (other.isSetBannerName()) {
137
      this.bannerName = other.bannerName;
138
    }
139
    if (other.isSetUri()) {
140
      this.uri = other.uri;
141
    }
142
    this.isActive = other.isActive;
143
  }
144
 
145
  public BannerUriMapping deepCopy() {
146
    return new BannerUriMapping(this);
147
  }
148
 
149
  @Override
150
  public void clear() {
151
    this.bannerName = null;
152
    this.uri = null;
153
    setIsActiveIsSet(false);
154
    this.isActive = false;
155
  }
156
 
157
  public String getBannerName() {
158
    return this.bannerName;
159
  }
160
 
161
  public void setBannerName(String bannerName) {
162
    this.bannerName = bannerName;
163
  }
164
 
165
  public void unsetBannerName() {
166
    this.bannerName = null;
167
  }
168
 
169
  /** Returns true if field bannerName is set (has been assigned a value) and false otherwise */
170
  public boolean isSetBannerName() {
171
    return this.bannerName != null;
172
  }
173
 
174
  public void setBannerNameIsSet(boolean value) {
175
    if (!value) {
176
      this.bannerName = null;
177
    }
178
  }
179
 
180
  public String getUri() {
181
    return this.uri;
182
  }
183
 
184
  public void setUri(String uri) {
185
    this.uri = uri;
186
  }
187
 
188
  public void unsetUri() {
189
    this.uri = null;
190
  }
191
 
192
  /** Returns true if field uri is set (has been assigned a value) and false otherwise */
193
  public boolean isSetUri() {
194
    return this.uri != null;
195
  }
196
 
197
  public void setUriIsSet(boolean value) {
198
    if (!value) {
199
      this.uri = null;
200
    }
201
  }
202
 
203
  public boolean isIsActive() {
204
    return this.isActive;
205
  }
206
 
207
  public void setIsActive(boolean isActive) {
208
    this.isActive = isActive;
209
    setIsActiveIsSet(true);
210
  }
211
 
212
  public void unsetIsActive() {
213
    __isset_bit_vector.clear(__ISACTIVE_ISSET_ID);
214
  }
215
 
216
  /** Returns true if field isActive is set (has been assigned a value) and false otherwise */
217
  public boolean isSetIsActive() {
218
    return __isset_bit_vector.get(__ISACTIVE_ISSET_ID);
219
  }
220
 
221
  public void setIsActiveIsSet(boolean value) {
222
    __isset_bit_vector.set(__ISACTIVE_ISSET_ID, value);
223
  }
224
 
225
  public void setFieldValue(_Fields field, Object value) {
226
    switch (field) {
227
    case BANNER_NAME:
228
      if (value == null) {
229
        unsetBannerName();
230
      } else {
231
        setBannerName((String)value);
232
      }
233
      break;
234
 
235
    case URI:
236
      if (value == null) {
237
        unsetUri();
238
      } else {
239
        setUri((String)value);
240
      }
241
      break;
242
 
243
    case IS_ACTIVE:
244
      if (value == null) {
245
        unsetIsActive();
246
      } else {
247
        setIsActive((Boolean)value);
248
      }
249
      break;
250
 
251
    }
252
  }
253
 
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
256
    case BANNER_NAME:
257
      return getBannerName();
258
 
259
    case URI:
260
      return getUri();
261
 
262
    case IS_ACTIVE:
263
      return Boolean.valueOf(isIsActive());
264
 
265
    }
266
    throw new IllegalStateException();
267
  }
268
 
269
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
270
  public boolean isSet(_Fields field) {
271
    if (field == null) {
272
      throw new IllegalArgumentException();
273
    }
274
 
275
    switch (field) {
276
    case BANNER_NAME:
277
      return isSetBannerName();
278
    case URI:
279
      return isSetUri();
280
    case IS_ACTIVE:
281
      return isSetIsActive();
282
    }
283
    throw new IllegalStateException();
284
  }
285
 
286
  @Override
287
  public boolean equals(Object that) {
288
    if (that == null)
289
      return false;
290
    if (that instanceof BannerUriMapping)
291
      return this.equals((BannerUriMapping)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(BannerUriMapping that) {
296
    if (that == null)
297
      return false;
298
 
299
    boolean this_present_bannerName = true && this.isSetBannerName();
300
    boolean that_present_bannerName = true && that.isSetBannerName();
301
    if (this_present_bannerName || that_present_bannerName) {
302
      if (!(this_present_bannerName && that_present_bannerName))
303
        return false;
304
      if (!this.bannerName.equals(that.bannerName))
305
        return false;
306
    }
307
 
308
    boolean this_present_uri = true && this.isSetUri();
309
    boolean that_present_uri = true && that.isSetUri();
310
    if (this_present_uri || that_present_uri) {
311
      if (!(this_present_uri && that_present_uri))
312
        return false;
313
      if (!this.uri.equals(that.uri))
314
        return false;
315
    }
316
 
317
    boolean this_present_isActive = true;
318
    boolean that_present_isActive = true;
319
    if (this_present_isActive || that_present_isActive) {
320
      if (!(this_present_isActive && that_present_isActive))
321
        return false;
322
      if (this.isActive != that.isActive)
323
        return false;
324
    }
325
 
326
    return true;
327
  }
328
 
329
  @Override
330
  public int hashCode() {
331
    return 0;
332
  }
333
 
334
  public int compareTo(BannerUriMapping other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    BannerUriMapping typedOther = (BannerUriMapping)other;
341
 
342
    lastComparison = Boolean.valueOf(isSetBannerName()).compareTo(typedOther.isSetBannerName());
343
    if (lastComparison != 0) {
344
      return lastComparison;
345
    }
346
    if (isSetBannerName()) {
347
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bannerName, typedOther.bannerName);
348
      if (lastComparison != 0) {
349
        return lastComparison;
350
      }
351
    }
352
    lastComparison = Boolean.valueOf(isSetUri()).compareTo(typedOther.isSetUri());
353
    if (lastComparison != 0) {
354
      return lastComparison;
355
    }
356
    if (isSetUri()) {
357
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, typedOther.uri);
358
      if (lastComparison != 0) {
359
        return lastComparison;
360
      }
361
    }
362
    lastComparison = Boolean.valueOf(isSetIsActive()).compareTo(typedOther.isSetIsActive());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetIsActive()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isActive, typedOther.isActive);
368
      if (lastComparison != 0) {
369
        return lastComparison;
370
      }
371
    }
372
    return 0;
373
  }
374
 
375
  public _Fields fieldForId(int fieldId) {
376
    return _Fields.findByThriftId(fieldId);
377
  }
378
 
379
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
380
    org.apache.thrift.protocol.TField field;
381
    iprot.readStructBegin();
382
    while (true)
383
    {
384
      field = iprot.readFieldBegin();
385
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
386
        break;
387
      }
388
      switch (field.id) {
389
        case 1: // BANNER_NAME
390
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
391
            this.bannerName = iprot.readString();
392
          } else { 
393
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
394
          }
395
          break;
396
        case 2: // URI
397
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
398
            this.uri = iprot.readString();
399
          } else { 
400
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
401
          }
402
          break;
403
        case 3: // IS_ACTIVE
404
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
405
            this.isActive = iprot.readBool();
406
            setIsActiveIsSet(true);
407
          } else { 
408
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
409
          }
410
          break;
411
        default:
412
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
413
      }
414
      iprot.readFieldEnd();
415
    }
416
    iprot.readStructEnd();
417
    validate();
418
  }
419
 
420
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
421
    validate();
422
 
423
    oprot.writeStructBegin(STRUCT_DESC);
424
    if (this.bannerName != null) {
425
      oprot.writeFieldBegin(BANNER_NAME_FIELD_DESC);
426
      oprot.writeString(this.bannerName);
427
      oprot.writeFieldEnd();
428
    }
429
    if (this.uri != null) {
430
      oprot.writeFieldBegin(URI_FIELD_DESC);
431
      oprot.writeString(this.uri);
432
      oprot.writeFieldEnd();
433
    }
434
    oprot.writeFieldBegin(IS_ACTIVE_FIELD_DESC);
435
    oprot.writeBool(this.isActive);
436
    oprot.writeFieldEnd();
437
    oprot.writeFieldStop();
438
    oprot.writeStructEnd();
439
  }
440
 
441
  @Override
442
  public String toString() {
443
    StringBuilder sb = new StringBuilder("BannerUriMapping(");
444
    boolean first = true;
445
 
446
    sb.append("bannerName:");
447
    if (this.bannerName == null) {
448
      sb.append("null");
449
    } else {
450
      sb.append(this.bannerName);
451
    }
452
    first = false;
453
    if (!first) sb.append(", ");
454
    sb.append("uri:");
455
    if (this.uri == null) {
456
      sb.append("null");
457
    } else {
458
      sb.append(this.uri);
459
    }
460
    first = false;
461
    if (!first) sb.append(", ");
462
    sb.append("isActive:");
463
    sb.append(this.isActive);
464
    first = false;
465
    sb.append(")");
466
    return sb.toString();
467
  }
468
 
469
  public void validate() throws org.apache.thrift.TException {
470
    // check for required fields
471
  }
472
 
473
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
474
    try {
475
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
476
    } catch (org.apache.thrift.TException te) {
477
      throw new java.io.IOException(te);
478
    }
479
  }
480
 
481
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
482
    try {
483
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
484
      __isset_bit_vector = new BitSet(1);
485
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
486
    } catch (org.apache.thrift.TException te) {
487
      throw new java.io.IOException(te);
488
    }
489
  }
490
 
491
}
492