Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

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