Subversion Repositories SmartDukaan

Rev

Rev 1891 | Go to most recent revision | 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);
1891 ankur.sing 28
 
3430 rajveer 29
  private String username; // required
30
  private long role; // required
1891 ankur.sing 31
 
32
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 33
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
1891 ankur.sing 34
    USERNAME((short)1, "username"),
35
    ROLE((short)2, "role");
36
 
37
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
38
 
39
    static {
40
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
41
        byName.put(field.getFieldName(), field);
42
      }
43
    }
44
 
45
    /**
46
     * Find the _Fields constant that matches fieldId, or null if its not found.
47
     */
48
    public static _Fields findByThriftId(int fieldId) {
3430 rajveer 49
      switch(fieldId) {
50
        case 1: // USERNAME
51
          return USERNAME;
52
        case 2: // ROLE
53
          return ROLE;
54
        default:
55
          return null;
56
      }
1891 ankur.sing 57
    }
58
 
59
    /**
60
     * Find the _Fields constant that matches fieldId, throwing an exception
61
     * if it is not found.
62
     */
63
    public static _Fields findByThriftIdOrThrow(int fieldId) {
64
      _Fields fields = findByThriftId(fieldId);
65
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
66
      return fields;
67
    }
68
 
69
    /**
70
     * Find the _Fields constant that matches name, or null if its not found.
71
     */
72
    public static _Fields findByName(String name) {
73
      return byName.get(name);
74
    }
75
 
76
    private final short _thriftId;
77
    private final String _fieldName;
78
 
79
    _Fields(short thriftId, String fieldName) {
80
      _thriftId = thriftId;
81
      _fieldName = fieldName;
82
    }
83
 
84
    public short getThriftFieldId() {
85
      return _thriftId;
86
    }
87
 
88
    public String getFieldName() {
89
      return _fieldName;
90
    }
91
  }
92
 
93
  // isset id assignments
94
  private static final int __ROLE_ISSET_ID = 0;
95
  private BitSet __isset_bit_vector = new BitSet(1);
96
 
3430 rajveer 97
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
1891 ankur.sing 98
  static {
3430 rajveer 99
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
100
    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
101
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
102
    tmpMap.put(_Fields.ROLE, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.DEFAULT, 
103
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
104
    metaDataMap = Collections.unmodifiableMap(tmpMap);
105
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReportUser.class, metaDataMap);
1891 ankur.sing 106
  }
107
 
108
  public ReportUser() {
109
  }
110
 
111
  public ReportUser(
112
    String username,
113
    long role)
114
  {
115
    this();
116
    this.username = username;
117
    this.role = role;
118
    setRoleIsSet(true);
119
  }
120
 
121
  /**
122
   * Performs a deep copy on <i>other</i>.
123
   */
124
  public ReportUser(ReportUser other) {
125
    __isset_bit_vector.clear();
126
    __isset_bit_vector.or(other.__isset_bit_vector);
127
    if (other.isSetUsername()) {
128
      this.username = other.username;
129
    }
130
    this.role = other.role;
131
  }
132
 
133
  public ReportUser deepCopy() {
134
    return new ReportUser(this);
135
  }
136
 
3430 rajveer 137
  @Override
138
  public void clear() {
139
    this.username = null;
140
    setRoleIsSet(false);
141
    this.role = 0;
1891 ankur.sing 142
  }
143
 
144
  public String getUsername() {
145
    return this.username;
146
  }
147
 
3430 rajveer 148
  public void setUsername(String username) {
1891 ankur.sing 149
    this.username = username;
150
  }
151
 
152
  public void unsetUsername() {
153
    this.username = null;
154
  }
155
 
3430 rajveer 156
  /** Returns true if field username is set (has been assigned a value) and false otherwise */
1891 ankur.sing 157
  public boolean isSetUsername() {
158
    return this.username != null;
159
  }
160
 
161
  public void setUsernameIsSet(boolean value) {
162
    if (!value) {
163
      this.username = null;
164
    }
165
  }
166
 
167
  public long getRole() {
168
    return this.role;
169
  }
170
 
3430 rajveer 171
  public void setRole(long role) {
1891 ankur.sing 172
    this.role = role;
173
    setRoleIsSet(true);
174
  }
175
 
176
  public void unsetRole() {
177
    __isset_bit_vector.clear(__ROLE_ISSET_ID);
178
  }
179
 
3430 rajveer 180
  /** Returns true if field role is set (has been assigned a value) and false otherwise */
1891 ankur.sing 181
  public boolean isSetRole() {
182
    return __isset_bit_vector.get(__ROLE_ISSET_ID);
183
  }
184
 
185
  public void setRoleIsSet(boolean value) {
186
    __isset_bit_vector.set(__ROLE_ISSET_ID, value);
187
  }
188
 
189
  public void setFieldValue(_Fields field, Object value) {
190
    switch (field) {
191
    case USERNAME:
192
      if (value == null) {
193
        unsetUsername();
194
      } else {
195
        setUsername((String)value);
196
      }
197
      break;
198
 
199
    case ROLE:
200
      if (value == null) {
201
        unsetRole();
202
      } else {
203
        setRole((Long)value);
204
      }
205
      break;
206
 
207
    }
208
  }
209
 
210
  public Object getFieldValue(_Fields field) {
211
    switch (field) {
212
    case USERNAME:
213
      return getUsername();
214
 
215
    case ROLE:
3430 rajveer 216
      return Long.valueOf(getRole());
1891 ankur.sing 217
 
218
    }
219
    throw new IllegalStateException();
220
  }
221
 
3430 rajveer 222
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
223
  public boolean isSet(_Fields field) {
224
    if (field == null) {
225
      throw new IllegalArgumentException();
226
    }
1891 ankur.sing 227
 
228
    switch (field) {
229
    case USERNAME:
230
      return isSetUsername();
231
    case ROLE:
232
      return isSetRole();
233
    }
234
    throw new IllegalStateException();
235
  }
236
 
237
  @Override
238
  public boolean equals(Object that) {
239
    if (that == null)
240
      return false;
241
    if (that instanceof ReportUser)
242
      return this.equals((ReportUser)that);
243
    return false;
244
  }
245
 
246
  public boolean equals(ReportUser that) {
247
    if (that == null)
248
      return false;
249
 
250
    boolean this_present_username = true && this.isSetUsername();
251
    boolean that_present_username = true && that.isSetUsername();
252
    if (this_present_username || that_present_username) {
253
      if (!(this_present_username && that_present_username))
254
        return false;
255
      if (!this.username.equals(that.username))
256
        return false;
257
    }
258
 
259
    boolean this_present_role = true;
260
    boolean that_present_role = true;
261
    if (this_present_role || that_present_role) {
262
      if (!(this_present_role && that_present_role))
263
        return false;
264
      if (this.role != that.role)
265
        return false;
266
    }
267
 
268
    return true;
269
  }
270
 
271
  @Override
272
  public int hashCode() {
273
    return 0;
274
  }
275
 
276
  public int compareTo(ReportUser other) {
277
    if (!getClass().equals(other.getClass())) {
278
      return getClass().getName().compareTo(other.getClass().getName());
279
    }
280
 
281
    int lastComparison = 0;
282
    ReportUser typedOther = (ReportUser)other;
283
 
3430 rajveer 284
    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(typedOther.isSetUsername());
1891 ankur.sing 285
    if (lastComparison != 0) {
286
      return lastComparison;
287
    }
3430 rajveer 288
    if (isSetUsername()) {
289
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, typedOther.username);
290
      if (lastComparison != 0) {
291
        return lastComparison;
292
      }
1891 ankur.sing 293
    }
3430 rajveer 294
    lastComparison = Boolean.valueOf(isSetRole()).compareTo(typedOther.isSetRole());
1891 ankur.sing 295
    if (lastComparison != 0) {
296
      return lastComparison;
297
    }
3430 rajveer 298
    if (isSetRole()) {
299
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, typedOther.role);
300
      if (lastComparison != 0) {
301
        return lastComparison;
302
      }
1891 ankur.sing 303
    }
304
    return 0;
305
  }
306
 
3430 rajveer 307
  public _Fields fieldForId(int fieldId) {
308
    return _Fields.findByThriftId(fieldId);
309
  }
310
 
311
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
312
    org.apache.thrift.protocol.TField field;
1891 ankur.sing 313
    iprot.readStructBegin();
314
    while (true)
315
    {
316
      field = iprot.readFieldBegin();
3430 rajveer 317
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
1891 ankur.sing 318
        break;
319
      }
3430 rajveer 320
      switch (field.id) {
321
        case 1: // USERNAME
322
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
323
            this.username = iprot.readString();
324
          } else { 
325
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
326
          }
327
          break;
328
        case 2: // ROLE
329
          if (field.type == org.apache.thrift.protocol.TType.I64) {
330
            this.role = iprot.readI64();
331
            setRoleIsSet(true);
332
          } else { 
333
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
334
          }
335
          break;
336
        default:
337
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
1891 ankur.sing 338
      }
3430 rajveer 339
      iprot.readFieldEnd();
1891 ankur.sing 340
    }
341
    iprot.readStructEnd();
342
    validate();
343
  }
344
 
3430 rajveer 345
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
1891 ankur.sing 346
    validate();
347
 
348
    oprot.writeStructBegin(STRUCT_DESC);
349
    if (this.username != null) {
350
      oprot.writeFieldBegin(USERNAME_FIELD_DESC);
351
      oprot.writeString(this.username);
352
      oprot.writeFieldEnd();
353
    }
354
    oprot.writeFieldBegin(ROLE_FIELD_DESC);
355
    oprot.writeI64(this.role);
356
    oprot.writeFieldEnd();
357
    oprot.writeFieldStop();
358
    oprot.writeStructEnd();
359
  }
360
 
361
  @Override
362
  public String toString() {
363
    StringBuilder sb = new StringBuilder("ReportUser(");
364
    boolean first = true;
365
 
366
    sb.append("username:");
367
    if (this.username == null) {
368
      sb.append("null");
369
    } else {
370
      sb.append(this.username);
371
    }
372
    first = false;
373
    if (!first) sb.append(", ");
374
    sb.append("role:");
375
    sb.append(this.role);
376
    first = false;
377
    sb.append(")");
378
    return sb.toString();
379
  }
380
 
3430 rajveer 381
  public void validate() throws org.apache.thrift.TException {
1891 ankur.sing 382
    // check for required fields
383
  }
384
 
3430 rajveer 385
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
386
    try {
387
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
388
    } catch (org.apache.thrift.TException te) {
389
      throw new java.io.IOException(te);
390
    }
391
  }
392
 
393
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
394
    try {
395
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
396
      __isset_bit_vector = new BitSet(1);
397
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
398
    } catch (org.apache.thrift.TException te) {
399
      throw new java.io.IOException(te);
400
    }
401
  }
402
 
1891 ankur.sing 403
}
404