Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19686 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 BulkUploadCatalog implements org.apache.thrift.TBase<BulkUploadCatalog, BulkUploadCatalog._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BulkUploadCatalog");
25
 
26
  private static final org.apache.thrift.protocol.TField CATALOG_ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("catalog_item_id", org.apache.thrift.protocol.TType.I64, (short)1);
27
  private static final org.apache.thrift.protocol.TField BRAND_FIELD_DESC = new org.apache.thrift.protocol.TField("brand", org.apache.thrift.protocol.TType.STRING, (short)2);
28
  private static final org.apache.thrift.protocol.TField MODEL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("model_name", org.apache.thrift.protocol.TType.STRING, (short)3);
29
  private static final org.apache.thrift.protocol.TField MODEL_NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("model_number", org.apache.thrift.protocol.TType.STRING, (short)4);
30
 
31
  private long catalog_item_id; // required
32
  private String brand; // required
33
  private String model_name; // required
34
  private String model_number; // required
35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
38
    CATALOG_ITEM_ID((short)1, "catalog_item_id"),
39
    BRAND((short)2, "brand"),
40
    MODEL_NAME((short)3, "model_name"),
41
    MODEL_NUMBER((short)4, "model_number");
42
 
43
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
44
 
45
    static {
46
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
47
        byName.put(field.getFieldName(), field);
48
      }
49
    }
50
 
51
    /**
52
     * Find the _Fields constant that matches fieldId, or null if its not found.
53
     */
54
    public static _Fields findByThriftId(int fieldId) {
55
      switch(fieldId) {
56
        case 1: // CATALOG_ITEM_ID
57
          return CATALOG_ITEM_ID;
58
        case 2: // BRAND
59
          return BRAND;
60
        case 3: // MODEL_NAME
61
          return MODEL_NAME;
62
        case 4: // MODEL_NUMBER
63
          return MODEL_NUMBER;
64
        default:
65
          return null;
66
      }
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches fieldId, throwing an exception
71
     * if it is not found.
72
     */
73
    public static _Fields findByThriftIdOrThrow(int fieldId) {
74
      _Fields fields = findByThriftId(fieldId);
75
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
76
      return fields;
77
    }
78
 
79
    /**
80
     * Find the _Fields constant that matches name, or null if its not found.
81
     */
82
    public static _Fields findByName(String name) {
83
      return byName.get(name);
84
    }
85
 
86
    private final short _thriftId;
87
    private final String _fieldName;
88
 
89
    _Fields(short thriftId, String fieldName) {
90
      _thriftId = thriftId;
91
      _fieldName = fieldName;
92
    }
93
 
94
    public short getThriftFieldId() {
95
      return _thriftId;
96
    }
97
 
98
    public String getFieldName() {
99
      return _fieldName;
100
    }
101
  }
102
 
103
  // isset id assignments
104
  private static final int __CATALOG_ITEM_ID_ISSET_ID = 0;
105
  private BitSet __isset_bit_vector = new BitSet(1);
106
 
107
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
108
  static {
109
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
110
    tmpMap.put(_Fields.CATALOG_ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("catalog_item_id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
111
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
112
    tmpMap.put(_Fields.BRAND, new org.apache.thrift.meta_data.FieldMetaData("brand", org.apache.thrift.TFieldRequirementType.DEFAULT, 
113
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
114
    tmpMap.put(_Fields.MODEL_NAME, new org.apache.thrift.meta_data.FieldMetaData("model_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
115
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
116
    tmpMap.put(_Fields.MODEL_NUMBER, new org.apache.thrift.meta_data.FieldMetaData("model_number", org.apache.thrift.TFieldRequirementType.DEFAULT, 
117
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
118
    metaDataMap = Collections.unmodifiableMap(tmpMap);
119
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BulkUploadCatalog.class, metaDataMap);
120
  }
121
 
122
  public BulkUploadCatalog() {
123
  }
124
 
125
  public BulkUploadCatalog(
126
    long catalog_item_id,
127
    String brand,
128
    String model_name,
129
    String model_number)
130
  {
131
    this();
132
    this.catalog_item_id = catalog_item_id;
133
    setCatalog_item_idIsSet(true);
134
    this.brand = brand;
135
    this.model_name = model_name;
136
    this.model_number = model_number;
137
  }
138
 
139
  /**
140
   * Performs a deep copy on <i>other</i>.
141
   */
142
  public BulkUploadCatalog(BulkUploadCatalog other) {
143
    __isset_bit_vector.clear();
144
    __isset_bit_vector.or(other.__isset_bit_vector);
145
    this.catalog_item_id = other.catalog_item_id;
146
    if (other.isSetBrand()) {
147
      this.brand = other.brand;
148
    }
149
    if (other.isSetModel_name()) {
150
      this.model_name = other.model_name;
151
    }
152
    if (other.isSetModel_number()) {
153
      this.model_number = other.model_number;
154
    }
155
  }
156
 
157
  public BulkUploadCatalog deepCopy() {
158
    return new BulkUploadCatalog(this);
159
  }
160
 
161
  @Override
162
  public void clear() {
163
    setCatalog_item_idIsSet(false);
164
    this.catalog_item_id = 0;
165
    this.brand = null;
166
    this.model_name = null;
167
    this.model_number = null;
168
  }
169
 
170
  public long getCatalog_item_id() {
171
    return this.catalog_item_id;
172
  }
173
 
174
  public void setCatalog_item_id(long catalog_item_id) {
175
    this.catalog_item_id = catalog_item_id;
176
    setCatalog_item_idIsSet(true);
177
  }
178
 
179
  public void unsetCatalog_item_id() {
180
    __isset_bit_vector.clear(__CATALOG_ITEM_ID_ISSET_ID);
181
  }
182
 
183
  /** Returns true if field catalog_item_id is set (has been assigned a value) and false otherwise */
184
  public boolean isSetCatalog_item_id() {
185
    return __isset_bit_vector.get(__CATALOG_ITEM_ID_ISSET_ID);
186
  }
187
 
188
  public void setCatalog_item_idIsSet(boolean value) {
189
    __isset_bit_vector.set(__CATALOG_ITEM_ID_ISSET_ID, value);
190
  }
191
 
192
  public String getBrand() {
193
    return this.brand;
194
  }
195
 
196
  public void setBrand(String brand) {
197
    this.brand = brand;
198
  }
199
 
200
  public void unsetBrand() {
201
    this.brand = null;
202
  }
203
 
204
  /** Returns true if field brand is set (has been assigned a value) and false otherwise */
205
  public boolean isSetBrand() {
206
    return this.brand != null;
207
  }
208
 
209
  public void setBrandIsSet(boolean value) {
210
    if (!value) {
211
      this.brand = null;
212
    }
213
  }
214
 
215
  public String getModel_name() {
216
    return this.model_name;
217
  }
218
 
219
  public void setModel_name(String model_name) {
220
    this.model_name = model_name;
221
  }
222
 
223
  public void unsetModel_name() {
224
    this.model_name = null;
225
  }
226
 
227
  /** Returns true if field model_name is set (has been assigned a value) and false otherwise */
228
  public boolean isSetModel_name() {
229
    return this.model_name != null;
230
  }
231
 
232
  public void setModel_nameIsSet(boolean value) {
233
    if (!value) {
234
      this.model_name = null;
235
    }
236
  }
237
 
238
  public String getModel_number() {
239
    return this.model_number;
240
  }
241
 
242
  public void setModel_number(String model_number) {
243
    this.model_number = model_number;
244
  }
245
 
246
  public void unsetModel_number() {
247
    this.model_number = null;
248
  }
249
 
250
  /** Returns true if field model_number is set (has been assigned a value) and false otherwise */
251
  public boolean isSetModel_number() {
252
    return this.model_number != null;
253
  }
254
 
255
  public void setModel_numberIsSet(boolean value) {
256
    if (!value) {
257
      this.model_number = null;
258
    }
259
  }
260
 
261
  public void setFieldValue(_Fields field, Object value) {
262
    switch (field) {
263
    case CATALOG_ITEM_ID:
264
      if (value == null) {
265
        unsetCatalog_item_id();
266
      } else {
267
        setCatalog_item_id((Long)value);
268
      }
269
      break;
270
 
271
    case BRAND:
272
      if (value == null) {
273
        unsetBrand();
274
      } else {
275
        setBrand((String)value);
276
      }
277
      break;
278
 
279
    case MODEL_NAME:
280
      if (value == null) {
281
        unsetModel_name();
282
      } else {
283
        setModel_name((String)value);
284
      }
285
      break;
286
 
287
    case MODEL_NUMBER:
288
      if (value == null) {
289
        unsetModel_number();
290
      } else {
291
        setModel_number((String)value);
292
      }
293
      break;
294
 
295
    }
296
  }
297
 
298
  public Object getFieldValue(_Fields field) {
299
    switch (field) {
300
    case CATALOG_ITEM_ID:
301
      return Long.valueOf(getCatalog_item_id());
302
 
303
    case BRAND:
304
      return getBrand();
305
 
306
    case MODEL_NAME:
307
      return getModel_name();
308
 
309
    case MODEL_NUMBER:
310
      return getModel_number();
311
 
312
    }
313
    throw new IllegalStateException();
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    if (field == null) {
319
      throw new IllegalArgumentException();
320
    }
321
 
322
    switch (field) {
323
    case CATALOG_ITEM_ID:
324
      return isSetCatalog_item_id();
325
    case BRAND:
326
      return isSetBrand();
327
    case MODEL_NAME:
328
      return isSetModel_name();
329
    case MODEL_NUMBER:
330
      return isSetModel_number();
331
    }
332
    throw new IllegalStateException();
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof BulkUploadCatalog)
340
      return this.equals((BulkUploadCatalog)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(BulkUploadCatalog that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_catalog_item_id = true;
349
    boolean that_present_catalog_item_id = true;
350
    if (this_present_catalog_item_id || that_present_catalog_item_id) {
351
      if (!(this_present_catalog_item_id && that_present_catalog_item_id))
352
        return false;
353
      if (this.catalog_item_id != that.catalog_item_id)
354
        return false;
355
    }
356
 
357
    boolean this_present_brand = true && this.isSetBrand();
358
    boolean that_present_brand = true && that.isSetBrand();
359
    if (this_present_brand || that_present_brand) {
360
      if (!(this_present_brand && that_present_brand))
361
        return false;
362
      if (!this.brand.equals(that.brand))
363
        return false;
364
    }
365
 
366
    boolean this_present_model_name = true && this.isSetModel_name();
367
    boolean that_present_model_name = true && that.isSetModel_name();
368
    if (this_present_model_name || that_present_model_name) {
369
      if (!(this_present_model_name && that_present_model_name))
370
        return false;
371
      if (!this.model_name.equals(that.model_name))
372
        return false;
373
    }
374
 
375
    boolean this_present_model_number = true && this.isSetModel_number();
376
    boolean that_present_model_number = true && that.isSetModel_number();
377
    if (this_present_model_number || that_present_model_number) {
378
      if (!(this_present_model_number && that_present_model_number))
379
        return false;
380
      if (!this.model_number.equals(that.model_number))
381
        return false;
382
    }
383
 
384
    return true;
385
  }
386
 
387
  @Override
388
  public int hashCode() {
389
    return 0;
390
  }
391
 
392
  public int compareTo(BulkUploadCatalog other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    BulkUploadCatalog typedOther = (BulkUploadCatalog)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetCatalog_item_id()).compareTo(typedOther.isSetCatalog_item_id());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    if (isSetCatalog_item_id()) {
405
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catalog_item_id, typedOther.catalog_item_id);
406
      if (lastComparison != 0) {
407
        return lastComparison;
408
      }
409
    }
410
    lastComparison = Boolean.valueOf(isSetBrand()).compareTo(typedOther.isSetBrand());
411
    if (lastComparison != 0) {
412
      return lastComparison;
413
    }
414
    if (isSetBrand()) {
415
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.brand, typedOther.brand);
416
      if (lastComparison != 0) {
417
        return lastComparison;
418
      }
419
    }
420
    lastComparison = Boolean.valueOf(isSetModel_name()).compareTo(typedOther.isSetModel_name());
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    if (isSetModel_name()) {
425
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.model_name, typedOther.model_name);
426
      if (lastComparison != 0) {
427
        return lastComparison;
428
      }
429
    }
430
    lastComparison = Boolean.valueOf(isSetModel_number()).compareTo(typedOther.isSetModel_number());
431
    if (lastComparison != 0) {
432
      return lastComparison;
433
    }
434
    if (isSetModel_number()) {
435
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.model_number, typedOther.model_number);
436
      if (lastComparison != 0) {
437
        return lastComparison;
438
      }
439
    }
440
    return 0;
441
  }
442
 
443
  public _Fields fieldForId(int fieldId) {
444
    return _Fields.findByThriftId(fieldId);
445
  }
446
 
447
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
448
    org.apache.thrift.protocol.TField field;
449
    iprot.readStructBegin();
450
    while (true)
451
    {
452
      field = iprot.readFieldBegin();
453
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
454
        break;
455
      }
456
      switch (field.id) {
457
        case 1: // CATALOG_ITEM_ID
458
          if (field.type == org.apache.thrift.protocol.TType.I64) {
459
            this.catalog_item_id = iprot.readI64();
460
            setCatalog_item_idIsSet(true);
461
          } else { 
462
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
463
          }
464
          break;
465
        case 2: // BRAND
466
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
467
            this.brand = iprot.readString();
468
          } else { 
469
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
470
          }
471
          break;
472
        case 3: // MODEL_NAME
473
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
474
            this.model_name = iprot.readString();
475
          } else { 
476
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
477
          }
478
          break;
479
        case 4: // MODEL_NUMBER
480
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
481
            this.model_number = iprot.readString();
482
          } else { 
483
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
484
          }
485
          break;
486
        default:
487
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
488
      }
489
      iprot.readFieldEnd();
490
    }
491
    iprot.readStructEnd();
492
    validate();
493
  }
494
 
495
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
496
    validate();
497
 
498
    oprot.writeStructBegin(STRUCT_DESC);
499
    oprot.writeFieldBegin(CATALOG_ITEM_ID_FIELD_DESC);
500
    oprot.writeI64(this.catalog_item_id);
501
    oprot.writeFieldEnd();
502
    if (this.brand != null) {
503
      oprot.writeFieldBegin(BRAND_FIELD_DESC);
504
      oprot.writeString(this.brand);
505
      oprot.writeFieldEnd();
506
    }
507
    if (this.model_name != null) {
508
      oprot.writeFieldBegin(MODEL_NAME_FIELD_DESC);
509
      oprot.writeString(this.model_name);
510
      oprot.writeFieldEnd();
511
    }
512
    if (this.model_number != null) {
513
      oprot.writeFieldBegin(MODEL_NUMBER_FIELD_DESC);
514
      oprot.writeString(this.model_number);
515
      oprot.writeFieldEnd();
516
    }
517
    oprot.writeFieldStop();
518
    oprot.writeStructEnd();
519
  }
520
 
521
  @Override
522
  public String toString() {
523
    StringBuilder sb = new StringBuilder("BulkUploadCatalog(");
524
    boolean first = true;
525
 
526
    sb.append("catalog_item_id:");
527
    sb.append(this.catalog_item_id);
528
    first = false;
529
    if (!first) sb.append(", ");
530
    sb.append("brand:");
531
    if (this.brand == null) {
532
      sb.append("null");
533
    } else {
534
      sb.append(this.brand);
535
    }
536
    first = false;
537
    if (!first) sb.append(", ");
538
    sb.append("model_name:");
539
    if (this.model_name == null) {
540
      sb.append("null");
541
    } else {
542
      sb.append(this.model_name);
543
    }
544
    first = false;
545
    if (!first) sb.append(", ");
546
    sb.append("model_number:");
547
    if (this.model_number == null) {
548
      sb.append("null");
549
    } else {
550
      sb.append(this.model_number);
551
    }
552
    first = false;
553
    sb.append(")");
554
    return sb.toString();
555
  }
556
 
557
  public void validate() throws org.apache.thrift.TException {
558
    // check for required fields
559
  }
560
 
561
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
562
    try {
563
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
564
    } catch (org.apache.thrift.TException te) {
565
      throw new java.io.IOException(te);
566
    }
567
  }
568
 
569
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
570
    try {
571
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
572
      __isset_bit_vector = new BitSet(1);
573
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
574
    } catch (org.apache.thrift.TException te) {
575
      throw new java.io.IOException(te);
576
    }
577
  }
578
 
579
}
580