Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1982 varun.gupt 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 for Promotion Service
28
 */
29
public class PromotionException extends Exception implements TBase<PromotionException._Fields>, java.io.Serializable, Cloneable, Comparable<PromotionException> {
30
  private static final TStruct STRUCT_DESC = new TStruct("PromotionException");
31
 
32
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
33
  private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)2);
34
 
35
  private long id;
36
  private String message;
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
    ID((short)1, "id"),
41
    MESSAGE((short)2, "message");
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 __ID_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.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
100
        new FieldValueMetaData(TType.I64)));
101
    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
102
        new FieldValueMetaData(TType.STRING)));
103
  }});
104
 
105
  static {
106
    FieldMetaData.addStructMetaDataMap(PromotionException.class, metaDataMap);
107
  }
108
 
109
  public PromotionException() {
110
  }
111
 
112
  public PromotionException(
113
    long id,
114
    String message)
115
  {
116
    this();
117
    this.id = id;
118
    setIdIsSet(true);
119
    this.message = message;
120
  }
121
 
122
  /**
123
   * Performs a deep copy on <i>other</i>.
124
   */
125
  public PromotionException(PromotionException other) {
126
    __isset_bit_vector.clear();
127
    __isset_bit_vector.or(other.__isset_bit_vector);
128
    this.id = other.id;
129
    if (other.isSetMessage()) {
130
      this.message = other.message;
131
    }
132
  }
133
 
134
  public PromotionException deepCopy() {
135
    return new PromotionException(this);
136
  }
137
 
138
  @Deprecated
139
  public PromotionException clone() {
140
    return new PromotionException(this);
141
  }
142
 
143
  public long getId() {
144
    return this.id;
145
  }
146
 
147
  public PromotionException setId(long id) {
148
    this.id = id;
149
    setIdIsSet(true);
150
    return this;
151
  }
152
 
153
  public void unsetId() {
154
    __isset_bit_vector.clear(__ID_ISSET_ID);
155
  }
156
 
157
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
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
 
170
  public PromotionException setMessage(String message) {
171
    this.message = message;
172
    return this;
173
  }
174
 
175
  public void unsetMessage() {
176
    this.message = null;
177
  }
178
 
179
  /** Returns true if field message is set (has been asigned a value) and false otherwise */
180
  public boolean isSetMessage() {
181
    return this.message != null;
182
  }
183
 
184
  public void setMessageIsSet(boolean value) {
185
    if (!value) {
186
      this.message = null;
187
    }
188
  }
189
 
190
  public void setFieldValue(_Fields field, Object value) {
191
    switch (field) {
192
    case ID:
193
      if (value == null) {
194
        unsetId();
195
      } else {
196
        setId((Long)value);
197
      }
198
      break;
199
 
200
    case MESSAGE:
201
      if (value == null) {
202
        unsetMessage();
203
      } else {
204
        setMessage((String)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 ID:
218
      return new Long(getId());
219
 
220
    case MESSAGE:
221
      return getMessage();
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 ID:
235
      return isSetId();
236
    case MESSAGE:
237
      return isSetMessage();
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 PromotionException)
251
      return this.equals((PromotionException)that);
252
    return false;
253
  }
254
 
255
  public boolean equals(PromotionException that) {
256
    if (that == null)
257
      return false;
258
 
259
    boolean this_present_id = true;
260
    boolean that_present_id = true;
261
    if (this_present_id || that_present_id) {
262
      if (!(this_present_id && that_present_id))
263
        return false;
264
      if (this.id != that.id)
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(PromotionException other) {
286
    if (!getClass().equals(other.getClass())) {
287
      return getClass().getName().compareTo(other.getClass().getName());
288
    }
289
 
290
    int lastComparison = 0;
291
    PromotionException typedOther = (PromotionException)other;
292
 
293
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
294
    if (lastComparison != 0) {
295
      return lastComparison;
296
    }
297
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
298
    if (lastComparison != 0) {
299
      return lastComparison;
300
    }
301
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
302
    if (lastComparison != 0) {
303
      return lastComparison;
304
    }
305
    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
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 ID:
327
            if (field.type == TType.I64) {
328
              this.id = iprot.readI64();
329
              setIdIsSet(true);
330
            } else { 
331
              TProtocolUtil.skip(iprot, field.type);
332
            }
333
            break;
334
          case MESSAGE:
335
            if (field.type == TType.STRING) {
336
              this.message = iprot.readString();
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
    oprot.writeFieldBegin(ID_FIELD_DESC);
354
    oprot.writeI64(this.id);
355
    oprot.writeFieldEnd();
356
    if (this.message != null) {
357
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
358
      oprot.writeString(this.message);
359
      oprot.writeFieldEnd();
360
    }
361
    oprot.writeFieldStop();
362
    oprot.writeStructEnd();
363
  }
364
 
365
  @Override
366
  public String toString() {
367
    StringBuilder sb = new StringBuilder("PromotionException(");
368
    boolean first = true;
369
 
370
    sb.append("id:");
371
    sb.append(this.id);
372
    first = false;
373
    if (!first) sb.append(", ");
374
    sb.append("message:");
375
    if (this.message == null) {
376
      sb.append("null");
377
    } else {
378
      sb.append(this.message);
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