Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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