Subversion Repositories SmartDukaan

Rev

Go to most recent revision | 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
/**
27
 * Exceptions
28
 */
29
public class AuthenticationException extends Exception implements TBase<AuthenticationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthenticationException> {
30
  private static final TStruct STRUCT_DESC = new TStruct("AuthenticationException");
31
 
32
  private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
33
  private static final TField ERROR_CODE_FIELD_DESC = new TField("errorCode", TType.I32, (short)2);
34
 
35
  private String message;
36
  private int errorCode;
37
 
38
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
39
  public enum _Fields implements TFieldIdEnum {
40
    MESSAGE((short)1, "message"),
41
    ERROR_CODE((short)2, "errorCode");
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
95
  private static final int __ERRORCODE_ISSET_ID = 0;
96
  private BitSet __isset_bit_vector = new BitSet(1);
97
 
98
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
99
    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
100
        new FieldValueMetaData(TType.STRING)));
101
    put(_Fields.ERROR_CODE, new FieldMetaData("errorCode", TFieldRequirementType.DEFAULT, 
102
        new FieldValueMetaData(TType.I32)));
103
  }});
104
 
105
  static {
106
    FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap);
107
  }
108
 
109
  public AuthenticationException() {
110
  }
111
 
112
  public AuthenticationException(
113
    String message,
114
    int errorCode)
115
  {
116
    this();
117
    this.message = message;
118
    this.errorCode = errorCode;
119
    setErrorCodeIsSet(true);
120
  }
121
 
122
  /**
123
   * Performs a deep copy on <i>other</i>.
124
   */
125
  public AuthenticationException(AuthenticationException other) {
126
    __isset_bit_vector.clear();
127
    __isset_bit_vector.or(other.__isset_bit_vector);
128
    if (other.isSetMessage()) {
129
      this.message = other.message;
130
    }
131
    this.errorCode = other.errorCode;
132
  }
133
 
134
  public AuthenticationException deepCopy() {
135
    return new AuthenticationException(this);
136
  }
137
 
138
  @Deprecated
139
  public AuthenticationException clone() {
140
    return new AuthenticationException(this);
141
  }
142
 
143
  public String getMessage() {
144
    return this.message;
145
  }
146
 
147
  public AuthenticationException setMessage(String message) {
148
    this.message = message;
149
    return this;
150
  }
151
 
152
  public void unsetMessage() {
153
    this.message = null;
154
  }
155
 
156
  /** Returns true if field message is set (has been asigned a value) and false otherwise */
157
  public boolean isSetMessage() {
158
    return this.message != null;
159
  }
160
 
161
  public void setMessageIsSet(boolean value) {
162
    if (!value) {
163
      this.message = null;
164
    }
165
  }
166
 
167
  public int getErrorCode() {
168
    return this.errorCode;
169
  }
170
 
171
  public AuthenticationException setErrorCode(int errorCode) {
172
    this.errorCode = errorCode;
173
    setErrorCodeIsSet(true);
174
    return this;
175
  }
176
 
177
  public void unsetErrorCode() {
178
    __isset_bit_vector.clear(__ERRORCODE_ISSET_ID);
179
  }
180
 
181
  /** Returns true if field errorCode is set (has been asigned a value) and false otherwise */
182
  public boolean isSetErrorCode() {
183
    return __isset_bit_vector.get(__ERRORCODE_ISSET_ID);
184
  }
185
 
186
  public void setErrorCodeIsSet(boolean value) {
187
    __isset_bit_vector.set(__ERRORCODE_ISSET_ID, value);
188
  }
189
 
190
  public void setFieldValue(_Fields field, Object value) {
191
    switch (field) {
192
    case MESSAGE:
193
      if (value == null) {
194
        unsetMessage();
195
      } else {
196
        setMessage((String)value);
197
      }
198
      break;
199
 
200
    case ERROR_CODE:
201
      if (value == null) {
202
        unsetErrorCode();
203
      } else {
204
        setErrorCode((Integer)value);
205
      }
206
      break;
207
 
208
    }
209
  }
210
 
211
  public void setFieldValue(int fieldID, Object value) {
212
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
213
  }
214
 
215
  public Object getFieldValue(_Fields field) {
216
    switch (field) {
217
    case MESSAGE:
218
      return getMessage();
219
 
220
    case ERROR_CODE:
221
      return new Integer(getErrorCode());
222
 
223
    }
224
    throw new IllegalStateException();
225
  }
226
 
227
  public Object getFieldValue(int fieldId) {
228
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
229
  }
230
 
231
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
232
  public boolean isSet(_Fields field) {
233
    switch (field) {
234
    case MESSAGE:
235
      return isSetMessage();
236
    case ERROR_CODE:
237
      return isSetErrorCode();
238
    }
239
    throw new IllegalStateException();
240
  }
241
 
242
  public boolean isSet(int fieldID) {
243
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
244
  }
245
 
246
  @Override
247
  public boolean equals(Object that) {
248
    if (that == null)
249
      return false;
250
    if (that instanceof AuthenticationException)
251
      return this.equals((AuthenticationException)that);
252
    return false;
253
  }
254
 
255
  public boolean equals(AuthenticationException that) {
256
    if (that == null)
257
      return false;
258
 
259
    boolean this_present_message = true && this.isSetMessage();
260
    boolean that_present_message = true && that.isSetMessage();
261
    if (this_present_message || that_present_message) {
262
      if (!(this_present_message && that_present_message))
263
        return false;
264
      if (!this.message.equals(that.message))
265
        return false;
266
    }
267
 
268
    boolean this_present_errorCode = true;
269
    boolean that_present_errorCode = true;
270
    if (this_present_errorCode || that_present_errorCode) {
271
      if (!(this_present_errorCode && that_present_errorCode))
272
        return false;
273
      if (this.errorCode != that.errorCode)
274
        return false;
275
    }
276
 
277
    return true;
278
  }
279
 
280
  @Override
281
  public int hashCode() {
282
    return 0;
283
  }
284
 
285
  public int compareTo(AuthenticationException other) {
286
    if (!getClass().equals(other.getClass())) {
287
      return getClass().getName().compareTo(other.getClass().getName());
288
    }
289
 
290
    int lastComparison = 0;
291
    AuthenticationException typedOther = (AuthenticationException)other;
292
 
293
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
294
    if (lastComparison != 0) {
295
      return lastComparison;
296
    }
297
    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
298
    if (lastComparison != 0) {
299
      return lastComparison;
300
    }
301
    lastComparison = Boolean.valueOf(isSetErrorCode()).compareTo(isSetErrorCode());
302
    if (lastComparison != 0) {
303
      return lastComparison;
304
    }
305
    lastComparison = TBaseHelper.compareTo(errorCode, typedOther.errorCode);
306
    if (lastComparison != 0) {
307
      return lastComparison;
308
    }
309
    return 0;
310
  }
311
 
312
  public void read(TProtocol iprot) throws TException {
313
    TField field;
314
    iprot.readStructBegin();
315
    while (true)
316
    {
317
      field = iprot.readFieldBegin();
318
      if (field.type == TType.STOP) { 
319
        break;
320
      }
321
      _Fields fieldId = _Fields.findByThriftId(field.id);
322
      if (fieldId == null) {
323
        TProtocolUtil.skip(iprot, field.type);
324
      } else {
325
        switch (fieldId) {
326
          case MESSAGE:
327
            if (field.type == TType.STRING) {
328
              this.message = iprot.readString();
329
            } else { 
330
              TProtocolUtil.skip(iprot, field.type);
331
            }
332
            break;
333
          case ERROR_CODE:
334
            if (field.type == TType.I32) {
335
              this.errorCode = iprot.readI32();
336
              setErrorCodeIsSet(true);
337
            } else { 
338
              TProtocolUtil.skip(iprot, field.type);
339
            }
340
            break;
341
        }
342
        iprot.readFieldEnd();
343
      }
344
    }
345
    iprot.readStructEnd();
346
    validate();
347
  }
348
 
349
  public void write(TProtocol oprot) throws TException {
350
    validate();
351
 
352
    oprot.writeStructBegin(STRUCT_DESC);
353
    if (this.message != null) {
354
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
355
      oprot.writeString(this.message);
356
      oprot.writeFieldEnd();
357
    }
358
    oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC);
359
    oprot.writeI32(this.errorCode);
360
    oprot.writeFieldEnd();
361
    oprot.writeFieldStop();
362
    oprot.writeStructEnd();
363
  }
364
 
365
  @Override
366
  public String toString() {
367
    StringBuilder sb = new StringBuilder("AuthenticationException(");
368
    boolean first = true;
369
 
370
    sb.append("message:");
371
    if (this.message == null) {
372
      sb.append("null");
373
    } else {
374
      sb.append(this.message);
375
    }
376
    first = false;
377
    if (!first) sb.append(", ");
378
    sb.append("errorCode:");
379
    sb.append(this.errorCode);
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