Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1611 ankur.sing 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.utils;
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 StatisticsUser implements TBase<StatisticsUser._Fields>, java.io.Serializable, Cloneable, Comparable<StatisticsUser> {
27
  private static final TStruct STRUCT_DESC = new TStruct("StatisticsUser");
28
 
29
  private static final TField USERNAME_FIELD_DESC = new TField("username", TType.STRING, (short)1);
30
 
31
  private String username;
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
    USERNAME((short)1, "username");
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.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
92
        new FieldValueMetaData(TType.STRING)));
93
  }});
94
 
95
  static {
96
    FieldMetaData.addStructMetaDataMap(StatisticsUser.class, metaDataMap);
97
  }
98
 
99
  public StatisticsUser() {
100
  }
101
 
102
  public StatisticsUser(
103
    String username)
104
  {
105
    this();
106
    this.username = username;
107
  }
108
 
109
  /**
110
   * Performs a deep copy on <i>other</i>.
111
   */
112
  public StatisticsUser(StatisticsUser other) {
113
    if (other.isSetUsername()) {
114
      this.username = other.username;
115
    }
116
  }
117
 
118
  public StatisticsUser deepCopy() {
119
    return new StatisticsUser(this);
120
  }
121
 
122
  @Deprecated
123
  public StatisticsUser clone() {
124
    return new StatisticsUser(this);
125
  }
126
 
127
  public String getUsername() {
128
    return this.username;
129
  }
130
 
131
  public StatisticsUser setUsername(String username) {
132
    this.username = username;
133
    return this;
134
  }
135
 
136
  public void unsetUsername() {
137
    this.username = null;
138
  }
139
 
140
  /** Returns true if field username is set (has been asigned a value) and false otherwise */
141
  public boolean isSetUsername() {
142
    return this.username != null;
143
  }
144
 
145
  public void setUsernameIsSet(boolean value) {
146
    if (!value) {
147
      this.username = null;
148
    }
149
  }
150
 
151
  public void setFieldValue(_Fields field, Object value) {
152
    switch (field) {
153
    case USERNAME:
154
      if (value == null) {
155
        unsetUsername();
156
      } else {
157
        setUsername((String)value);
158
      }
159
      break;
160
 
161
    }
162
  }
163
 
164
  public void setFieldValue(int fieldID, Object value) {
165
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
166
  }
167
 
168
  public Object getFieldValue(_Fields field) {
169
    switch (field) {
170
    case USERNAME:
171
      return getUsername();
172
 
173
    }
174
    throw new IllegalStateException();
175
  }
176
 
177
  public Object getFieldValue(int fieldId) {
178
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
179
  }
180
 
181
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
182
  public boolean isSet(_Fields field) {
183
    switch (field) {
184
    case USERNAME:
185
      return isSetUsername();
186
    }
187
    throw new IllegalStateException();
188
  }
189
 
190
  public boolean isSet(int fieldID) {
191
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
192
  }
193
 
194
  @Override
195
  public boolean equals(Object that) {
196
    if (that == null)
197
      return false;
198
    if (that instanceof StatisticsUser)
199
      return this.equals((StatisticsUser)that);
200
    return false;
201
  }
202
 
203
  public boolean equals(StatisticsUser that) {
204
    if (that == null)
205
      return false;
206
 
207
    boolean this_present_username = true && this.isSetUsername();
208
    boolean that_present_username = true && that.isSetUsername();
209
    if (this_present_username || that_present_username) {
210
      if (!(this_present_username && that_present_username))
211
        return false;
212
      if (!this.username.equals(that.username))
213
        return false;
214
    }
215
 
216
    return true;
217
  }
218
 
219
  @Override
220
  public int hashCode() {
221
    return 0;
222
  }
223
 
224
  public int compareTo(StatisticsUser other) {
225
    if (!getClass().equals(other.getClass())) {
226
      return getClass().getName().compareTo(other.getClass().getName());
227
    }
228
 
229
    int lastComparison = 0;
230
    StatisticsUser typedOther = (StatisticsUser)other;
231
 
232
    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(isSetUsername());
233
    if (lastComparison != 0) {
234
      return lastComparison;
235
    }
236
    lastComparison = TBaseHelper.compareTo(username, typedOther.username);
237
    if (lastComparison != 0) {
238
      return lastComparison;
239
    }
240
    return 0;
241
  }
242
 
243
  public void read(TProtocol iprot) throws TException {
244
    TField field;
245
    iprot.readStructBegin();
246
    while (true)
247
    {
248
      field = iprot.readFieldBegin();
249
      if (field.type == TType.STOP) { 
250
        break;
251
      }
252
      _Fields fieldId = _Fields.findByThriftId(field.id);
253
      if (fieldId == null) {
254
        TProtocolUtil.skip(iprot, field.type);
255
      } else {
256
        switch (fieldId) {
257
          case USERNAME:
258
            if (field.type == TType.STRING) {
259
              this.username = iprot.readString();
260
            } else { 
261
              TProtocolUtil.skip(iprot, field.type);
262
            }
263
            break;
264
        }
265
        iprot.readFieldEnd();
266
      }
267
    }
268
    iprot.readStructEnd();
269
    validate();
270
  }
271
 
272
  public void write(TProtocol oprot) throws TException {
273
    validate();
274
 
275
    oprot.writeStructBegin(STRUCT_DESC);
276
    if (this.username != null) {
277
      oprot.writeFieldBegin(USERNAME_FIELD_DESC);
278
      oprot.writeString(this.username);
279
      oprot.writeFieldEnd();
280
    }
281
    oprot.writeFieldStop();
282
    oprot.writeStructEnd();
283
  }
284
 
285
  @Override
286
  public String toString() {
287
    StringBuilder sb = new StringBuilder("StatisticsUser(");
288
    boolean first = true;
289
 
290
    sb.append("username:");
291
    if (this.username == null) {
292
      sb.append("null");
293
    } else {
294
      sb.append(this.username);
295
    }
296
    first = false;
297
    sb.append(")");
298
    return sb.toString();
299
  }
300
 
301
  public void validate() throws TException {
302
    // check for required fields
303
  }
304
 
305
}
306