Subversion Repositories SmartDukaan

Rev

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

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