Subversion Repositories SmartDukaan

Rev

Rev 1847 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1847 vikas 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
public class MasterAffiliate implements TBase<MasterAffiliate._Fields>, java.io.Serializable, Cloneable, Comparable<MasterAffiliate> {
27
  private static final TStruct STRUCT_DESC = new TStruct("MasterAffiliate");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
1860 vikas 31
  private static final TField ADDED_ON_FIELD_DESC = new TField("addedOn", TType.I64, (short)3);
1847 vikas 32
 
33
  private long id;
34
  private String name;
1860 vikas 35
  private long addedOn;
1847 vikas 36
 
37
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
38
  public enum _Fields implements TFieldIdEnum {
39
    ID((short)1, "id"),
1860 vikas 40
    NAME((short)2, "name"),
41
    ADDED_ON((short)3, "addedOn");
1847 vikas 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;
1860 vikas 96
  private static final int __ADDEDON_ISSET_ID = 1;
97
  private BitSet __isset_bit_vector = new BitSet(2);
1847 vikas 98
 
99
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
100
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
101
        new FieldValueMetaData(TType.I64)));
102
    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
103
        new FieldValueMetaData(TType.STRING)));
1860 vikas 104
    put(_Fields.ADDED_ON, new FieldMetaData("addedOn", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.I64)));
1847 vikas 106
  }});
107
 
108
  static {
109
    FieldMetaData.addStructMetaDataMap(MasterAffiliate.class, metaDataMap);
110
  }
111
 
112
  public MasterAffiliate() {
113
  }
114
 
115
  public MasterAffiliate(
116
    long id,
1860 vikas 117
    String name,
118
    long addedOn)
1847 vikas 119
  {
120
    this();
121
    this.id = id;
122
    setIdIsSet(true);
123
    this.name = name;
1860 vikas 124
    this.addedOn = addedOn;
125
    setAddedOnIsSet(true);
1847 vikas 126
  }
127
 
128
  /**
129
   * Performs a deep copy on <i>other</i>.
130
   */
131
  public MasterAffiliate(MasterAffiliate other) {
132
    __isset_bit_vector.clear();
133
    __isset_bit_vector.or(other.__isset_bit_vector);
134
    this.id = other.id;
135
    if (other.isSetName()) {
136
      this.name = other.name;
137
    }
1860 vikas 138
    this.addedOn = other.addedOn;
1847 vikas 139
  }
140
 
141
  public MasterAffiliate deepCopy() {
142
    return new MasterAffiliate(this);
143
  }
144
 
145
  @Deprecated
146
  public MasterAffiliate clone() {
147
    return new MasterAffiliate(this);
148
  }
149
 
150
  public long getId() {
151
    return this.id;
152
  }
153
 
154
  public MasterAffiliate setId(long id) {
155
    this.id = id;
156
    setIdIsSet(true);
157
    return this;
158
  }
159
 
160
  public void unsetId() {
161
    __isset_bit_vector.clear(__ID_ISSET_ID);
162
  }
163
 
164
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
165
  public boolean isSetId() {
166
    return __isset_bit_vector.get(__ID_ISSET_ID);
167
  }
168
 
169
  public void setIdIsSet(boolean value) {
170
    __isset_bit_vector.set(__ID_ISSET_ID, value);
171
  }
172
 
173
  public String getName() {
174
    return this.name;
175
  }
176
 
177
  public MasterAffiliate setName(String name) {
178
    this.name = name;
179
    return this;
180
  }
181
 
182
  public void unsetName() {
183
    this.name = null;
184
  }
185
 
186
  /** Returns true if field name is set (has been asigned a value) and false otherwise */
187
  public boolean isSetName() {
188
    return this.name != null;
189
  }
190
 
191
  public void setNameIsSet(boolean value) {
192
    if (!value) {
193
      this.name = null;
194
    }
195
  }
196
 
1860 vikas 197
  public long getAddedOn() {
198
    return this.addedOn;
199
  }
200
 
201
  public MasterAffiliate setAddedOn(long addedOn) {
202
    this.addedOn = addedOn;
203
    setAddedOnIsSet(true);
204
    return this;
205
  }
206
 
207
  public void unsetAddedOn() {
208
    __isset_bit_vector.clear(__ADDEDON_ISSET_ID);
209
  }
210
 
211
  /** Returns true if field addedOn is set (has been asigned a value) and false otherwise */
212
  public boolean isSetAddedOn() {
213
    return __isset_bit_vector.get(__ADDEDON_ISSET_ID);
214
  }
215
 
216
  public void setAddedOnIsSet(boolean value) {
217
    __isset_bit_vector.set(__ADDEDON_ISSET_ID, value);
218
  }
219
 
1847 vikas 220
  public void setFieldValue(_Fields field, Object value) {
221
    switch (field) {
222
    case ID:
223
      if (value == null) {
224
        unsetId();
225
      } else {
226
        setId((Long)value);
227
      }
228
      break;
229
 
230
    case NAME:
231
      if (value == null) {
232
        unsetName();
233
      } else {
234
        setName((String)value);
235
      }
236
      break;
237
 
1860 vikas 238
    case ADDED_ON:
239
      if (value == null) {
240
        unsetAddedOn();
241
      } else {
242
        setAddedOn((Long)value);
243
      }
244
      break;
245
 
1847 vikas 246
    }
247
  }
248
 
249
  public void setFieldValue(int fieldID, Object value) {
250
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
251
  }
252
 
253
  public Object getFieldValue(_Fields field) {
254
    switch (field) {
255
    case ID:
256
      return new Long(getId());
257
 
258
    case NAME:
259
      return getName();
260
 
1860 vikas 261
    case ADDED_ON:
262
      return new Long(getAddedOn());
263
 
1847 vikas 264
    }
265
    throw new IllegalStateException();
266
  }
267
 
268
  public Object getFieldValue(int fieldId) {
269
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
270
  }
271
 
272
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
273
  public boolean isSet(_Fields field) {
274
    switch (field) {
275
    case ID:
276
      return isSetId();
277
    case NAME:
278
      return isSetName();
1860 vikas 279
    case ADDED_ON:
280
      return isSetAddedOn();
1847 vikas 281
    }
282
    throw new IllegalStateException();
283
  }
284
 
285
  public boolean isSet(int fieldID) {
286
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
287
  }
288
 
289
  @Override
290
  public boolean equals(Object that) {
291
    if (that == null)
292
      return false;
293
    if (that instanceof MasterAffiliate)
294
      return this.equals((MasterAffiliate)that);
295
    return false;
296
  }
297
 
298
  public boolean equals(MasterAffiliate that) {
299
    if (that == null)
300
      return false;
301
 
302
    boolean this_present_id = true;
303
    boolean that_present_id = true;
304
    if (this_present_id || that_present_id) {
305
      if (!(this_present_id && that_present_id))
306
        return false;
307
      if (this.id != that.id)
308
        return false;
309
    }
310
 
311
    boolean this_present_name = true && this.isSetName();
312
    boolean that_present_name = true && that.isSetName();
313
    if (this_present_name || that_present_name) {
314
      if (!(this_present_name && that_present_name))
315
        return false;
316
      if (!this.name.equals(that.name))
317
        return false;
318
    }
319
 
1860 vikas 320
    boolean this_present_addedOn = true;
321
    boolean that_present_addedOn = true;
322
    if (this_present_addedOn || that_present_addedOn) {
323
      if (!(this_present_addedOn && that_present_addedOn))
324
        return false;
325
      if (this.addedOn != that.addedOn)
326
        return false;
327
    }
328
 
1847 vikas 329
    return true;
330
  }
331
 
332
  @Override
333
  public int hashCode() {
334
    return 0;
335
  }
336
 
337
  public int compareTo(MasterAffiliate other) {
338
    if (!getClass().equals(other.getClass())) {
339
      return getClass().getName().compareTo(other.getClass().getName());
340
    }
341
 
342
    int lastComparison = 0;
343
    MasterAffiliate typedOther = (MasterAffiliate)other;
344
 
345
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
346
    if (lastComparison != 0) {
347
      return lastComparison;
348
    }
349
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
350
    if (lastComparison != 0) {
351
      return lastComparison;
352
    }
353
    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
354
    if (lastComparison != 0) {
355
      return lastComparison;
356
    }
357
    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
358
    if (lastComparison != 0) {
359
      return lastComparison;
360
    }
1860 vikas 361
    lastComparison = Boolean.valueOf(isSetAddedOn()).compareTo(isSetAddedOn());
362
    if (lastComparison != 0) {
363
      return lastComparison;
364
    }
365
    lastComparison = TBaseHelper.compareTo(addedOn, typedOther.addedOn);
366
    if (lastComparison != 0) {
367
      return lastComparison;
368
    }
1847 vikas 369
    return 0;
370
  }
371
 
372
  public void read(TProtocol iprot) throws TException {
373
    TField field;
374
    iprot.readStructBegin();
375
    while (true)
376
    {
377
      field = iprot.readFieldBegin();
378
      if (field.type == TType.STOP) { 
379
        break;
380
      }
381
      _Fields fieldId = _Fields.findByThriftId(field.id);
382
      if (fieldId == null) {
383
        TProtocolUtil.skip(iprot, field.type);
384
      } else {
385
        switch (fieldId) {
386
          case ID:
387
            if (field.type == TType.I64) {
388
              this.id = iprot.readI64();
389
              setIdIsSet(true);
390
            } else { 
391
              TProtocolUtil.skip(iprot, field.type);
392
            }
393
            break;
394
          case NAME:
395
            if (field.type == TType.STRING) {
396
              this.name = iprot.readString();
397
            } else { 
398
              TProtocolUtil.skip(iprot, field.type);
399
            }
400
            break;
1860 vikas 401
          case ADDED_ON:
402
            if (field.type == TType.I64) {
403
              this.addedOn = iprot.readI64();
404
              setAddedOnIsSet(true);
405
            } else { 
406
              TProtocolUtil.skip(iprot, field.type);
407
            }
408
            break;
1847 vikas 409
        }
410
        iprot.readFieldEnd();
411
      }
412
    }
413
    iprot.readStructEnd();
414
    validate();
415
  }
416
 
417
  public void write(TProtocol oprot) throws TException {
418
    validate();
419
 
420
    oprot.writeStructBegin(STRUCT_DESC);
421
    oprot.writeFieldBegin(ID_FIELD_DESC);
422
    oprot.writeI64(this.id);
423
    oprot.writeFieldEnd();
424
    if (this.name != null) {
425
      oprot.writeFieldBegin(NAME_FIELD_DESC);
426
      oprot.writeString(this.name);
427
      oprot.writeFieldEnd();
428
    }
1860 vikas 429
    oprot.writeFieldBegin(ADDED_ON_FIELD_DESC);
430
    oprot.writeI64(this.addedOn);
431
    oprot.writeFieldEnd();
1847 vikas 432
    oprot.writeFieldStop();
433
    oprot.writeStructEnd();
434
  }
435
 
436
  @Override
437
  public String toString() {
438
    StringBuilder sb = new StringBuilder("MasterAffiliate(");
439
    boolean first = true;
440
 
441
    sb.append("id:");
442
    sb.append(this.id);
443
    first = false;
444
    if (!first) sb.append(", ");
445
    sb.append("name:");
446
    if (this.name == null) {
447
      sb.append("null");
448
    } else {
449
      sb.append(this.name);
450
    }
451
    first = false;
1860 vikas 452
    if (!first) sb.append(", ");
453
    sb.append("addedOn:");
454
    sb.append(this.addedOn);
455
    first = false;
1847 vikas 456
    sb.append(")");
457
    return sb.toString();
458
  }
459
 
460
  public void validate() throws TException {
461
    // check for required fields
462
  }
463
 
464
}
465