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
 * All the social handles
28
 */
29
public class SocialHandles implements TBase<SocialHandles._Fields>, java.io.Serializable, Cloneable, Comparable<SocialHandles> {
30
  private static final TStruct STRUCT_DESC = new TStruct("SocialHandles");
31
 
32
  private static final TField FACEBOOK_FIELD_DESC = new TField("facebook", TType.STRING, (short)1);
33
  private static final TField OPENSOCIAL_FIELD_DESC = new TField("opensocial", TType.STRING, (short)2);
34
  private static final TField TWITTER_FIELD_DESC = new TField("twitter", TType.STRING, (short)3);
35
 
36
  private String facebook;
37
  private String opensocial;
38
  private String twitter;
39
 
40
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
41
  public enum _Fields implements TFieldIdEnum {
42
    FACEBOOK((short)1, "facebook"),
43
    OPENSOCIAL((short)2, "opensocial"),
44
    TWITTER((short)3, "twitter");
45
 
46
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
48
 
49
    static {
50
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
51
        byId.put((int)field._thriftId, field);
52
        byName.put(field.getFieldName(), field);
53
      }
54
    }
55
 
56
    /**
57
     * Find the _Fields constant that matches fieldId, or null if its not found.
58
     */
59
    public static _Fields findByThriftId(int fieldId) {
60
      return byId.get(fieldId);
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
 
99
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
100
    put(_Fields.FACEBOOK, new FieldMetaData("facebook", TFieldRequirementType.DEFAULT, 
101
        new FieldValueMetaData(TType.STRING)));
102
    put(_Fields.OPENSOCIAL, new FieldMetaData("opensocial", TFieldRequirementType.DEFAULT, 
103
        new FieldValueMetaData(TType.STRING)));
104
    put(_Fields.TWITTER, new FieldMetaData("twitter", TFieldRequirementType.DEFAULT, 
105
        new FieldValueMetaData(TType.STRING)));
106
  }});
107
 
108
  static {
109
    FieldMetaData.addStructMetaDataMap(SocialHandles.class, metaDataMap);
110
  }
111
 
112
  public SocialHandles() {
113
  }
114
 
115
  public SocialHandles(
116
    String facebook,
117
    String opensocial,
118
    String twitter)
119
  {
120
    this();
121
    this.facebook = facebook;
122
    this.opensocial = opensocial;
123
    this.twitter = twitter;
124
  }
125
 
126
  /**
127
   * Performs a deep copy on <i>other</i>.
128
   */
129
  public SocialHandles(SocialHandles other) {
130
    if (other.isSetFacebook()) {
131
      this.facebook = other.facebook;
132
    }
133
    if (other.isSetOpensocial()) {
134
      this.opensocial = other.opensocial;
135
    }
136
    if (other.isSetTwitter()) {
137
      this.twitter = other.twitter;
138
    }
139
  }
140
 
141
  public SocialHandles deepCopy() {
142
    return new SocialHandles(this);
143
  }
144
 
145
  @Deprecated
146
  public SocialHandles clone() {
147
    return new SocialHandles(this);
148
  }
149
 
150
  public String getFacebook() {
151
    return this.facebook;
152
  }
153
 
154
  public SocialHandles setFacebook(String facebook) {
155
    this.facebook = facebook;
156
    return this;
157
  }
158
 
159
  public void unsetFacebook() {
160
    this.facebook = null;
161
  }
162
 
163
  /** Returns true if field facebook is set (has been asigned a value) and false otherwise */
164
  public boolean isSetFacebook() {
165
    return this.facebook != null;
166
  }
167
 
168
  public void setFacebookIsSet(boolean value) {
169
    if (!value) {
170
      this.facebook = null;
171
    }
172
  }
173
 
174
  public String getOpensocial() {
175
    return this.opensocial;
176
  }
177
 
178
  public SocialHandles setOpensocial(String opensocial) {
179
    this.opensocial = opensocial;
180
    return this;
181
  }
182
 
183
  public void unsetOpensocial() {
184
    this.opensocial = null;
185
  }
186
 
187
  /** Returns true if field opensocial is set (has been asigned a value) and false otherwise */
188
  public boolean isSetOpensocial() {
189
    return this.opensocial != null;
190
  }
191
 
192
  public void setOpensocialIsSet(boolean value) {
193
    if (!value) {
194
      this.opensocial = null;
195
    }
196
  }
197
 
198
  public String getTwitter() {
199
    return this.twitter;
200
  }
201
 
202
  public SocialHandles setTwitter(String twitter) {
203
    this.twitter = twitter;
204
    return this;
205
  }
206
 
207
  public void unsetTwitter() {
208
    this.twitter = null;
209
  }
210
 
211
  /** Returns true if field twitter is set (has been asigned a value) and false otherwise */
212
  public boolean isSetTwitter() {
213
    return this.twitter != null;
214
  }
215
 
216
  public void setTwitterIsSet(boolean value) {
217
    if (!value) {
218
      this.twitter = null;
219
    }
220
  }
221
 
222
  public void setFieldValue(_Fields field, Object value) {
223
    switch (field) {
224
    case FACEBOOK:
225
      if (value == null) {
226
        unsetFacebook();
227
      } else {
228
        setFacebook((String)value);
229
      }
230
      break;
231
 
232
    case OPENSOCIAL:
233
      if (value == null) {
234
        unsetOpensocial();
235
      } else {
236
        setOpensocial((String)value);
237
      }
238
      break;
239
 
240
    case TWITTER:
241
      if (value == null) {
242
        unsetTwitter();
243
      } else {
244
        setTwitter((String)value);
245
      }
246
      break;
247
 
248
    }
249
  }
250
 
251
  public void setFieldValue(int fieldID, Object value) {
252
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
253
  }
254
 
255
  public Object getFieldValue(_Fields field) {
256
    switch (field) {
257
    case FACEBOOK:
258
      return getFacebook();
259
 
260
    case OPENSOCIAL:
261
      return getOpensocial();
262
 
263
    case TWITTER:
264
      return getTwitter();
265
 
266
    }
267
    throw new IllegalStateException();
268
  }
269
 
270
  public Object getFieldValue(int fieldId) {
271
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
272
  }
273
 
274
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
275
  public boolean isSet(_Fields field) {
276
    switch (field) {
277
    case FACEBOOK:
278
      return isSetFacebook();
279
    case OPENSOCIAL:
280
      return isSetOpensocial();
281
    case TWITTER:
282
      return isSetTwitter();
283
    }
284
    throw new IllegalStateException();
285
  }
286
 
287
  public boolean isSet(int fieldID) {
288
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
289
  }
290
 
291
  @Override
292
  public boolean equals(Object that) {
293
    if (that == null)
294
      return false;
295
    if (that instanceof SocialHandles)
296
      return this.equals((SocialHandles)that);
297
    return false;
298
  }
299
 
300
  public boolean equals(SocialHandles that) {
301
    if (that == null)
302
      return false;
303
 
304
    boolean this_present_facebook = true && this.isSetFacebook();
305
    boolean that_present_facebook = true && that.isSetFacebook();
306
    if (this_present_facebook || that_present_facebook) {
307
      if (!(this_present_facebook && that_present_facebook))
308
        return false;
309
      if (!this.facebook.equals(that.facebook))
310
        return false;
311
    }
312
 
313
    boolean this_present_opensocial = true && this.isSetOpensocial();
314
    boolean that_present_opensocial = true && that.isSetOpensocial();
315
    if (this_present_opensocial || that_present_opensocial) {
316
      if (!(this_present_opensocial && that_present_opensocial))
317
        return false;
318
      if (!this.opensocial.equals(that.opensocial))
319
        return false;
320
    }
321
 
322
    boolean this_present_twitter = true && this.isSetTwitter();
323
    boolean that_present_twitter = true && that.isSetTwitter();
324
    if (this_present_twitter || that_present_twitter) {
325
      if (!(this_present_twitter && that_present_twitter))
326
        return false;
327
      if (!this.twitter.equals(that.twitter))
328
        return false;
329
    }
330
 
331
    return true;
332
  }
333
 
334
  @Override
335
  public int hashCode() {
336
    return 0;
337
  }
338
 
339
  public int compareTo(SocialHandles other) {
340
    if (!getClass().equals(other.getClass())) {
341
      return getClass().getName().compareTo(other.getClass().getName());
342
    }
343
 
344
    int lastComparison = 0;
345
    SocialHandles typedOther = (SocialHandles)other;
346
 
347
    lastComparison = Boolean.valueOf(isSetFacebook()).compareTo(isSetFacebook());
348
    if (lastComparison != 0) {
349
      return lastComparison;
350
    }
351
    lastComparison = TBaseHelper.compareTo(facebook, typedOther.facebook);
352
    if (lastComparison != 0) {
353
      return lastComparison;
354
    }
355
    lastComparison = Boolean.valueOf(isSetOpensocial()).compareTo(isSetOpensocial());
356
    if (lastComparison != 0) {
357
      return lastComparison;
358
    }
359
    lastComparison = TBaseHelper.compareTo(opensocial, typedOther.opensocial);
360
    if (lastComparison != 0) {
361
      return lastComparison;
362
    }
363
    lastComparison = Boolean.valueOf(isSetTwitter()).compareTo(isSetTwitter());
364
    if (lastComparison != 0) {
365
      return lastComparison;
366
    }
367
    lastComparison = TBaseHelper.compareTo(twitter, typedOther.twitter);
368
    if (lastComparison != 0) {
369
      return lastComparison;
370
    }
371
    return 0;
372
  }
373
 
374
  public void read(TProtocol iprot) throws TException {
375
    TField field;
376
    iprot.readStructBegin();
377
    while (true)
378
    {
379
      field = iprot.readFieldBegin();
380
      if (field.type == TType.STOP) { 
381
        break;
382
      }
383
      _Fields fieldId = _Fields.findByThriftId(field.id);
384
      if (fieldId == null) {
385
        TProtocolUtil.skip(iprot, field.type);
386
      } else {
387
        switch (fieldId) {
388
          case FACEBOOK:
389
            if (field.type == TType.STRING) {
390
              this.facebook = iprot.readString();
391
            } else { 
392
              TProtocolUtil.skip(iprot, field.type);
393
            }
394
            break;
395
          case OPENSOCIAL:
396
            if (field.type == TType.STRING) {
397
              this.opensocial = iprot.readString();
398
            } else { 
399
              TProtocolUtil.skip(iprot, field.type);
400
            }
401
            break;
402
          case TWITTER:
403
            if (field.type == TType.STRING) {
404
              this.twitter = iprot.readString();
405
            } else { 
406
              TProtocolUtil.skip(iprot, field.type);
407
            }
408
            break;
409
        }
410
        iprot.readFieldEnd();
411
      }
412
    }
413
    iprot.readStructEnd();
414
    validate();
415
  }
416
 
417
  public void write(TProtocol oprot) throws TException {
418
    validate();
419
 
420
    oprot.writeStructBegin(STRUCT_DESC);
421
    if (this.facebook != null) {
422
      oprot.writeFieldBegin(FACEBOOK_FIELD_DESC);
423
      oprot.writeString(this.facebook);
424
      oprot.writeFieldEnd();
425
    }
426
    if (this.opensocial != null) {
427
      oprot.writeFieldBegin(OPENSOCIAL_FIELD_DESC);
428
      oprot.writeString(this.opensocial);
429
      oprot.writeFieldEnd();
430
    }
431
    if (this.twitter != null) {
432
      oprot.writeFieldBegin(TWITTER_FIELD_DESC);
433
      oprot.writeString(this.twitter);
434
      oprot.writeFieldEnd();
435
    }
436
    oprot.writeFieldStop();
437
    oprot.writeStructEnd();
438
  }
439
 
440
  @Override
441
  public String toString() {
442
    StringBuilder sb = new StringBuilder("SocialHandles(");
443
    boolean first = true;
444
 
445
    sb.append("facebook:");
446
    if (this.facebook == null) {
447
      sb.append("null");
448
    } else {
449
      sb.append(this.facebook);
450
    }
451
    first = false;
452
    if (!first) sb.append(", ");
453
    sb.append("opensocial:");
454
    if (this.opensocial == null) {
455
      sb.append("null");
456
    } else {
457
      sb.append(this.opensocial);
458
    }
459
    first = false;
460
    if (!first) sb.append(", ");
461
    sb.append("twitter:");
462
    if (this.twitter == null) {
463
      sb.append("null");
464
    } else {
465
      sb.append(this.twitter);
466
    }
467
    first = false;
468
    sb.append(")");
469
    return sb.toString();
470
  }
471
 
472
  public void validate() throws TException {
473
    // check for required fields
474
  }
475
 
476
}
477