Subversion Repositories SmartDukaan

Rev

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