Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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