Subversion Repositories SmartDukaan

Rev

Rev 1013 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1013 Rev 3430
Line 1... Line 1...
1
/**
1
/**
2
 * Autogenerated by Thrift
2
 * Autogenerated by Thrift Compiler (0.7.0)
3
 *
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
5
 */
6
package in.shop2020.model.v1.user;
6
package in.shop2020.model.v1.user;
7
 
7
 
Line 13... Line 13...
13
import java.util.Set;
13
import java.util.Set;
14
import java.util.HashSet;
14
import java.util.HashSet;
15
import java.util.EnumSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
16
import java.util.Collections;
17
import java.util.BitSet;
17
import java.util.BitSet;
-
 
18
import java.nio.ByteBuffer;
18
import java.util.Arrays;
19
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
21
 
22
 
22
import org.apache.thrift.*;
-
 
23
import org.apache.thrift.meta_data.*;
-
 
24
import org.apache.thrift.protocol.*;
-
 
25
 
-
 
26
/**
23
/**
27
 * structure representing timestamp and ip at which user logged into the system
24
 * structure representing timestamp and ip at which user logged into the system
28
 * *
25
 * *
29
 */
26
 */
30
public class IPMap implements TBase<IPMap._Fields>, java.io.Serializable, Cloneable, Comparable<IPMap> {
27
public class IPMap implements org.apache.thrift.TBase<IPMap, IPMap._Fields>, java.io.Serializable, Cloneable {
31
  private static final TStruct STRUCT_DESC = new TStruct("IPMap");
28
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IPMap");
32
 
29
 
33
  private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)1);
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);
34
  private static final TField IP_FIELD_DESC = new TField("ip", TType.STRING, (short)2);
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);
35
 
32
 
36
  private long timestamp;
33
  private long timestamp; // required
37
  private String ip;
34
  private String ip; // required
38
 
35
 
39
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
36
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
40
  public enum _Fields implements TFieldIdEnum {
37
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
41
    TIMESTAMP((short)1, "timestamp"),
38
    TIMESTAMP((short)1, "timestamp"),
42
    IP((short)2, "ip");
39
    IP((short)2, "ip");
43
 
40
 
44
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
45
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
46
 
42
 
47
    static {
43
    static {
48
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
44
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
49
        byId.put((int)field._thriftId, field);
-
 
50
        byName.put(field.getFieldName(), field);
45
        byName.put(field.getFieldName(), field);
51
      }
46
      }
52
    }
47
    }
53
 
48
 
54
    /**
49
    /**
55
     * Find the _Fields constant that matches fieldId, or null if its not found.
50
     * Find the _Fields constant that matches fieldId, or null if its not found.
56
     */
51
     */
57
    public static _Fields findByThriftId(int fieldId) {
52
    public static _Fields findByThriftId(int fieldId) {
58
      return byId.get(fieldId);
53
      switch(fieldId) {
-
 
54
        case 1: // TIMESTAMP
-
 
55
          return TIMESTAMP;
-
 
56
        case 2: // IP
-
 
57
          return IP;
-
 
58
        default:
-
 
59
          return null;
-
 
60
      }
59
    }
61
    }
60
 
62
 
61
    /**
63
    /**
62
     * Find the _Fields constant that matches fieldId, throwing an exception
64
     * Find the _Fields constant that matches fieldId, throwing an exception
63
     * if it is not found.
65
     * if it is not found.
Line 94... Line 96...
94
 
96
 
95
  // isset id assignments
97
  // isset id assignments
96
  private static final int __TIMESTAMP_ISSET_ID = 0;
98
  private static final int __TIMESTAMP_ISSET_ID = 0;
97
  private BitSet __isset_bit_vector = new BitSet(1);
99
  private BitSet __isset_bit_vector = new BitSet(1);
98
 
100
 
99
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
101
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
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 {
102
  static {
-
 
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);
107
    FieldMetaData.addStructMetaDataMap(IPMap.class, metaDataMap);
109
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IPMap.class, metaDataMap);
108
  }
110
  }
109
 
111
 
110
  public IPMap() {
112
  public IPMap() {
111
  }
113
  }
112
 
114
 
Line 134... Line 136...
134
 
136
 
135
  public IPMap deepCopy() {
137
  public IPMap deepCopy() {
136
    return new IPMap(this);
138
    return new IPMap(this);
137
  }
139
  }
138
 
140
 
139
  @Deprecated
141
  @Override
140
  public IPMap clone() {
142
  public void clear() {
141
    return new IPMap(this);
143
    setTimestampIsSet(false);
-
 
144
    this.timestamp = 0;
-
 
145
    this.ip = null;
142
  }
146
  }
143
 
147
 
144
  public long getTimestamp() {
148
  public long getTimestamp() {
145
    return this.timestamp;
149
    return this.timestamp;
146
  }
150
  }
147
 
151
 
148
  public IPMap setTimestamp(long timestamp) {
152
  public void setTimestamp(long timestamp) {
149
    this.timestamp = timestamp;
153
    this.timestamp = timestamp;
150
    setTimestampIsSet(true);
154
    setTimestampIsSet(true);
151
    return this;
-
 
152
  }
155
  }
153
 
156
 
154
  public void unsetTimestamp() {
157
  public void unsetTimestamp() {
155
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
158
    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
156
  }
159
  }
157
 
160
 
158
  /** Returns true if field timestamp is set (has been asigned a value) and false otherwise */
161
  /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
159
  public boolean isSetTimestamp() {
162
  public boolean isSetTimestamp() {
160
    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
163
    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
161
  }
164
  }
162
 
165
 
163
  public void setTimestampIsSet(boolean value) {
166
  public void setTimestampIsSet(boolean value) {
Line 166... Line 169...
166
 
169
 
167
  public String getIp() {
170
  public String getIp() {
168
    return this.ip;
171
    return this.ip;
169
  }
172
  }
170
 
173
 
171
  public IPMap setIp(String ip) {
174
  public void setIp(String ip) {
172
    this.ip = ip;
175
    this.ip = ip;
173
    return this;
-
 
174
  }
176
  }
175
 
177
 
176
  public void unsetIp() {
178
  public void unsetIp() {
177
    this.ip = null;
179
    this.ip = null;
178
  }
180
  }
179
 
181
 
180
  /** Returns true if field ip is set (has been asigned a value) and false otherwise */
182
  /** Returns true if field ip is set (has been assigned a value) and false otherwise */
181
  public boolean isSetIp() {
183
  public boolean isSetIp() {
182
    return this.ip != null;
184
    return this.ip != null;
183
  }
185
  }
184
 
186
 
185
  public void setIpIsSet(boolean value) {
187
  public void setIpIsSet(boolean value) {
Line 207... Line 209...
207
      break;
209
      break;
208
 
210
 
209
    }
211
    }
210
  }
212
  }
211
 
213
 
212
  public void setFieldValue(int fieldID, Object value) {
-
 
213
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
214
  }
-
 
215
 
-
 
216
  public Object getFieldValue(_Fields field) {
214
  public Object getFieldValue(_Fields field) {
217
    switch (field) {
215
    switch (field) {
218
    case TIMESTAMP:
216
    case TIMESTAMP:
219
      return new Long(getTimestamp());
217
      return Long.valueOf(getTimestamp());
220
 
218
 
221
    case IP:
219
    case IP:
222
      return getIp();
220
      return getIp();
223
 
221
 
224
    }
222
    }
225
    throw new IllegalStateException();
223
    throw new IllegalStateException();
226
  }
224
  }
227
 
225
 
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 */
226
  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
233
  public boolean isSet(_Fields field) {
227
  public boolean isSet(_Fields field) {
-
 
228
    if (field == null) {
-
 
229
      throw new IllegalArgumentException();
-
 
230
    }
-
 
231
 
234
    switch (field) {
232
    switch (field) {
235
    case TIMESTAMP:
233
    case TIMESTAMP:
236
      return isSetTimestamp();
234
      return isSetTimestamp();
237
    case IP:
235
    case IP:
238
      return isSetIp();
236
      return isSetIp();
239
    }
237
    }
240
    throw new IllegalStateException();
238
    throw new IllegalStateException();
241
  }
239
  }
242
 
240
 
243
  public boolean isSet(int fieldID) {
-
 
244
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
245
  }
-
 
246
 
-
 
247
  @Override
241
  @Override
248
  public boolean equals(Object that) {
242
  public boolean equals(Object that) {
249
    if (that == null)
243
    if (that == null)
250
      return false;
244
      return false;
251
    if (that instanceof IPMap)
245
    if (that instanceof IPMap)
Line 289... Line 283...
289
    }
283
    }
290
 
284
 
291
    int lastComparison = 0;
285
    int lastComparison = 0;
292
    IPMap typedOther = (IPMap)other;
286
    IPMap typedOther = (IPMap)other;
293
 
287
 
294
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
288
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
295
    if (lastComparison != 0) {
289
    if (lastComparison != 0) {
296
      return lastComparison;
290
      return lastComparison;
297
    }
291
    }
-
 
292
    if (isSetTimestamp()) {
298
    lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
293
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
299
    if (lastComparison != 0) {
294
      if (lastComparison != 0) {
300
      return lastComparison;
295
        return lastComparison;
-
 
296
      }
301
    }
297
    }
302
    lastComparison = Boolean.valueOf(isSetIp()).compareTo(isSetIp());
298
    lastComparison = Boolean.valueOf(isSetIp()).compareTo(typedOther.isSetIp());
303
    if (lastComparison != 0) {
299
    if (lastComparison != 0) {
304
      return lastComparison;
300
      return lastComparison;
305
    }
301
    }
-
 
302
    if (isSetIp()) {
306
    lastComparison = TBaseHelper.compareTo(ip, typedOther.ip);
303
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ip, typedOther.ip);
307
    if (lastComparison != 0) {
304
      if (lastComparison != 0) {
308
      return lastComparison;
305
        return lastComparison;
-
 
306
      }
309
    }
307
    }
310
    return 0;
308
    return 0;
311
  }
309
  }
312
 
310
 
-
 
311
  public _Fields fieldForId(int fieldId) {
-
 
312
    return _Fields.findByThriftId(fieldId);
-
 
313
  }
-
 
314
 
313
  public void read(TProtocol iprot) throws TException {
315
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
314
    TField field;
316
    org.apache.thrift.protocol.TField field;
315
    iprot.readStructBegin();
317
    iprot.readStructBegin();
316
    while (true)
318
    while (true)
317
    {
319
    {
318
      field = iprot.readFieldBegin();
320
      field = iprot.readFieldBegin();
319
      if (field.type == TType.STOP) { 
321
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
320
        break;
322
        break;
321
      }
323
      }
322
      _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
323
      if (fieldId == null) {
-
 
324
        TProtocolUtil.skip(iprot, field.type);
-
 
325
      } else {
-
 
326
        switch (fieldId) {
324
      switch (field.id) {
327
          case TIMESTAMP:
325
        case 1: // TIMESTAMP
328
            if (field.type == TType.I64) {
326
          if (field.type == org.apache.thrift.protocol.TType.I64) {
329
              this.timestamp = iprot.readI64();
327
            this.timestamp = iprot.readI64();
330
              setTimestampIsSet(true);
328
            setTimestampIsSet(true);
331
            } else { 
329
          } else { 
332
              TProtocolUtil.skip(iprot, field.type);
330
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
333
            }
331
          }
334
            break;
332
          break;
335
          case IP:
333
        case 2: // IP
336
            if (field.type == TType.STRING) {
334
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
337
              this.ip = iprot.readString();
335
            this.ip = iprot.readString();
338
            } else { 
336
          } else { 
339
              TProtocolUtil.skip(iprot, field.type);
337
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
340
            }
338
          }
341
            break;
339
          break;
342
        }
340
        default:
343
        iprot.readFieldEnd();
341
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
344
      }
342
      }
-
 
343
      iprot.readFieldEnd();
345
    }
344
    }
346
    iprot.readStructEnd();
345
    iprot.readStructEnd();
347
    validate();
346
    validate();
348
  }
347
  }
349
 
348
 
350
  public void write(TProtocol oprot) throws TException {
349
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
351
    validate();
350
    validate();
352
 
351
 
353
    oprot.writeStructBegin(STRUCT_DESC);
352
    oprot.writeStructBegin(STRUCT_DESC);
354
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
353
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
355
    oprot.writeI64(this.timestamp);
354
    oprot.writeI64(this.timestamp);
Line 381... Line 380...
381
    first = false;
380
    first = false;
382
    sb.append(")");
381
    sb.append(")");
383
    return sb.toString();
382
    return sb.toString();
384
  }
383
  }
385
 
384
 
386
  public void validate() throws TException {
385
  public void validate() throws org.apache.thrift.TException {
387
    // check for required fields
386
    // check for required fields
388
  }
387
  }
389
 
388
 
-
 
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
 
390
}
407
}
391
 
408