Subversion Repositories SmartDukaan

Rev

Rev 2717 | Go to most recent revision | Details | 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);
31
  private static final TField SLIDE_ID_FIELD_DESC = new TField("slide_id", TType.I64, (short)3);
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;
36
  private long slide_id;
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"),
43
    SLIDE_ID((short)3, "slide_id"),
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;
100
  private static final int __SLIDE_ID_ISSET_ID = 2;
101
  private BitSet __isset_bit_vector = new BitSet(3);
102
 
103
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
104
    put(_Fields.USER_ID, new FieldMetaData("user_id", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.I64)));
106
    put(_Fields.ENTITY_ID, new FieldMetaData("entity_id", TFieldRequirementType.DEFAULT, 
107
        new FieldValueMetaData(TType.I64)));
108
    put(_Fields.SLIDE_ID, new FieldMetaData("slide_id", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.I64)));
110
    put(_Fields.NOTE, new FieldMetaData("note", TFieldRequirementType.DEFAULT, 
111
        new FieldValueMetaData(TType.STRING)));
112
  }});
113
 
114
  static {
115
    FieldMetaData.addStructMetaDataMap(UserNote.class, metaDataMap);
116
  }
117
 
118
  public UserNote() {
119
  }
120
 
121
  public UserNote(
122
    long user_id,
123
    long entity_id,
124
    long slide_id,
125
    String note)
126
  {
127
    this();
128
    this.user_id = user_id;
129
    setUser_idIsSet(true);
130
    this.entity_id = entity_id;
131
    setEntity_idIsSet(true);
132
    this.slide_id = slide_id;
133
    setSlide_idIsSet(true);
134
    this.note = note;
135
  }
136
 
137
  /**
138
   * Performs a deep copy on <i>other</i>.
139
   */
140
  public UserNote(UserNote other) {
141
    __isset_bit_vector.clear();
142
    __isset_bit_vector.or(other.__isset_bit_vector);
143
    this.user_id = other.user_id;
144
    this.entity_id = other.entity_id;
145
    this.slide_id = other.slide_id;
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
 
206
  public long getSlide_id() {
207
    return this.slide_id;
208
  }
209
 
210
  public UserNote setSlide_id(long slide_id) {
211
    this.slide_id = slide_id;
212
    setSlide_idIsSet(true);
213
    return this;
214
  }
215
 
216
  public void unsetSlide_id() {
217
    __isset_bit_vector.clear(__SLIDE_ID_ISSET_ID);
218
  }
219
 
220
  /** Returns true if field slide_id is set (has been asigned a value) and false otherwise */
221
  public boolean isSetSlide_id() {
222
    return __isset_bit_vector.get(__SLIDE_ID_ISSET_ID);
223
  }
224
 
225
  public void setSlide_idIsSet(boolean value) {
226
    __isset_bit_vector.set(__SLIDE_ID_ISSET_ID, value);
227
  }
228
 
229
  public String getNote() {
230
    return this.note;
231
  }
232
 
233
  public UserNote setNote(String note) {
234
    this.note = note;
235
    return this;
236
  }
237
 
238
  public void unsetNote() {
239
    this.note = null;
240
  }
241
 
242
  /** Returns true if field note is set (has been asigned a value) and false otherwise */
243
  public boolean isSetNote() {
244
    return this.note != null;
245
  }
246
 
247
  public void setNoteIsSet(boolean value) {
248
    if (!value) {
249
      this.note = null;
250
    }
251
  }
252
 
253
  public void setFieldValue(_Fields field, Object value) {
254
    switch (field) {
255
    case USER_ID:
256
      if (value == null) {
257
        unsetUser_id();
258
      } else {
259
        setUser_id((Long)value);
260
      }
261
      break;
262
 
263
    case ENTITY_ID:
264
      if (value == null) {
265
        unsetEntity_id();
266
      } else {
267
        setEntity_id((Long)value);
268
      }
269
      break;
270
 
271
    case SLIDE_ID:
272
      if (value == null) {
273
        unsetSlide_id();
274
      } else {
275
        setSlide_id((Long)value);
276
      }
277
      break;
278
 
279
    case NOTE:
280
      if (value == null) {
281
        unsetNote();
282
      } else {
283
        setNote((String)value);
284
      }
285
      break;
286
 
287
    }
288
  }
289
 
290
  public void setFieldValue(int fieldID, Object value) {
291
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
292
  }
293
 
294
  public Object getFieldValue(_Fields field) {
295
    switch (field) {
296
    case USER_ID:
297
      return new Long(getUser_id());
298
 
299
    case ENTITY_ID:
300
      return new Long(getEntity_id());
301
 
302
    case SLIDE_ID:
303
      return new Long(getSlide_id());
304
 
305
    case NOTE:
306
      return getNote();
307
 
308
    }
309
    throw new IllegalStateException();
310
  }
311
 
312
  public Object getFieldValue(int fieldId) {
313
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
314
  }
315
 
316
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
317
  public boolean isSet(_Fields field) {
318
    switch (field) {
319
    case USER_ID:
320
      return isSetUser_id();
321
    case ENTITY_ID:
322
      return isSetEntity_id();
323
    case SLIDE_ID:
324
      return isSetSlide_id();
325
    case NOTE:
326
      return isSetNote();
327
    }
328
    throw new IllegalStateException();
329
  }
330
 
331
  public boolean isSet(int fieldID) {
332
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
333
  }
334
 
335
  @Override
336
  public boolean equals(Object that) {
337
    if (that == null)
338
      return false;
339
    if (that instanceof UserNote)
340
      return this.equals((UserNote)that);
341
    return false;
342
  }
343
 
344
  public boolean equals(UserNote that) {
345
    if (that == null)
346
      return false;
347
 
348
    boolean this_present_user_id = true;
349
    boolean that_present_user_id = true;
350
    if (this_present_user_id || that_present_user_id) {
351
      if (!(this_present_user_id && that_present_user_id))
352
        return false;
353
      if (this.user_id != that.user_id)
354
        return false;
355
    }
356
 
357
    boolean this_present_entity_id = true;
358
    boolean that_present_entity_id = true;
359
    if (this_present_entity_id || that_present_entity_id) {
360
      if (!(this_present_entity_id && that_present_entity_id))
361
        return false;
362
      if (this.entity_id != that.entity_id)
363
        return false;
364
    }
365
 
366
    boolean this_present_slide_id = true;
367
    boolean that_present_slide_id = true;
368
    if (this_present_slide_id || that_present_slide_id) {
369
      if (!(this_present_slide_id && that_present_slide_id))
370
        return false;
371
      if (this.slide_id != that.slide_id)
372
        return false;
373
    }
374
 
375
    boolean this_present_note = true && this.isSetNote();
376
    boolean that_present_note = true && that.isSetNote();
377
    if (this_present_note || that_present_note) {
378
      if (!(this_present_note && that_present_note))
379
        return false;
380
      if (!this.note.equals(that.note))
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(UserNote other) {
393
    if (!getClass().equals(other.getClass())) {
394
      return getClass().getName().compareTo(other.getClass().getName());
395
    }
396
 
397
    int lastComparison = 0;
398
    UserNote typedOther = (UserNote)other;
399
 
400
    lastComparison = Boolean.valueOf(isSetUser_id()).compareTo(isSetUser_id());
401
    if (lastComparison != 0) {
402
      return lastComparison;
403
    }
404
    lastComparison = TBaseHelper.compareTo(user_id, typedOther.user_id);
405
    if (lastComparison != 0) {
406
      return lastComparison;
407
    }
408
    lastComparison = Boolean.valueOf(isSetEntity_id()).compareTo(isSetEntity_id());
409
    if (lastComparison != 0) {
410
      return lastComparison;
411
    }
412
    lastComparison = TBaseHelper.compareTo(entity_id, typedOther.entity_id);
413
    if (lastComparison != 0) {
414
      return lastComparison;
415
    }
416
    lastComparison = Boolean.valueOf(isSetSlide_id()).compareTo(isSetSlide_id());
417
    if (lastComparison != 0) {
418
      return lastComparison;
419
    }
420
    lastComparison = TBaseHelper.compareTo(slide_id, typedOther.slide_id);
421
    if (lastComparison != 0) {
422
      return lastComparison;
423
    }
424
    lastComparison = Boolean.valueOf(isSetNote()).compareTo(isSetNote());
425
    if (lastComparison != 0) {
426
      return lastComparison;
427
    }
428
    lastComparison = TBaseHelper.compareTo(note, typedOther.note);
429
    if (lastComparison != 0) {
430
      return lastComparison;
431
    }
432
    return 0;
433
  }
434
 
435
  public void read(TProtocol iprot) throws TException {
436
    TField field;
437
    iprot.readStructBegin();
438
    while (true)
439
    {
440
      field = iprot.readFieldBegin();
441
      if (field.type == TType.STOP) { 
442
        break;
443
      }
444
      _Fields fieldId = _Fields.findByThriftId(field.id);
445
      if (fieldId == null) {
446
        TProtocolUtil.skip(iprot, field.type);
447
      } else {
448
        switch (fieldId) {
449
          case USER_ID:
450
            if (field.type == TType.I64) {
451
              this.user_id = iprot.readI64();
452
              setUser_idIsSet(true);
453
            } else { 
454
              TProtocolUtil.skip(iprot, field.type);
455
            }
456
            break;
457
          case ENTITY_ID:
458
            if (field.type == TType.I64) {
459
              this.entity_id = iprot.readI64();
460
              setEntity_idIsSet(true);
461
            } else { 
462
              TProtocolUtil.skip(iprot, field.type);
463
            }
464
            break;
465
          case SLIDE_ID:
466
            if (field.type == TType.I64) {
467
              this.slide_id = iprot.readI64();
468
              setSlide_idIsSet(true);
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();
498
    oprot.writeFieldBegin(SLIDE_ID_FIELD_DESC);
499
    oprot.writeI64(this.slide_id);
500
    oprot.writeFieldEnd();
501
    if (this.note != null) {
502
      oprot.writeFieldBegin(NOTE_FIELD_DESC);
503
      oprot.writeString(this.note);
504
      oprot.writeFieldEnd();
505
    }
506
    oprot.writeFieldStop();
507
    oprot.writeStructEnd();
508
  }
509
 
510
  @Override
511
  public String toString() {
512
    StringBuilder sb = new StringBuilder("UserNote(");
513
    boolean first = true;
514
 
515
    sb.append("user_id:");
516
    sb.append(this.user_id);
517
    first = false;
518
    if (!first) sb.append(", ");
519
    sb.append("entity_id:");
520
    sb.append(this.entity_id);
521
    first = false;
522
    if (!first) sb.append(", ");
523
    sb.append("slide_id:");
524
    sb.append(this.slide_id);
525
    first = false;
526
    if (!first) sb.append(", ");
527
    sb.append("note:");
528
    if (this.note == null) {
529
      sb.append("null");
530
    } else {
531
      sb.append(this.note);
532
    }
533
    first = false;
534
    sb.append(")");
535
    return sb.toString();
536
  }
537
 
538
  public void validate() throws TException {
539
    // check for required fields
540
  }
541
 
542
}
543