Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
123 ashish 1
/**
3430 rajveer 2
 * Autogenerated by Thrift Compiler (0.7.0)
123 ashish 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;
123 ashish 19
import java.util.Arrays;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
 
23
/**
24
 * structure representing timestamp and ip at which user logged into the system
25
 * *
26
 */
3430 rajveer 27
public class IPMap implements org.apache.thrift.TBase<IPMap, IPMap._Fields>, java.io.Serializable, Cloneable {
28
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IPMap");
123 ashish 29
 
3430 rajveer 30
  private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1);
31
  private static final org.apache.thrift.protocol.TField IP_FIELD_DESC = new org.apache.thrift.protocol.TField("ip", org.apache.thrift.protocol.TType.STRING, (short)2);
123 ashish 32
 
3430 rajveer 33
  private long timestamp; // required
34
  private String ip; // required
123 ashish 35
 
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
3430 rajveer 37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
123 ashish 38
    TIMESTAMP((short)1, "timestamp"),
39
    IP((short)2, "ip");
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) {
3430 rajveer 53
      switch(fieldId) {
54
        case 1: // TIMESTAMP
55
          return TIMESTAMP;
56
        case 2: // IP
57
          return IP;
58
        default:
59
          return null;
60
      }
123 ashish 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
  private static final int __TIMESTAMP_ISSET_ID = 0;
99
  private BitSet __isset_bit_vector = new BitSet(1);
100
 
3430 rajveer 101
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
123 ashish 102
  static {
3430 rajveer 103
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
104
    tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
105
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
106
    tmpMap.put(_Fields.IP, new org.apache.thrift.meta_data.FieldMetaData("ip", org.apache.thrift.TFieldRequirementType.DEFAULT, 
107
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
108
    metaDataMap = Collections.unmodifiableMap(tmpMap);
109
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IPMap.class, metaDataMap);
123 ashish 110
  }
111
 
112
  public IPMap() {
113
  }
114
 
115
  public IPMap(
116
    long timestamp,
117
    String ip)
118
  {
119
    this();
120
    this.timestamp = timestamp;
121
    setTimestampIsSet(true);
122
    this.ip = ip;
123
  }
124
 
125
  /**
126
   * Performs a deep copy on <i>other</i>.
127
   */
128
  public IPMap(IPMap other) {
129
    __isset_bit_vector.clear();
130
    __isset_bit_vector.or(other.__isset_bit_vector);
131
    this.timestamp = other.timestamp;
132
    if (other.isSetIp()) {
133
      this.ip = other.ip;
134
    }
135
  }
136
 
137
  public IPMap deepCopy() {
138
    return new IPMap(this);
139
  }
140
 
3430 rajveer 141
  @Override
142
  public void clear() {
143
    setTimestampIsSet(false);
144
    this.timestamp = 0;
145
    this.ip = null;
123 ashish 146
  }
147
 
148
  public long getTimestamp() {
149
    return this.timestamp;
150
  }
151
 
3430 rajveer 152
  public void setTimestamp(long timestamp) {
123 ashish 153
    this.timestamp = timestamp;
154
    setTimestampIsSet(true);
155
  }
156
 
157
  public void unsetTimestamp() {
158
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
159
  }
160
 
3430 rajveer 161
  /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
123 ashish 162
  public boolean isSetTimestamp() {
163
    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
164
  }
165
 
166
  public void setTimestampIsSet(boolean value) {
167
    __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
168
  }
169
 
170
  public String getIp() {
171
    return this.ip;
172
  }
173
 
3430 rajveer 174
  public void setIp(String ip) {
123 ashish 175
    this.ip = ip;
176
  }
177
 
178
  public void unsetIp() {
179
    this.ip = null;
180
  }
181
 
3430 rajveer 182
  /** Returns true if field ip is set (has been assigned a value) and false otherwise */
123 ashish 183
  public boolean isSetIp() {
184
    return this.ip != null;
185
  }
186
 
187
  public void setIpIsSet(boolean value) {
188
    if (!value) {
189
      this.ip = null;
190
    }
191
  }
192
 
193
  public void setFieldValue(_Fields field, Object value) {
194
    switch (field) {
195
    case TIMESTAMP:
196
      if (value == null) {
197
        unsetTimestamp();
198
      } else {
199
        setTimestamp((Long)value);
200
      }
201
      break;
202
 
203
    case IP:
204
      if (value == null) {
205
        unsetIp();
206
      } else {
207
        setIp((String)value);
208
      }
209
      break;
210
 
211
    }
212
  }
213
 
214
  public Object getFieldValue(_Fields field) {
215
    switch (field) {
216
    case TIMESTAMP:
3430 rajveer 217
      return Long.valueOf(getTimestamp());
123 ashish 218
 
219
    case IP:
220
      return getIp();
221
 
222
    }
223
    throw new IllegalStateException();
224
  }
225
 
3430 rajveer 226
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
227
  public boolean isSet(_Fields field) {
228
    if (field == null) {
229
      throw new IllegalArgumentException();
230
    }
123 ashish 231
 
232
    switch (field) {
233
    case TIMESTAMP:
234
      return isSetTimestamp();
235
    case IP:
236
      return isSetIp();
237
    }
238
    throw new IllegalStateException();
239
  }
240
 
241
  @Override
242
  public boolean equals(Object that) {
243
    if (that == null)
244
      return false;
245
    if (that instanceof IPMap)
246
      return this.equals((IPMap)that);
247
    return false;
248
  }
249
 
250
  public boolean equals(IPMap that) {
251
    if (that == null)
252
      return false;
253
 
254
    boolean this_present_timestamp = true;
255
    boolean that_present_timestamp = true;
256
    if (this_present_timestamp || that_present_timestamp) {
257
      if (!(this_present_timestamp && that_present_timestamp))
258
        return false;
259
      if (this.timestamp != that.timestamp)
260
        return false;
261
    }
262
 
263
    boolean this_present_ip = true && this.isSetIp();
264
    boolean that_present_ip = true && that.isSetIp();
265
    if (this_present_ip || that_present_ip) {
266
      if (!(this_present_ip && that_present_ip))
267
        return false;
268
      if (!this.ip.equals(that.ip))
269
        return false;
270
    }
271
 
272
    return true;
273
  }
274
 
275
  @Override
276
  public int hashCode() {
277
    return 0;
278
  }
279
 
280
  public int compareTo(IPMap other) {
281
    if (!getClass().equals(other.getClass())) {
282
      return getClass().getName().compareTo(other.getClass().getName());
283
    }
284
 
285
    int lastComparison = 0;
286
    IPMap typedOther = (IPMap)other;
287
 
3430 rajveer 288
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
123 ashish 289
    if (lastComparison != 0) {
290
      return lastComparison;
291
    }
3430 rajveer 292
    if (isSetTimestamp()) {
293
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
294
      if (lastComparison != 0) {
295
        return lastComparison;
296
      }
123 ashish 297
    }
3430 rajveer 298
    lastComparison = Boolean.valueOf(isSetIp()).compareTo(typedOther.isSetIp());
123 ashish 299
    if (lastComparison != 0) {
300
      return lastComparison;
301
    }
3430 rajveer 302
    if (isSetIp()) {
303
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ip, typedOther.ip);
304
      if (lastComparison != 0) {
305
        return lastComparison;
306
      }
123 ashish 307
    }
308
    return 0;
309
  }
310
 
3430 rajveer 311
  public _Fields fieldForId(int fieldId) {
312
    return _Fields.findByThriftId(fieldId);
313
  }
314
 
315
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
316
    org.apache.thrift.protocol.TField field;
123 ashish 317
    iprot.readStructBegin();
318
    while (true)
319
    {
320
      field = iprot.readFieldBegin();
3430 rajveer 321
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
123 ashish 322
        break;
323
      }
3430 rajveer 324
      switch (field.id) {
325
        case 1: // TIMESTAMP
326
          if (field.type == org.apache.thrift.protocol.TType.I64) {
327
            this.timestamp = iprot.readI64();
328
            setTimestampIsSet(true);
329
          } else { 
330
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
331
          }
332
          break;
333
        case 2: // IP
334
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
335
            this.ip = iprot.readString();
336
          } else { 
337
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
338
          }
339
          break;
340
        default:
341
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
123 ashish 342
      }
3430 rajveer 343
      iprot.readFieldEnd();
123 ashish 344
    }
345
    iprot.readStructEnd();
346
    validate();
347
  }
348
 
3430 rajveer 349
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
123 ashish 350
    validate();
351
 
352
    oprot.writeStructBegin(STRUCT_DESC);
353
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
354
    oprot.writeI64(this.timestamp);
355
    oprot.writeFieldEnd();
356
    if (this.ip != null) {
357
      oprot.writeFieldBegin(IP_FIELD_DESC);
358
      oprot.writeString(this.ip);
359
      oprot.writeFieldEnd();
360
    }
361
    oprot.writeFieldStop();
362
    oprot.writeStructEnd();
363
  }
364
 
365
  @Override
366
  public String toString() {
367
    StringBuilder sb = new StringBuilder("IPMap(");
368
    boolean first = true;
369
 
370
    sb.append("timestamp:");
371
    sb.append(this.timestamp);
372
    first = false;
373
    if (!first) sb.append(", ");
374
    sb.append("ip:");
375
    if (this.ip == null) {
376
      sb.append("null");
377
    } else {
378
      sb.append(this.ip);
379
    }
380
    first = false;
381
    sb.append(")");
382
    return sb.toString();
383
  }
384
 
3430 rajveer 385
  public void validate() throws org.apache.thrift.TException {
123 ashish 386
    // check for required fields
387
  }
388
 
3430 rajveer 389
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
390
    try {
391
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
392
    } catch (org.apache.thrift.TException te) {
393
      throw new java.io.IOException(te);
394
    }
395
  }
396
 
397
  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
398
    try {
399
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
400
      __isset_bit_vector = new BitSet(1);
401
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
402
    } catch (org.apache.thrift.TException te) {
403
      throw new java.io.IOException(te);
404
    }
405
  }
406
 
123 ashish 407
}
408