Subversion Repositories SmartDukaan

Rev

Rev 1860 | Go to most recent revision | Details | 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 Tracker implements TBase<Tracker._Fields>, java.io.Serializable, Cloneable, Comparable<Tracker> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Tracker");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField AFFILIATE_ID_FIELD_DESC = new TField("affiliateId", TType.I64, (short)2);
31
 
32
  private long id;
33
  private long affiliateId;
34
 
35
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
36
  public enum _Fields implements TFieldIdEnum {
37
    ID((short)1, "id"),
38
    AFFILIATE_ID((short)2, "affiliateId");
39
 
40
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
41
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
42
 
43
    static {
44
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
45
        byId.put((int)field._thriftId, field);
46
        byName.put(field.getFieldName(), field);
47
      }
48
    }
49
 
50
    /**
51
     * Find the _Fields constant that matches fieldId, or null if its not found.
52
     */
53
    public static _Fields findByThriftId(int fieldId) {
54
      return byId.get(fieldId);
55
    }
56
 
57
    /**
58
     * Find the _Fields constant that matches fieldId, throwing an exception
59
     * if it is not found.
60
     */
61
    public static _Fields findByThriftIdOrThrow(int fieldId) {
62
      _Fields fields = findByThriftId(fieldId);
63
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
64
      return fields;
65
    }
66
 
67
    /**
68
     * Find the _Fields constant that matches name, or null if its not found.
69
     */
70
    public static _Fields findByName(String name) {
71
      return byName.get(name);
72
    }
73
 
74
    private final short _thriftId;
75
    private final String _fieldName;
76
 
77
    _Fields(short thriftId, String fieldName) {
78
      _thriftId = thriftId;
79
      _fieldName = fieldName;
80
    }
81
 
82
    public short getThriftFieldId() {
83
      return _thriftId;
84
    }
85
 
86
    public String getFieldName() {
87
      return _fieldName;
88
    }
89
  }
90
 
91
  // isset id assignments
92
  private static final int __ID_ISSET_ID = 0;
93
  private static final int __AFFILIATEID_ISSET_ID = 1;
94
  private BitSet __isset_bit_vector = new BitSet(2);
95
 
96
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
97
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
98
        new FieldValueMetaData(TType.I64)));
99
    put(_Fields.AFFILIATE_ID, new FieldMetaData("affiliateId", TFieldRequirementType.DEFAULT, 
100
        new FieldValueMetaData(TType.I64)));
101
  }});
102
 
103
  static {
104
    FieldMetaData.addStructMetaDataMap(Tracker.class, metaDataMap);
105
  }
106
 
107
  public Tracker() {
108
  }
109
 
110
  public Tracker(
111
    long id,
112
    long affiliateId)
113
  {
114
    this();
115
    this.id = id;
116
    setIdIsSet(true);
117
    this.affiliateId = affiliateId;
118
    setAffiliateIdIsSet(true);
119
  }
120
 
121
  /**
122
   * Performs a deep copy on <i>other</i>.
123
   */
124
  public Tracker(Tracker other) {
125
    __isset_bit_vector.clear();
126
    __isset_bit_vector.or(other.__isset_bit_vector);
127
    this.id = other.id;
128
    this.affiliateId = other.affiliateId;
129
  }
130
 
131
  public Tracker deepCopy() {
132
    return new Tracker(this);
133
  }
134
 
135
  @Deprecated
136
  public Tracker clone() {
137
    return new Tracker(this);
138
  }
139
 
140
  public long getId() {
141
    return this.id;
142
  }
143
 
144
  public Tracker setId(long id) {
145
    this.id = id;
146
    setIdIsSet(true);
147
    return this;
148
  }
149
 
150
  public void unsetId() {
151
    __isset_bit_vector.clear(__ID_ISSET_ID);
152
  }
153
 
154
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
155
  public boolean isSetId() {
156
    return __isset_bit_vector.get(__ID_ISSET_ID);
157
  }
158
 
159
  public void setIdIsSet(boolean value) {
160
    __isset_bit_vector.set(__ID_ISSET_ID, value);
161
  }
162
 
163
  public long getAffiliateId() {
164
    return this.affiliateId;
165
  }
166
 
167
  public Tracker setAffiliateId(long affiliateId) {
168
    this.affiliateId = affiliateId;
169
    setAffiliateIdIsSet(true);
170
    return this;
171
  }
172
 
173
  public void unsetAffiliateId() {
174
    __isset_bit_vector.clear(__AFFILIATEID_ISSET_ID);
175
  }
176
 
177
  /** Returns true if field affiliateId is set (has been asigned a value) and false otherwise */
178
  public boolean isSetAffiliateId() {
179
    return __isset_bit_vector.get(__AFFILIATEID_ISSET_ID);
180
  }
181
 
182
  public void setAffiliateIdIsSet(boolean value) {
183
    __isset_bit_vector.set(__AFFILIATEID_ISSET_ID, value);
184
  }
185
 
186
  public void setFieldValue(_Fields field, Object value) {
187
    switch (field) {
188
    case ID:
189
      if (value == null) {
190
        unsetId();
191
      } else {
192
        setId((Long)value);
193
      }
194
      break;
195
 
196
    case AFFILIATE_ID:
197
      if (value == null) {
198
        unsetAffiliateId();
199
      } else {
200
        setAffiliateId((Long)value);
201
      }
202
      break;
203
 
204
    }
205
  }
206
 
207
  public void setFieldValue(int fieldID, Object value) {
208
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
209
  }
210
 
211
  public Object getFieldValue(_Fields field) {
212
    switch (field) {
213
    case ID:
214
      return new Long(getId());
215
 
216
    case AFFILIATE_ID:
217
      return new Long(getAffiliateId());
218
 
219
    }
220
    throw new IllegalStateException();
221
  }
222
 
223
  public Object getFieldValue(int fieldId) {
224
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
225
  }
226
 
227
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
228
  public boolean isSet(_Fields field) {
229
    switch (field) {
230
    case ID:
231
      return isSetId();
232
    case AFFILIATE_ID:
233
      return isSetAffiliateId();
234
    }
235
    throw new IllegalStateException();
236
  }
237
 
238
  public boolean isSet(int fieldID) {
239
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
240
  }
241
 
242
  @Override
243
  public boolean equals(Object that) {
244
    if (that == null)
245
      return false;
246
    if (that instanceof Tracker)
247
      return this.equals((Tracker)that);
248
    return false;
249
  }
250
 
251
  public boolean equals(Tracker that) {
252
    if (that == null)
253
      return false;
254
 
255
    boolean this_present_id = true;
256
    boolean that_present_id = true;
257
    if (this_present_id || that_present_id) {
258
      if (!(this_present_id && that_present_id))
259
        return false;
260
      if (this.id != that.id)
261
        return false;
262
    }
263
 
264
    boolean this_present_affiliateId = true;
265
    boolean that_present_affiliateId = true;
266
    if (this_present_affiliateId || that_present_affiliateId) {
267
      if (!(this_present_affiliateId && that_present_affiliateId))
268
        return false;
269
      if (this.affiliateId != that.affiliateId)
270
        return false;
271
    }
272
 
273
    return true;
274
  }
275
 
276
  @Override
277
  public int hashCode() {
278
    return 0;
279
  }
280
 
281
  public int compareTo(Tracker other) {
282
    if (!getClass().equals(other.getClass())) {
283
      return getClass().getName().compareTo(other.getClass().getName());
284
    }
285
 
286
    int lastComparison = 0;
287
    Tracker typedOther = (Tracker)other;
288
 
289
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
290
    if (lastComparison != 0) {
291
      return lastComparison;
292
    }
293
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
294
    if (lastComparison != 0) {
295
      return lastComparison;
296
    }
297
    lastComparison = Boolean.valueOf(isSetAffiliateId()).compareTo(isSetAffiliateId());
298
    if (lastComparison != 0) {
299
      return lastComparison;
300
    }
301
    lastComparison = TBaseHelper.compareTo(affiliateId, typedOther.affiliateId);
302
    if (lastComparison != 0) {
303
      return lastComparison;
304
    }
305
    return 0;
306
  }
307
 
308
  public void read(TProtocol iprot) throws TException {
309
    TField field;
310
    iprot.readStructBegin();
311
    while (true)
312
    {
313
      field = iprot.readFieldBegin();
314
      if (field.type == TType.STOP) { 
315
        break;
316
      }
317
      _Fields fieldId = _Fields.findByThriftId(field.id);
318
      if (fieldId == null) {
319
        TProtocolUtil.skip(iprot, field.type);
320
      } else {
321
        switch (fieldId) {
322
          case ID:
323
            if (field.type == TType.I64) {
324
              this.id = iprot.readI64();
325
              setIdIsSet(true);
326
            } else { 
327
              TProtocolUtil.skip(iprot, field.type);
328
            }
329
            break;
330
          case AFFILIATE_ID:
331
            if (field.type == TType.I64) {
332
              this.affiliateId = iprot.readI64();
333
              setAffiliateIdIsSet(true);
334
            } else { 
335
              TProtocolUtil.skip(iprot, field.type);
336
            }
337
            break;
338
        }
339
        iprot.readFieldEnd();
340
      }
341
    }
342
    iprot.readStructEnd();
343
    validate();
344
  }
345
 
346
  public void write(TProtocol oprot) throws TException {
347
    validate();
348
 
349
    oprot.writeStructBegin(STRUCT_DESC);
350
    oprot.writeFieldBegin(ID_FIELD_DESC);
351
    oprot.writeI64(this.id);
352
    oprot.writeFieldEnd();
353
    oprot.writeFieldBegin(AFFILIATE_ID_FIELD_DESC);
354
    oprot.writeI64(this.affiliateId);
355
    oprot.writeFieldEnd();
356
    oprot.writeFieldStop();
357
    oprot.writeStructEnd();
358
  }
359
 
360
  @Override
361
  public String toString() {
362
    StringBuilder sb = new StringBuilder("Tracker(");
363
    boolean first = true;
364
 
365
    sb.append("id:");
366
    sb.append(this.id);
367
    first = false;
368
    if (!first) sb.append(", ");
369
    sb.append("affiliateId:");
370
    sb.append(this.affiliateId);
371
    first = false;
372
    sb.append(")");
373
    return sb.toString();
374
  }
375
 
376
  public void validate() throws TException {
377
    // check for required fields
378
  }
379
 
380
}
381