Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3044 chandransh 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.logistics;
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 ProviderDetails implements TBase<ProviderDetails._Fields>, java.io.Serializable, Cloneable, Comparable<ProviderDetails> {
27
  private static final TStruct STRUCT_DESC = new TStruct("ProviderDetails");
28
 
29
  private static final TField ACCOUNT_NO_FIELD_DESC = new TField("accountNo", TType.STRING, (short)1);
30
  private static final TField EMAIL_FIELD_DESC = new TField("email", TType.STRING, (short)2);
31
 
32
  private String accountNo;
33
  private String email;
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
    ACCOUNT_NO((short)1, "accountNo"),
38
    EMAIL((short)2, "email");
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
 
93
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
94
    put(_Fields.ACCOUNT_NO, new FieldMetaData("accountNo", TFieldRequirementType.DEFAULT, 
95
        new FieldValueMetaData(TType.STRING)));
96
    put(_Fields.EMAIL, new FieldMetaData("email", TFieldRequirementType.DEFAULT, 
97
        new FieldValueMetaData(TType.STRING)));
98
  }});
99
 
100
  static {
101
    FieldMetaData.addStructMetaDataMap(ProviderDetails.class, metaDataMap);
102
  }
103
 
104
  public ProviderDetails() {
105
  }
106
 
107
  public ProviderDetails(
108
    String accountNo,
109
    String email)
110
  {
111
    this();
112
    this.accountNo = accountNo;
113
    this.email = email;
114
  }
115
 
116
  /**
117
   * Performs a deep copy on <i>other</i>.
118
   */
119
  public ProviderDetails(ProviderDetails other) {
120
    if (other.isSetAccountNo()) {
121
      this.accountNo = other.accountNo;
122
    }
123
    if (other.isSetEmail()) {
124
      this.email = other.email;
125
    }
126
  }
127
 
128
  public ProviderDetails deepCopy() {
129
    return new ProviderDetails(this);
130
  }
131
 
132
  @Deprecated
133
  public ProviderDetails clone() {
134
    return new ProviderDetails(this);
135
  }
136
 
137
  public String getAccountNo() {
138
    return this.accountNo;
139
  }
140
 
141
  public ProviderDetails setAccountNo(String accountNo) {
142
    this.accountNo = accountNo;
143
    return this;
144
  }
145
 
146
  public void unsetAccountNo() {
147
    this.accountNo = null;
148
  }
149
 
150
  /** Returns true if field accountNo is set (has been asigned a value) and false otherwise */
151
  public boolean isSetAccountNo() {
152
    return this.accountNo != null;
153
  }
154
 
155
  public void setAccountNoIsSet(boolean value) {
156
    if (!value) {
157
      this.accountNo = null;
158
    }
159
  }
160
 
161
  public String getEmail() {
162
    return this.email;
163
  }
164
 
165
  public ProviderDetails setEmail(String email) {
166
    this.email = email;
167
    return this;
168
  }
169
 
170
  public void unsetEmail() {
171
    this.email = null;
172
  }
173
 
174
  /** Returns true if field email is set (has been asigned a value) and false otherwise */
175
  public boolean isSetEmail() {
176
    return this.email != null;
177
  }
178
 
179
  public void setEmailIsSet(boolean value) {
180
    if (!value) {
181
      this.email = null;
182
    }
183
  }
184
 
185
  public void setFieldValue(_Fields field, Object value) {
186
    switch (field) {
187
    case ACCOUNT_NO:
188
      if (value == null) {
189
        unsetAccountNo();
190
      } else {
191
        setAccountNo((String)value);
192
      }
193
      break;
194
 
195
    case EMAIL:
196
      if (value == null) {
197
        unsetEmail();
198
      } else {
199
        setEmail((String)value);
200
      }
201
      break;
202
 
203
    }
204
  }
205
 
206
  public void setFieldValue(int fieldID, Object value) {
207
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
208
  }
209
 
210
  public Object getFieldValue(_Fields field) {
211
    switch (field) {
212
    case ACCOUNT_NO:
213
      return getAccountNo();
214
 
215
    case EMAIL:
216
      return getEmail();
217
 
218
    }
219
    throw new IllegalStateException();
220
  }
221
 
222
  public Object getFieldValue(int fieldId) {
223
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
224
  }
225
 
226
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
227
  public boolean isSet(_Fields field) {
228
    switch (field) {
229
    case ACCOUNT_NO:
230
      return isSetAccountNo();
231
    case EMAIL:
232
      return isSetEmail();
233
    }
234
    throw new IllegalStateException();
235
  }
236
 
237
  public boolean isSet(int fieldID) {
238
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
239
  }
240
 
241
  @Override
242
  public boolean equals(Object that) {
243
    if (that == null)
244
      return false;
245
    if (that instanceof ProviderDetails)
246
      return this.equals((ProviderDetails)that);
247
    return false;
248
  }
249
 
250
  public boolean equals(ProviderDetails that) {
251
    if (that == null)
252
      return false;
253
 
254
    boolean this_present_accountNo = true && this.isSetAccountNo();
255
    boolean that_present_accountNo = true && that.isSetAccountNo();
256
    if (this_present_accountNo || that_present_accountNo) {
257
      if (!(this_present_accountNo && that_present_accountNo))
258
        return false;
259
      if (!this.accountNo.equals(that.accountNo))
260
        return false;
261
    }
262
 
263
    boolean this_present_email = true && this.isSetEmail();
264
    boolean that_present_email = true && that.isSetEmail();
265
    if (this_present_email || that_present_email) {
266
      if (!(this_present_email && that_present_email))
267
        return false;
268
      if (!this.email.equals(that.email))
269
        return false;
270
    }
271
 
272
    return true;
273
  }
274
 
275
  @Override
276
  public int hashCode() {
277
    return 0;
278
  }
279
 
280
  public int compareTo(ProviderDetails other) {
281
    if (!getClass().equals(other.getClass())) {
282
      return getClass().getName().compareTo(other.getClass().getName());
283
    }
284
 
285
    int lastComparison = 0;
286
    ProviderDetails typedOther = (ProviderDetails)other;
287
 
288
    lastComparison = Boolean.valueOf(isSetAccountNo()).compareTo(isSetAccountNo());
289
    if (lastComparison != 0) {
290
      return lastComparison;
291
    }
292
    lastComparison = TBaseHelper.compareTo(accountNo, typedOther.accountNo);
293
    if (lastComparison != 0) {
294
      return lastComparison;
295
    }
296
    lastComparison = Boolean.valueOf(isSetEmail()).compareTo(isSetEmail());
297
    if (lastComparison != 0) {
298
      return lastComparison;
299
    }
300
    lastComparison = TBaseHelper.compareTo(email, typedOther.email);
301
    if (lastComparison != 0) {
302
      return lastComparison;
303
    }
304
    return 0;
305
  }
306
 
307
  public void read(TProtocol iprot) throws TException {
308
    TField field;
309
    iprot.readStructBegin();
310
    while (true)
311
    {
312
      field = iprot.readFieldBegin();
313
      if (field.type == TType.STOP) { 
314
        break;
315
      }
316
      _Fields fieldId = _Fields.findByThriftId(field.id);
317
      if (fieldId == null) {
318
        TProtocolUtil.skip(iprot, field.type);
319
      } else {
320
        switch (fieldId) {
321
          case ACCOUNT_NO:
322
            if (field.type == TType.STRING) {
323
              this.accountNo = iprot.readString();
324
            } else { 
325
              TProtocolUtil.skip(iprot, field.type);
326
            }
327
            break;
328
          case EMAIL:
329
            if (field.type == TType.STRING) {
330
              this.email = iprot.readString();
331
            } else { 
332
              TProtocolUtil.skip(iprot, field.type);
333
            }
334
            break;
335
        }
336
        iprot.readFieldEnd();
337
      }
338
    }
339
    iprot.readStructEnd();
340
    validate();
341
  }
342
 
343
  public void write(TProtocol oprot) throws TException {
344
    validate();
345
 
346
    oprot.writeStructBegin(STRUCT_DESC);
347
    if (this.accountNo != null) {
348
      oprot.writeFieldBegin(ACCOUNT_NO_FIELD_DESC);
349
      oprot.writeString(this.accountNo);
350
      oprot.writeFieldEnd();
351
    }
352
    if (this.email != null) {
353
      oprot.writeFieldBegin(EMAIL_FIELD_DESC);
354
      oprot.writeString(this.email);
355
      oprot.writeFieldEnd();
356
    }
357
    oprot.writeFieldStop();
358
    oprot.writeStructEnd();
359
  }
360
 
361
  @Override
362
  public String toString() {
363
    StringBuilder sb = new StringBuilder("ProviderDetails(");
364
    boolean first = true;
365
 
366
    sb.append("accountNo:");
367
    if (this.accountNo == null) {
368
      sb.append("null");
369
    } else {
370
      sb.append(this.accountNo);
371
    }
372
    first = false;
373
    if (!first) sb.append(", ");
374
    sb.append("email:");
375
    if (this.email == null) {
376
      sb.append("null");
377
    } else {
378
      sb.append(this.email);
379
    }
380
    first = false;
381
    sb.append(")");
382
    return sb.toString();
383
  }
384
 
385
  public void validate() throws TException {
386
    // check for required fields
387
  }
388
 
389
}
390