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