Subversion Repositories SmartDukaan

Rev

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

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