Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
2643 varun.gupt 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 UserNote implements TBase<UserNote._Fields>, java.io.Serializable, Cloneable, Comparable<UserNote> {
27
  private static final TStruct STRUCT_DESC = new TStruct("UserNote");
28
 
29
  private static final TField USER_ID_FIELD_DESC = new TField("user_id", TType.I64, (short)1);
30
  private static final TField ENTITY_ID_FIELD_DESC = new TField("entity_id", TType.I64, (short)2);
2717 varun.gupt 31
  private static final TField SLIDE_FIELD_DESC = new TField("slide", TType.STRING, (short)3);
2643 varun.gupt 32
  private static final TField NOTE_FIELD_DESC = new TField("note", TType.STRING, (short)4);
33
 
34
  private long user_id;
35
  private long entity_id;
2717 varun.gupt 36
  private String slide;
2643 varun.gupt 37
  private String note;
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
    USER_ID((short)1, "user_id"),
42
    ENTITY_ID((short)2, "entity_id"),
2717 varun.gupt 43
    SLIDE((short)3, "slide"),
2643 varun.gupt 44
    NOTE((short)4, "note");
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 __USER_ID_ISSET_ID = 0;
99
  private static final int __ENTITY_ID_ISSET_ID = 1;
2717 varun.gupt 100
  private BitSet __isset_bit_vector = new BitSet(2);
2643 varun.gupt 101
 
102
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
103
    put(_Fields.USER_ID, new FieldMetaData("user_id", TFieldRequirementType.DEFAULT, 
104
        new FieldValueMetaData(TType.I64)));
105
    put(_Fields.ENTITY_ID, new FieldMetaData("entity_id", TFieldRequirementType.DEFAULT, 
106
        new FieldValueMetaData(TType.I64)));
2717 varun.gupt 107
    put(_Fields.SLIDE, new FieldMetaData("slide", TFieldRequirementType.DEFAULT, 
108
        new FieldValueMetaData(TType.STRING)));
2643 varun.gupt 109
    put(_Fields.NOTE, new FieldMetaData("note", TFieldRequirementType.DEFAULT, 
110
        new FieldValueMetaData(TType.STRING)));
111
  }});
112
 
113
  static {
114
    FieldMetaData.addStructMetaDataMap(UserNote.class, metaDataMap);
115
  }
116
 
117
  public UserNote() {
118
  }
119
 
120
  public UserNote(
121
    long user_id,
122
    long entity_id,
2717 varun.gupt 123
    String slide,
2643 varun.gupt 124
    String note)
125
  {
126
    this();
127
    this.user_id = user_id;
128
    setUser_idIsSet(true);
129
    this.entity_id = entity_id;
130
    setEntity_idIsSet(true);
2717 varun.gupt 131
    this.slide = slide;
2643 varun.gupt 132
    this.note = note;
133
  }
134
 
135
  /**
136
   * Performs a deep copy on <i>other</i>.
137
   */
138
  public UserNote(UserNote other) {
139
    __isset_bit_vector.clear();
140
    __isset_bit_vector.or(other.__isset_bit_vector);
141
    this.user_id = other.user_id;
142
    this.entity_id = other.entity_id;
2717 varun.gupt 143
    if (other.isSetSlide()) {
144
      this.slide = other.slide;
145
    }
2643 varun.gupt 146
    if (other.isSetNote()) {
147
      this.note = other.note;
148
    }
149
  }
150
 
151
  public UserNote deepCopy() {
152
    return new UserNote(this);
153
  }
154
 
155
  @Deprecated
156
  public UserNote clone() {
157
    return new UserNote(this);
158
  }
159
 
160
  public long getUser_id() {
161
    return this.user_id;
162
  }
163
 
164
  public UserNote setUser_id(long user_id) {
165
    this.user_id = user_id;
166
    setUser_idIsSet(true);
167
    return this;
168
  }
169
 
170
  public void unsetUser_id() {
171
    __isset_bit_vector.clear(__USER_ID_ISSET_ID);
172
  }
173
 
174
  /** Returns true if field user_id is set (has been asigned a value) and false otherwise */
175
  public boolean isSetUser_id() {
176
    return __isset_bit_vector.get(__USER_ID_ISSET_ID);
177
  }
178
 
179
  public void setUser_idIsSet(boolean value) {
180
    __isset_bit_vector.set(__USER_ID_ISSET_ID, value);
181
  }
182
 
183
  public long getEntity_id() {
184
    return this.entity_id;
185
  }
186
 
187
  public UserNote setEntity_id(long entity_id) {
188
    this.entity_id = entity_id;
189
    setEntity_idIsSet(true);
190
    return this;
191
  }
192
 
193
  public void unsetEntity_id() {
194
    __isset_bit_vector.clear(__ENTITY_ID_ISSET_ID);
195
  }
196
 
197
  /** Returns true if field entity_id is set (has been asigned a value) and false otherwise */
198
  public boolean isSetEntity_id() {
199
    return __isset_bit_vector.get(__ENTITY_ID_ISSET_ID);
200
  }
201
 
202
  public void setEntity_idIsSet(boolean value) {
203
    __isset_bit_vector.set(__ENTITY_ID_ISSET_ID, value);
204
  }
205
 
2717 varun.gupt 206
  public String getSlide() {
207
    return this.slide;
2643 varun.gupt 208
  }
209
 
2717 varun.gupt 210
  public UserNote setSlide(String slide) {
211
    this.slide = slide;
2643 varun.gupt 212
    return this;
213
  }
214
 
2717 varun.gupt 215
  public void unsetSlide() {
216
    this.slide = null;
2643 varun.gupt 217
  }
218
 
2717 varun.gupt 219
  /** Returns true if field slide is set (has been asigned a value) and false otherwise */
220
  public boolean isSetSlide() {
221
    return this.slide != null;
2643 varun.gupt 222
  }
223
 
2717 varun.gupt 224
  public void setSlideIsSet(boolean value) {
225
    if (!value) {
226
      this.slide = null;
227
    }
2643 varun.gupt 228
  }
229
 
230
  public String getNote() {
231
    return this.note;
232
  }
233
 
234
  public UserNote setNote(String note) {
235
    this.note = note;
236
    return this;
237
  }
238
 
239
  public void unsetNote() {
240
    this.note = null;
241
  }
242
 
243
  /** Returns true if field note is set (has been asigned a value) and false otherwise */
244
  public boolean isSetNote() {
245
    return this.note != null;
246
  }
247
 
248
  public void setNoteIsSet(boolean value) {
249
    if (!value) {
250
      this.note = null;
251
    }
252
  }
253
 
254
  public void setFieldValue(_Fields field, Object value) {
255
    switch (field) {
256
    case USER_ID:
257
      if (value == null) {
258
        unsetUser_id();
259
      } else {
260
        setUser_id((Long)value);
261
      }
262
      break;
263
 
264
    case ENTITY_ID:
265
      if (value == null) {
266
        unsetEntity_id();
267
      } else {
268
        setEntity_id((Long)value);
269
      }
270
      break;
271
 
2717 varun.gupt 272
    case SLIDE:
2643 varun.gupt 273
      if (value == null) {
2717 varun.gupt 274
        unsetSlide();
2643 varun.gupt 275
      } else {
2717 varun.gupt 276
        setSlide((String)value);
2643 varun.gupt 277
      }
278
      break;
279
 
280
    case NOTE:
281
      if (value == null) {
282
        unsetNote();
283
      } else {
284
        setNote((String)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 USER_ID:
298
      return new Long(getUser_id());
299
 
300
    case ENTITY_ID:
301
      return new Long(getEntity_id());
302
 
2717 varun.gupt 303
    case SLIDE:
304
      return getSlide();
2643 varun.gupt 305
 
306
    case NOTE:
307
      return getNote();
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 USER_ID:
321
      return isSetUser_id();
322
    case ENTITY_ID:
323
      return isSetEntity_id();
2717 varun.gupt 324
    case SLIDE:
325
      return isSetSlide();
2643 varun.gupt 326
    case NOTE:
327
      return isSetNote();
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 UserNote)
341
      return this.equals((UserNote)that);
342
    return false;
343
  }
344
 
345
  public boolean equals(UserNote that) {
346
    if (that == null)
347
      return false;
348
 
349
    boolean this_present_user_id = true;
350
    boolean that_present_user_id = true;
351
    if (this_present_user_id || that_present_user_id) {
352
      if (!(this_present_user_id && that_present_user_id))
353
        return false;
354
      if (this.user_id != that.user_id)
355
        return false;
356
    }
357
 
358
    boolean this_present_entity_id = true;
359
    boolean that_present_entity_id = true;
360
    if (this_present_entity_id || that_present_entity_id) {
361
      if (!(this_present_entity_id && that_present_entity_id))
362
        return false;
363
      if (this.entity_id != that.entity_id)
364
        return false;
365
    }
366
 
2717 varun.gupt 367
    boolean this_present_slide = true && this.isSetSlide();
368
    boolean that_present_slide = true && that.isSetSlide();
369
    if (this_present_slide || that_present_slide) {
370
      if (!(this_present_slide && that_present_slide))
2643 varun.gupt 371
        return false;
2717 varun.gupt 372
      if (!this.slide.equals(that.slide))
2643 varun.gupt 373
        return false;
374
    }
375
 
376
    boolean this_present_note = true && this.isSetNote();
377
    boolean that_present_note = true && that.isSetNote();
378
    if (this_present_note || that_present_note) {
379
      if (!(this_present_note && that_present_note))
380
        return false;
381
      if (!this.note.equals(that.note))
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(UserNote other) {
394
    if (!getClass().equals(other.getClass())) {
395
      return getClass().getName().compareTo(other.getClass().getName());
396
    }
397
 
398
    int lastComparison = 0;
399
    UserNote typedOther = (UserNote)other;
400
 
401
    lastComparison = Boolean.valueOf(isSetUser_id()).compareTo(isSetUser_id());
402
    if (lastComparison != 0) {
403
      return lastComparison;
404
    }
405
    lastComparison = TBaseHelper.compareTo(user_id, typedOther.user_id);
406
    if (lastComparison != 0) {
407
      return lastComparison;
408
    }
409
    lastComparison = Boolean.valueOf(isSetEntity_id()).compareTo(isSetEntity_id());
410
    if (lastComparison != 0) {
411
      return lastComparison;
412
    }
413
    lastComparison = TBaseHelper.compareTo(entity_id, typedOther.entity_id);
414
    if (lastComparison != 0) {
415
      return lastComparison;
416
    }
2717 varun.gupt 417
    lastComparison = Boolean.valueOf(isSetSlide()).compareTo(isSetSlide());
2643 varun.gupt 418
    if (lastComparison != 0) {
419
      return lastComparison;
420
    }
2717 varun.gupt 421
    lastComparison = TBaseHelper.compareTo(slide, typedOther.slide);
2643 varun.gupt 422
    if (lastComparison != 0) {
423
      return lastComparison;
424
    }
425
    lastComparison = Boolean.valueOf(isSetNote()).compareTo(isSetNote());
426
    if (lastComparison != 0) {
427
      return lastComparison;
428
    }
429
    lastComparison = TBaseHelper.compareTo(note, typedOther.note);
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 USER_ID:
451
            if (field.type == TType.I64) {
452
              this.user_id = iprot.readI64();
453
              setUser_idIsSet(true);
454
            } else { 
455
              TProtocolUtil.skip(iprot, field.type);
456
            }
457
            break;
458
          case ENTITY_ID:
459
            if (field.type == TType.I64) {
460
              this.entity_id = iprot.readI64();
461
              setEntity_idIsSet(true);
462
            } else { 
463
              TProtocolUtil.skip(iprot, field.type);
464
            }
465
            break;
2717 varun.gupt 466
          case SLIDE:
467
            if (field.type == TType.STRING) {
468
              this.slide = iprot.readString();
2643 varun.gupt 469
            } else { 
470
              TProtocolUtil.skip(iprot, field.type);
471
            }
472
            break;
473
          case NOTE:
474
            if (field.type == TType.STRING) {
475
              this.note = iprot.readString();
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(USER_ID_FIELD_DESC);
493
    oprot.writeI64(this.user_id);
494
    oprot.writeFieldEnd();
495
    oprot.writeFieldBegin(ENTITY_ID_FIELD_DESC);
496
    oprot.writeI64(this.entity_id);
497
    oprot.writeFieldEnd();
2717 varun.gupt 498
    if (this.slide != null) {
499
      oprot.writeFieldBegin(SLIDE_FIELD_DESC);
500
      oprot.writeString(this.slide);
501
      oprot.writeFieldEnd();
502
    }
2643 varun.gupt 503
    if (this.note != null) {
504
      oprot.writeFieldBegin(NOTE_FIELD_DESC);
505
      oprot.writeString(this.note);
506
      oprot.writeFieldEnd();
507
    }
508
    oprot.writeFieldStop();
509
    oprot.writeStructEnd();
510
  }
511
 
512
  @Override
513
  public String toString() {
514
    StringBuilder sb = new StringBuilder("UserNote(");
515
    boolean first = true;
516
 
517
    sb.append("user_id:");
518
    sb.append(this.user_id);
519
    first = false;
520
    if (!first) sb.append(", ");
521
    sb.append("entity_id:");
522
    sb.append(this.entity_id);
523
    first = false;
524
    if (!first) sb.append(", ");
2717 varun.gupt 525
    sb.append("slide:");
526
    if (this.slide == null) {
527
      sb.append("null");
528
    } else {
529
      sb.append(this.slide);
530
    }
2643 varun.gupt 531
    first = false;
532
    if (!first) sb.append(", ");
533
    sb.append("note:");
534
    if (this.note == null) {
535
      sb.append("null");
536
    } else {
537
      sb.append(this.note);
538
    }
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