Subversion Repositories SmartDukaan

Rev

Rev 3430 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1891 ankur.sing 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
1891 ankur.sing 3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.utils;
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;
3430 rajveer 18
import java.nio.ByteBuffer;
1891 ankur.sing 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
3430 rajveer 23
public class ReportUser implements org.apache.thrift.TBase<ReportUser, ReportUser._Fields>, java.io.Serializable, Cloneable {
24
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ReportUser");
1891 ankur.sing 25
 
3430 rajveer 26
  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
27
  private static final org.apache.thrift.protocol.TField ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("role", org.apache.thrift.protocol.TType.I64, (short)2);
12256 kshitij.so 28
  private static final org.apache.thrift.protocol.TField EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("email", org.apache.thrift.protocol.TType.STRING, (short)3);
1891 ankur.sing 29
 
3430 rajveer 30
  private String username; // required
31
  private long role; // required
12256 kshitij.so 32
  private String email; // required
1891 ankur.sing 33
 
34
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 35
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
1891 ankur.sing 36
    USERNAME((short)1, "username"),
12256 kshitij.so 37
    ROLE((short)2, "role"),
38
    EMAIL((short)3, "email");
1891 ankur.sing 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) {
3430 rajveer 52
      switch(fieldId) {
53
        case 1: // USERNAME
54
          return USERNAME;
55
        case 2: // ROLE
56
          return ROLE;
12256 kshitij.so 57
        case 3: // EMAIL
58
          return EMAIL;
3430 rajveer 59
        default:
60
          return null;
61
      }
1891 ankur.sing 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 __ROLE_ISSET_ID = 0;
100
  private BitSet __isset_bit_vector = new BitSet(1);
101
 
3430 rajveer 102
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
1891 ankur.sing 103
  static {
3430 rajveer 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.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
106
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
107
    tmpMap.put(_Fields.ROLE, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.DEFAULT, 
108
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
12256 kshitij.so 109
    tmpMap.put(_Fields.EMAIL, new org.apache.thrift.meta_data.FieldMetaData("email", org.apache.thrift.TFieldRequirementType.DEFAULT, 
110
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
3430 rajveer 111
    metaDataMap = Collections.unmodifiableMap(tmpMap);
112
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReportUser.class, metaDataMap);
1891 ankur.sing 113
  }
114
 
115
  public ReportUser() {
116
  }
117
 
118
  public ReportUser(
119
    String username,
12256 kshitij.so 120
    long role,
121
    String email)
1891 ankur.sing 122
  {
123
    this();
124
    this.username = username;
125
    this.role = role;
126
    setRoleIsSet(true);
12256 kshitij.so 127
    this.email = email;
1891 ankur.sing 128
  }
129
 
130
  /**
131
   * Performs a deep copy on <i>other</i>.
132
   */
133
  public ReportUser(ReportUser other) {
134
    __isset_bit_vector.clear();
135
    __isset_bit_vector.or(other.__isset_bit_vector);
136
    if (other.isSetUsername()) {
137
      this.username = other.username;
138
    }
139
    this.role = other.role;
12256 kshitij.so 140
    if (other.isSetEmail()) {
141
      this.email = other.email;
142
    }
1891 ankur.sing 143
  }
144
 
145
  public ReportUser deepCopy() {
146
    return new ReportUser(this);
147
  }
148
 
3430 rajveer 149
  @Override
150
  public void clear() {
151
    this.username = null;
152
    setRoleIsSet(false);
153
    this.role = 0;
12256 kshitij.so 154
    this.email = null;
1891 ankur.sing 155
  }
156
 
157
  public String getUsername() {
158
    return this.username;
159
  }
160
 
3430 rajveer 161
  public void setUsername(String username) {
1891 ankur.sing 162
    this.username = username;
163
  }
164
 
165
  public void unsetUsername() {
166
    this.username = null;
167
  }
168
 
3430 rajveer 169
  /** Returns true if field username is set (has been assigned a value) and false otherwise */
1891 ankur.sing 170
  public boolean isSetUsername() {
171
    return this.username != null;
172
  }
173
 
174
  public void setUsernameIsSet(boolean value) {
175
    if (!value) {
176
      this.username = null;
177
    }
178
  }
179
 
180
  public long getRole() {
181
    return this.role;
182
  }
183
 
3430 rajveer 184
  public void setRole(long role) {
1891 ankur.sing 185
    this.role = role;
186
    setRoleIsSet(true);
187
  }
188
 
189
  public void unsetRole() {
190
    __isset_bit_vector.clear(__ROLE_ISSET_ID);
191
  }
192
 
3430 rajveer 193
  /** Returns true if field role is set (has been assigned a value) and false otherwise */
1891 ankur.sing 194
  public boolean isSetRole() {
195
    return __isset_bit_vector.get(__ROLE_ISSET_ID);
196
  }
197
 
198
  public void setRoleIsSet(boolean value) {
199
    __isset_bit_vector.set(__ROLE_ISSET_ID, value);
200
  }
201
 
12256 kshitij.so 202
  public String getEmail() {
203
    return this.email;
204
  }
205
 
206
  public void setEmail(String email) {
207
    this.email = email;
208
  }
209
 
210
  public void unsetEmail() {
211
    this.email = null;
212
  }
213
 
214
  /** Returns true if field email is set (has been assigned a value) and false otherwise */
215
  public boolean isSetEmail() {
216
    return this.email != null;
217
  }
218
 
219
  public void setEmailIsSet(boolean value) {
220
    if (!value) {
221
      this.email = null;
222
    }
223
  }
224
 
1891 ankur.sing 225
  public void setFieldValue(_Fields field, Object value) {
226
    switch (field) {
227
    case USERNAME:
228
      if (value == null) {
229
        unsetUsername();
230
      } else {
231
        setUsername((String)value);
232
      }
233
      break;
234
 
235
    case ROLE:
236
      if (value == null) {
237
        unsetRole();
238
      } else {
239
        setRole((Long)value);
240
      }
241
      break;
242
 
12256 kshitij.so 243
    case EMAIL:
244
      if (value == null) {
245
        unsetEmail();
246
      } else {
247
        setEmail((String)value);
248
      }
249
      break;
250
 
1891 ankur.sing 251
    }
252
  }
253
 
254
  public Object getFieldValue(_Fields field) {
255
    switch (field) {
256
    case USERNAME:
257
      return getUsername();
258
 
259
    case ROLE:
3430 rajveer 260
      return Long.valueOf(getRole());
1891 ankur.sing 261
 
12256 kshitij.so 262
    case EMAIL:
263
      return getEmail();
264
 
1891 ankur.sing 265
    }
266
    throw new IllegalStateException();
267
  }
268
 
3430 rajveer 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
    }
1891 ankur.sing 274
 
275
    switch (field) {
276
    case USERNAME:
277
      return isSetUsername();
278
    case ROLE:
279
      return isSetRole();
12256 kshitij.so 280
    case EMAIL:
281
      return isSetEmail();
1891 ankur.sing 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 ReportUser)
291
      return this.equals((ReportUser)that);
292
    return false;
293
  }
294
 
295
  public boolean equals(ReportUser that) {
296
    if (that == null)
297
      return false;
298
 
299
    boolean this_present_username = true && this.isSetUsername();
300
    boolean that_present_username = true && that.isSetUsername();
301
    if (this_present_username || that_present_username) {
302
      if (!(this_present_username && that_present_username))
303
        return false;
304
      if (!this.username.equals(that.username))
305
        return false;
306
    }
307
 
308
    boolean this_present_role = true;
309
    boolean that_present_role = true;
310
    if (this_present_role || that_present_role) {
311
      if (!(this_present_role && that_present_role))
312
        return false;
313
      if (this.role != that.role)
314
        return false;
315
    }
316
 
12256 kshitij.so 317
    boolean this_present_email = true && this.isSetEmail();
318
    boolean that_present_email = true && that.isSetEmail();
319
    if (this_present_email || that_present_email) {
320
      if (!(this_present_email && that_present_email))
321
        return false;
322
      if (!this.email.equals(that.email))
323
        return false;
324
    }
325
 
1891 ankur.sing 326
    return true;
327
  }
328
 
329
  @Override
330
  public int hashCode() {
331
    return 0;
332
  }
333
 
334
  public int compareTo(ReportUser other) {
335
    if (!getClass().equals(other.getClass())) {
336
      return getClass().getName().compareTo(other.getClass().getName());
337
    }
338
 
339
    int lastComparison = 0;
340
    ReportUser typedOther = (ReportUser)other;
341
 
3430 rajveer 342
    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(typedOther.isSetUsername());
1891 ankur.sing 343
    if (lastComparison != 0) {
344
      return lastComparison;
345
    }
3430 rajveer 346
    if (isSetUsername()) {
347
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, typedOther.username);
348
      if (lastComparison != 0) {
349
        return lastComparison;
350
      }
1891 ankur.sing 351
    }
3430 rajveer 352
    lastComparison = Boolean.valueOf(isSetRole()).compareTo(typedOther.isSetRole());
1891 ankur.sing 353
    if (lastComparison != 0) {
354
      return lastComparison;
355
    }
3430 rajveer 356
    if (isSetRole()) {
357
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, typedOther.role);
358
      if (lastComparison != 0) {
359
        return lastComparison;
360
      }
1891 ankur.sing 361
    }
12256 kshitij.so 362
    lastComparison = Boolean.valueOf(isSetEmail()).compareTo(typedOther.isSetEmail());
363
    if (lastComparison != 0) {
364
      return lastComparison;
365
    }
366
    if (isSetEmail()) {
367
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.email, typedOther.email);
368
      if (lastComparison != 0) {
369
        return lastComparison;
370
      }
371
    }
1891 ankur.sing 372
    return 0;
373
  }
374
 
3430 rajveer 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;
1891 ankur.sing 381
    iprot.readStructBegin();
382
    while (true)
383
    {
384
      field = iprot.readFieldBegin();
3430 rajveer 385
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
1891 ankur.sing 386
        break;
387
      }
3430 rajveer 388
      switch (field.id) {
389
        case 1: // USERNAME
390
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
391
            this.username = iprot.readString();
392
          } else { 
393
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
394
          }
395
          break;
396
        case 2: // ROLE
397
          if (field.type == org.apache.thrift.protocol.TType.I64) {
398
            this.role = iprot.readI64();
399
            setRoleIsSet(true);
400
          } else { 
401
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
402
          }
403
          break;
12256 kshitij.so 404
        case 3: // EMAIL
405
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
406
            this.email = iprot.readString();
407
          } else { 
408
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
409
          }
410
          break;
3430 rajveer 411
        default:
412
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1891 ankur.sing 413
      }
3430 rajveer 414
      iprot.readFieldEnd();
1891 ankur.sing 415
    }
416
    iprot.readStructEnd();
417
    validate();
418
  }
419
 
3430 rajveer 420
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1891 ankur.sing 421
    validate();
422
 
423
    oprot.writeStructBegin(STRUCT_DESC);
424
    if (this.username != null) {
425
      oprot.writeFieldBegin(USERNAME_FIELD_DESC);
426
      oprot.writeString(this.username);
427
      oprot.writeFieldEnd();
428
    }
429
    oprot.writeFieldBegin(ROLE_FIELD_DESC);
430
    oprot.writeI64(this.role);
431
    oprot.writeFieldEnd();
12256 kshitij.so 432
    if (this.email != null) {
433
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
434
      oprot.writeString(this.email);
435
      oprot.writeFieldEnd();
436
    }
1891 ankur.sing 437
    oprot.writeFieldStop();
438
    oprot.writeStructEnd();
439
  }
440
 
441
  @Override
442
  public String toString() {
443
    StringBuilder sb = new StringBuilder("ReportUser(");
444
    boolean first = true;
445
 
446
    sb.append("username:");
447
    if (this.username == null) {
448
      sb.append("null");
449
    } else {
450
      sb.append(this.username);
451
    }
452
    first = false;
453
    if (!first) sb.append(", ");
454
    sb.append("role:");
455
    sb.append(this.role);
456
    first = false;
12256 kshitij.so 457
    if (!first) sb.append(", ");
458
    sb.append("email:");
459
    if (this.email == null) {
460
      sb.append("null");
461
    } else {
462
      sb.append(this.email);
463
    }
464
    first = false;
1891 ankur.sing 465
    sb.append(")");
466
    return sb.toString();
467
  }
468
 
3430 rajveer 469
  public void validate() throws org.apache.thrift.TException {
1891 ankur.sing 470
    // check for required fields
471
  }
472
 
3430 rajveer 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
 
1891 ankur.sing 491
}
492