Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 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
public class TIPMap implements TBase<TIPMap._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("TIPMap");
28
 
29
  private static final TField IPS_FIELD_DESC = new TField("ips", TType.MAP, (short)1);
30
 
31
  private Map<Long,String> ips;
32
 
33
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
34
  public enum _Fields implements TFieldIdEnum {
35
    IPS((short)1, "ips");
36
 
37
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
38
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
39
 
40
    static {
41
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
42
        byId.put((int)field._thriftId, field);
43
        byName.put(field.getFieldName(), field);
44
      }
45
    }
46
 
47
    /**
48
     * Find the _Fields constant that matches fieldId, or null if its not found.
49
     */
50
    public static _Fields findByThriftId(int fieldId) {
51
      return byId.get(fieldId);
52
    }
53
 
54
    /**
55
     * Find the _Fields constant that matches fieldId, throwing an exception
56
     * if it is not found.
57
     */
58
    public static _Fields findByThriftIdOrThrow(int fieldId) {
59
      _Fields fields = findByThriftId(fieldId);
60
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
61
      return fields;
62
    }
63
 
64
    /**
65
     * Find the _Fields constant that matches name, or null if its not found.
66
     */
67
    public static _Fields findByName(String name) {
68
      return byName.get(name);
69
    }
70
 
71
    private final short _thriftId;
72
    private final String _fieldName;
73
 
74
    _Fields(short thriftId, String fieldName) {
75
      _thriftId = thriftId;
76
      _fieldName = fieldName;
77
    }
78
 
79
    public short getThriftFieldId() {
80
      return _thriftId;
81
    }
82
 
83
    public String getFieldName() {
84
      return _fieldName;
85
    }
86
  }
87
 
88
  // isset id assignments
89
 
90
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
91
    put(_Fields.IPS, new FieldMetaData("ips", TFieldRequirementType.DEFAULT, 
92
        new MapMetaData(TType.MAP, 
93
            new FieldValueMetaData(TType.I64), 
94
            new FieldValueMetaData(TType.STRING))));
95
  }});
96
 
97
  static {
98
    FieldMetaData.addStructMetaDataMap(TIPMap.class, metaDataMap);
99
  }
100
 
101
  public TIPMap() {
102
  }
103
 
104
  public TIPMap(
105
    Map<Long,String> ips)
106
  {
107
    this();
108
    this.ips = ips;
109
  }
110
 
111
  /**
112
   * Performs a deep copy on <i>other</i>.
113
   */
114
  public TIPMap(TIPMap other) {
115
    if (other.isSetIps()) {
116
      Map<Long,String> __this__ips = new HashMap<Long,String>();
117
      for (Map.Entry<Long, String> other_element : other.ips.entrySet()) {
118
 
119
        Long other_element_key = other_element.getKey();
120
        String other_element_value = other_element.getValue();
121
 
122
        Long __this__ips_copy_key = other_element_key;
123
 
124
        String __this__ips_copy_value = other_element_value;
125
 
126
        __this__ips.put(__this__ips_copy_key, __this__ips_copy_value);
127
      }
128
      this.ips = __this__ips;
129
    }
130
  }
131
 
132
  public TIPMap deepCopy() {
133
    return new TIPMap(this);
134
  }
135
 
136
  @Deprecated
137
  public TIPMap clone() {
138
    return new TIPMap(this);
139
  }
140
 
141
  public int getIpsSize() {
142
    return (this.ips == null) ? 0 : this.ips.size();
143
  }
144
 
145
  public void putToIps(long key, String val) {
146
    if (this.ips == null) {
147
      this.ips = new HashMap<Long,String>();
148
    }
149
    this.ips.put(key, val);
150
  }
151
 
152
  public Map<Long,String> getIps() {
153
    return this.ips;
154
  }
155
 
156
  public TIPMap setIps(Map<Long,String> ips) {
157
    this.ips = ips;
158
    return this;
159
  }
160
 
161
  public void unsetIps() {
162
    this.ips = null;
163
  }
164
 
165
  /** Returns true if field ips is set (has been asigned a value) and false otherwise */
166
  public boolean isSetIps() {
167
    return this.ips != null;
168
  }
169
 
170
  public void setIpsIsSet(boolean value) {
171
    if (!value) {
172
      this.ips = null;
173
    }
174
  }
175
 
176
  public void setFieldValue(_Fields field, Object value) {
177
    switch (field) {
178
    case IPS:
179
      if (value == null) {
180
        unsetIps();
181
      } else {
182
        setIps((Map<Long,String>)value);
183
      }
184
      break;
185
 
186
    }
187
  }
188
 
189
  public void setFieldValue(int fieldID, Object value) {
190
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
191
  }
192
 
193
  public Object getFieldValue(_Fields field) {
194
    switch (field) {
195
    case IPS:
196
      return getIps();
197
 
198
    }
199
    throw new IllegalStateException();
200
  }
201
 
202
  public Object getFieldValue(int fieldId) {
203
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
204
  }
205
 
206
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
207
  public boolean isSet(_Fields field) {
208
    switch (field) {
209
    case IPS:
210
      return isSetIps();
211
    }
212
    throw new IllegalStateException();
213
  }
214
 
215
  public boolean isSet(int fieldID) {
216
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
217
  }
218
 
219
  @Override
220
  public boolean equals(Object that) {
221
    if (that == null)
222
      return false;
223
    if (that instanceof TIPMap)
224
      return this.equals((TIPMap)that);
225
    return false;
226
  }
227
 
228
  public boolean equals(TIPMap that) {
229
    if (that == null)
230
      return false;
231
 
232
    boolean this_present_ips = true && this.isSetIps();
233
    boolean that_present_ips = true && that.isSetIps();
234
    if (this_present_ips || that_present_ips) {
235
      if (!(this_present_ips && that_present_ips))
236
        return false;
237
      if (!this.ips.equals(that.ips))
238
        return false;
239
    }
240
 
241
    return true;
242
  }
243
 
244
  @Override
245
  public int hashCode() {
246
    return 0;
247
  }
248
 
249
  public void read(TProtocol iprot) throws TException {
250
    TField field;
251
    iprot.readStructBegin();
252
    while (true)
253
    {
254
      field = iprot.readFieldBegin();
255
      if (field.type == TType.STOP) { 
256
        break;
257
      }
258
      _Fields fieldId = _Fields.findByThriftId(field.id);
259
      if (fieldId == null) {
260
        TProtocolUtil.skip(iprot, field.type);
261
      } else {
262
        switch (fieldId) {
263
          case IPS:
264
            if (field.type == TType.MAP) {
265
              {
266
                TMap _map4 = iprot.readMapBegin();
267
                this.ips = new HashMap<Long,String>(2*_map4.size);
268
                for (int _i5 = 0; _i5 < _map4.size; ++_i5)
269
                {
270
                  long _key6;
271
                  String _val7;
272
                  _key6 = iprot.readI64();
273
                  _val7 = iprot.readString();
274
                  this.ips.put(_key6, _val7);
275
                }
276
                iprot.readMapEnd();
277
              }
278
            } else { 
279
              TProtocolUtil.skip(iprot, field.type);
280
            }
281
            break;
282
        }
283
        iprot.readFieldEnd();
284
      }
285
    }
286
    iprot.readStructEnd();
287
    validate();
288
  }
289
 
290
  public void write(TProtocol oprot) throws TException {
291
    validate();
292
 
293
    oprot.writeStructBegin(STRUCT_DESC);
294
    if (this.ips != null) {
295
      oprot.writeFieldBegin(IPS_FIELD_DESC);
296
      {
297
        oprot.writeMapBegin(new TMap(TType.I64, TType.STRING, this.ips.size()));
298
        for (Map.Entry<Long, String> _iter8 : this.ips.entrySet())
299
        {
300
          oprot.writeI64(_iter8.getKey());
301
          oprot.writeString(_iter8.getValue());
302
        }
303
        oprot.writeMapEnd();
304
      }
305
      oprot.writeFieldEnd();
306
    }
307
    oprot.writeFieldStop();
308
    oprot.writeStructEnd();
309
  }
310
 
311
  @Override
312
  public String toString() {
313
    StringBuilder sb = new StringBuilder("TIPMap(");
314
    boolean first = true;
315
 
316
    sb.append("ips:");
317
    if (this.ips == null) {
318
      sb.append("null");
319
    } else {
320
      sb.append(this.ips);
321
    }
322
    first = false;
323
    sb.append(")");
324
    return sb.toString();
325
  }
326
 
327
  public void validate() throws TException {
328
    // check for required fields
329
  }
330
 
331
}
332