Subversion Repositories SmartDukaan

Rev

Rev 1013 | Details | Compare with Previous | Last modification | View Log | RSS feed

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