Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 ashish 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 TUserContext implements TBase<TUserContext._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("TUserContext");
28
 
29
  private static final TField PRIMARY_INFO_FIELD_DESC = new TField("primaryInfo", TType.STRUCT, (short)1);
30
  private static final TField INTERNAL_INFO_FIELD_DESC = new TField("internalInfo", TType.STRUCT, (short)2);
31
  private static final TField USER_STATE_FIELD_DESC = new TField("userState", TType.STRUCT, (short)3);
32
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)4);
33
 
34
  private TUserPrimaryInfo primaryInfo;
35
  private TUserInternalInfo internalInfo;
36
  private TUserState userState;
37
  private long id;
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
    PRIMARY_INFO((short)1, "primaryInfo"),
42
    INTERNAL_INFO((short)2, "internalInfo"),
43
    USER_STATE((short)3, "userState"),
44
    ID((short)4, "id");
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 __ID_ISSET_ID = 0;
99
  private BitSet __isset_bit_vector = new BitSet(1);
100
 
101
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
102
    put(_Fields.PRIMARY_INFO, new FieldMetaData("primaryInfo", TFieldRequirementType.DEFAULT, 
103
        new StructMetaData(TType.STRUCT, TUserPrimaryInfo.class)));
104
    put(_Fields.INTERNAL_INFO, new FieldMetaData("internalInfo", TFieldRequirementType.DEFAULT, 
105
        new StructMetaData(TType.STRUCT, TUserInternalInfo.class)));
106
    put(_Fields.USER_STATE, new FieldMetaData("userState", TFieldRequirementType.DEFAULT, 
107
        new StructMetaData(TType.STRUCT, TUserState.class)));
108
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
109
        new FieldValueMetaData(TType.I64)));
110
  }});
111
 
112
  static {
113
    FieldMetaData.addStructMetaDataMap(TUserContext.class, metaDataMap);
114
  }
115
 
116
  public TUserContext() {
117
  }
118
 
119
  public TUserContext(
120
    TUserPrimaryInfo primaryInfo,
121
    TUserInternalInfo internalInfo,
122
    TUserState userState,
123
    long id)
124
  {
125
    this();
126
    this.primaryInfo = primaryInfo;
127
    this.internalInfo = internalInfo;
128
    this.userState = userState;
129
    this.id = id;
130
    setIdIsSet(true);
131
  }
132
 
133
  /**
134
   * Performs a deep copy on <i>other</i>.
135
   */
136
  public TUserContext(TUserContext other) {
137
    __isset_bit_vector.clear();
138
    __isset_bit_vector.or(other.__isset_bit_vector);
139
    if (other.isSetPrimaryInfo()) {
140
      this.primaryInfo = new TUserPrimaryInfo(other.primaryInfo);
141
    }
142
    if (other.isSetInternalInfo()) {
143
      this.internalInfo = new TUserInternalInfo(other.internalInfo);
144
    }
145
    if (other.isSetUserState()) {
146
      this.userState = new TUserState(other.userState);
147
    }
148
    this.id = other.id;
149
  }
150
 
151
  public TUserContext deepCopy() {
152
    return new TUserContext(this);
153
  }
154
 
155
  @Deprecated
156
  public TUserContext clone() {
157
    return new TUserContext(this);
158
  }
159
 
160
  public TUserPrimaryInfo getPrimaryInfo() {
161
    return this.primaryInfo;
162
  }
163
 
164
  public TUserContext setPrimaryInfo(TUserPrimaryInfo primaryInfo) {
165
    this.primaryInfo = primaryInfo;
166
    return this;
167
  }
168
 
169
  public void unsetPrimaryInfo() {
170
    this.primaryInfo = null;
171
  }
172
 
173
  /** Returns true if field primaryInfo is set (has been asigned a value) and false otherwise */
174
  public boolean isSetPrimaryInfo() {
175
    return this.primaryInfo != null;
176
  }
177
 
178
  public void setPrimaryInfoIsSet(boolean value) {
179
    if (!value) {
180
      this.primaryInfo = null;
181
    }
182
  }
183
 
184
  public TUserInternalInfo getInternalInfo() {
185
    return this.internalInfo;
186
  }
187
 
188
  public TUserContext setInternalInfo(TUserInternalInfo internalInfo) {
189
    this.internalInfo = internalInfo;
190
    return this;
191
  }
192
 
193
  public void unsetInternalInfo() {
194
    this.internalInfo = null;
195
  }
196
 
197
  /** Returns true if field internalInfo is set (has been asigned a value) and false otherwise */
198
  public boolean isSetInternalInfo() {
199
    return this.internalInfo != null;
200
  }
201
 
202
  public void setInternalInfoIsSet(boolean value) {
203
    if (!value) {
204
      this.internalInfo = null;
205
    }
206
  }
207
 
208
  public TUserState getUserState() {
209
    return this.userState;
210
  }
211
 
212
  public TUserContext setUserState(TUserState userState) {
213
    this.userState = userState;
214
    return this;
215
  }
216
 
217
  public void unsetUserState() {
218
    this.userState = null;
219
  }
220
 
221
  /** Returns true if field userState is set (has been asigned a value) and false otherwise */
222
  public boolean isSetUserState() {
223
    return this.userState != null;
224
  }
225
 
226
  public void setUserStateIsSet(boolean value) {
227
    if (!value) {
228
      this.userState = null;
229
    }
230
  }
231
 
232
  public long getId() {
233
    return this.id;
234
  }
235
 
236
  public TUserContext setId(long id) {
237
    this.id = id;
238
    setIdIsSet(true);
239
    return this;
240
  }
241
 
242
  public void unsetId() {
243
    __isset_bit_vector.clear(__ID_ISSET_ID);
244
  }
245
 
246
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
247
  public boolean isSetId() {
248
    return __isset_bit_vector.get(__ID_ISSET_ID);
249
  }
250
 
251
  public void setIdIsSet(boolean value) {
252
    __isset_bit_vector.set(__ID_ISSET_ID, value);
253
  }
254
 
255
  public void setFieldValue(_Fields field, Object value) {
256
    switch (field) {
257
    case PRIMARY_INFO:
258
      if (value == null) {
259
        unsetPrimaryInfo();
260
      } else {
261
        setPrimaryInfo((TUserPrimaryInfo)value);
262
      }
263
      break;
264
 
265
    case INTERNAL_INFO:
266
      if (value == null) {
267
        unsetInternalInfo();
268
      } else {
269
        setInternalInfo((TUserInternalInfo)value);
270
      }
271
      break;
272
 
273
    case USER_STATE:
274
      if (value == null) {
275
        unsetUserState();
276
      } else {
277
        setUserState((TUserState)value);
278
      }
279
      break;
280
 
281
    case ID:
282
      if (value == null) {
283
        unsetId();
284
      } else {
285
        setId((Long)value);
286
      }
287
      break;
288
 
289
    }
290
  }
291
 
292
  public void setFieldValue(int fieldID, Object value) {
293
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
294
  }
295
 
296
  public Object getFieldValue(_Fields field) {
297
    switch (field) {
298
    case PRIMARY_INFO:
299
      return getPrimaryInfo();
300
 
301
    case INTERNAL_INFO:
302
      return getInternalInfo();
303
 
304
    case USER_STATE:
305
      return getUserState();
306
 
307
    case ID:
308
      return new Long(getId());
309
 
310
    }
311
    throw new IllegalStateException();
312
  }
313
 
314
  public Object getFieldValue(int fieldId) {
315
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
316
  }
317
 
318
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
319
  public boolean isSet(_Fields field) {
320
    switch (field) {
321
    case PRIMARY_INFO:
322
      return isSetPrimaryInfo();
323
    case INTERNAL_INFO:
324
      return isSetInternalInfo();
325
    case USER_STATE:
326
      return isSetUserState();
327
    case ID:
328
      return isSetId();
329
    }
330
    throw new IllegalStateException();
331
  }
332
 
333
  public boolean isSet(int fieldID) {
334
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
335
  }
336
 
337
  @Override
338
  public boolean equals(Object that) {
339
    if (that == null)
340
      return false;
341
    if (that instanceof TUserContext)
342
      return this.equals((TUserContext)that);
343
    return false;
344
  }
345
 
346
  public boolean equals(TUserContext that) {
347
    if (that == null)
348
      return false;
349
 
350
    boolean this_present_primaryInfo = true && this.isSetPrimaryInfo();
351
    boolean that_present_primaryInfo = true && that.isSetPrimaryInfo();
352
    if (this_present_primaryInfo || that_present_primaryInfo) {
353
      if (!(this_present_primaryInfo && that_present_primaryInfo))
354
        return false;
355
      if (!this.primaryInfo.equals(that.primaryInfo))
356
        return false;
357
    }
358
 
359
    boolean this_present_internalInfo = true && this.isSetInternalInfo();
360
    boolean that_present_internalInfo = true && that.isSetInternalInfo();
361
    if (this_present_internalInfo || that_present_internalInfo) {
362
      if (!(this_present_internalInfo && that_present_internalInfo))
363
        return false;
364
      if (!this.internalInfo.equals(that.internalInfo))
365
        return false;
366
    }
367
 
368
    boolean this_present_userState = true && this.isSetUserState();
369
    boolean that_present_userState = true && that.isSetUserState();
370
    if (this_present_userState || that_present_userState) {
371
      if (!(this_present_userState && that_present_userState))
372
        return false;
373
      if (!this.userState.equals(that.userState))
374
        return false;
375
    }
376
 
377
    boolean this_present_id = true;
378
    boolean that_present_id = true;
379
    if (this_present_id || that_present_id) {
380
      if (!(this_present_id && that_present_id))
381
        return false;
382
      if (this.id != that.id)
383
        return false;
384
    }
385
 
386
    return true;
387
  }
388
 
389
  @Override
390
  public int hashCode() {
391
    return 0;
392
  }
393
 
394
  public void read(TProtocol iprot) throws TException {
395
    TField field;
396
    iprot.readStructBegin();
397
    while (true)
398
    {
399
      field = iprot.readFieldBegin();
400
      if (field.type == TType.STOP) { 
401
        break;
402
      }
403
      _Fields fieldId = _Fields.findByThriftId(field.id);
404
      if (fieldId == null) {
405
        TProtocolUtil.skip(iprot, field.type);
406
      } else {
407
        switch (fieldId) {
408
          case PRIMARY_INFO:
409
            if (field.type == TType.STRUCT) {
410
              this.primaryInfo = new TUserPrimaryInfo();
411
              this.primaryInfo.read(iprot);
412
            } else { 
413
              TProtocolUtil.skip(iprot, field.type);
414
            }
415
            break;
416
          case INTERNAL_INFO:
417
            if (field.type == TType.STRUCT) {
418
              this.internalInfo = new TUserInternalInfo();
419
              this.internalInfo.read(iprot);
420
            } else { 
421
              TProtocolUtil.skip(iprot, field.type);
422
            }
423
            break;
424
          case USER_STATE:
425
            if (field.type == TType.STRUCT) {
426
              this.userState = new TUserState();
427
              this.userState.read(iprot);
428
            } else { 
429
              TProtocolUtil.skip(iprot, field.type);
430
            }
431
            break;
432
          case ID:
433
            if (field.type == TType.I64) {
434
              this.id = iprot.readI64();
435
              setIdIsSet(true);
436
            } else { 
437
              TProtocolUtil.skip(iprot, field.type);
438
            }
439
            break;
440
        }
441
        iprot.readFieldEnd();
442
      }
443
    }
444
    iprot.readStructEnd();
445
    validate();
446
  }
447
 
448
  public void write(TProtocol oprot) throws TException {
449
    validate();
450
 
451
    oprot.writeStructBegin(STRUCT_DESC);
452
    if (this.primaryInfo != null) {
453
      oprot.writeFieldBegin(PRIMARY_INFO_FIELD_DESC);
454
      this.primaryInfo.write(oprot);
455
      oprot.writeFieldEnd();
456
    }
457
    if (this.internalInfo != null) {
458
      oprot.writeFieldBegin(INTERNAL_INFO_FIELD_DESC);
459
      this.internalInfo.write(oprot);
460
      oprot.writeFieldEnd();
461
    }
462
    if (this.userState != null) {
463
      oprot.writeFieldBegin(USER_STATE_FIELD_DESC);
464
      this.userState.write(oprot);
465
      oprot.writeFieldEnd();
466
    }
467
    oprot.writeFieldBegin(ID_FIELD_DESC);
468
    oprot.writeI64(this.id);
469
    oprot.writeFieldEnd();
470
    oprot.writeFieldStop();
471
    oprot.writeStructEnd();
472
  }
473
 
474
  @Override
475
  public String toString() {
476
    StringBuilder sb = new StringBuilder("TUserContext(");
477
    boolean first = true;
478
 
479
    sb.append("primaryInfo:");
480
    if (this.primaryInfo == null) {
481
      sb.append("null");
482
    } else {
483
      sb.append(this.primaryInfo);
484
    }
485
    first = false;
486
    if (!first) sb.append(", ");
487
    sb.append("internalInfo:");
488
    if (this.internalInfo == null) {
489
      sb.append("null");
490
    } else {
491
      sb.append(this.internalInfo);
492
    }
493
    first = false;
494
    if (!first) sb.append(", ");
495
    sb.append("userState:");
496
    if (this.userState == null) {
497
      sb.append("null");
498
    } else {
499
      sb.append(this.userState);
500
    }
501
    first = false;
502
    if (!first) sb.append(", ");
503
    sb.append("id:");
504
    sb.append(this.id);
505
    first = false;
506
    sb.append(")");
507
    return sb.toString();
508
  }
509
 
510
  public void validate() throws TException {
511
    // check for required fields
512
  }
513
 
514
}
515