Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 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.order;
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 ShipmentInfo implements TBase<ShipmentInfo._Fields>, java.io.Serializable, Cloneable {
27
  private static final TStruct STRUCT_DESC = new TStruct("ShipmentInfo");
28
 
29
  private static final TField SHIPMENTS_FIELD_DESC = new TField("shipments", TType.LIST, (short)1);
30
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)2);
31
 
32
  private List<Shipment> shipments;
33
  private long id;
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
    SHIPMENTS((short)1, "shipments"),
38
    ID((short)2, "id");
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 __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.SHIPMENTS, new FieldMetaData("shipments", TFieldRequirementType.DEFAULT, 
97
        new ListMetaData(TType.LIST, 
98
            new StructMetaData(TType.STRUCT, Shipment.class))));
99
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
100
        new FieldValueMetaData(TType.I64)));
101
  }});
102
 
103
  static {
104
    FieldMetaData.addStructMetaDataMap(ShipmentInfo.class, metaDataMap);
105
  }
106
 
107
  public ShipmentInfo() {
108
  }
109
 
110
  public ShipmentInfo(
111
    List<Shipment> shipments,
112
    long id)
113
  {
114
    this();
115
    this.shipments = shipments;
116
    this.id = id;
117
    setIdIsSet(true);
118
  }
119
 
120
  /**
121
   * Performs a deep copy on <i>other</i>.
122
   */
123
  public ShipmentInfo(ShipmentInfo other) {
124
    __isset_bit_vector.clear();
125
    __isset_bit_vector.or(other.__isset_bit_vector);
126
    if (other.isSetShipments()) {
127
      List<Shipment> __this__shipments = new ArrayList<Shipment>();
128
      for (Shipment other_element : other.shipments) {
129
        __this__shipments.add(new Shipment(other_element));
130
      }
131
      this.shipments = __this__shipments;
132
    }
133
    this.id = other.id;
134
  }
135
 
136
  public ShipmentInfo deepCopy() {
137
    return new ShipmentInfo(this);
138
  }
139
 
140
  @Deprecated
141
  public ShipmentInfo clone() {
142
    return new ShipmentInfo(this);
143
  }
144
 
145
  public int getShipmentsSize() {
146
    return (this.shipments == null) ? 0 : this.shipments.size();
147
  }
148
 
149
  public java.util.Iterator<Shipment> getShipmentsIterator() {
150
    return (this.shipments == null) ? null : this.shipments.iterator();
151
  }
152
 
153
  public void addToShipments(Shipment elem) {
154
    if (this.shipments == null) {
155
      this.shipments = new ArrayList<Shipment>();
156
    }
157
    this.shipments.add(elem);
158
  }
159
 
160
  public List<Shipment> getShipments() {
161
    return this.shipments;
162
  }
163
 
164
  public ShipmentInfo setShipments(List<Shipment> shipments) {
165
    this.shipments = shipments;
166
    return this;
167
  }
168
 
169
  public void unsetShipments() {
170
    this.shipments = null;
171
  }
172
 
173
  /** Returns true if field shipments is set (has been asigned a value) and false otherwise */
174
  public boolean isSetShipments() {
175
    return this.shipments != null;
176
  }
177
 
178
  public void setShipmentsIsSet(boolean value) {
179
    if (!value) {
180
      this.shipments = null;
181
    }
182
  }
183
 
184
  public long getId() {
185
    return this.id;
186
  }
187
 
188
  public ShipmentInfo setId(long id) {
189
    this.id = id;
190
    setIdIsSet(true);
191
    return this;
192
  }
193
 
194
  public void unsetId() {
195
    __isset_bit_vector.clear(__ID_ISSET_ID);
196
  }
197
 
198
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
199
  public boolean isSetId() {
200
    return __isset_bit_vector.get(__ID_ISSET_ID);
201
  }
202
 
203
  public void setIdIsSet(boolean value) {
204
    __isset_bit_vector.set(__ID_ISSET_ID, value);
205
  }
206
 
207
  public void setFieldValue(_Fields field, Object value) {
208
    switch (field) {
209
    case SHIPMENTS:
210
      if (value == null) {
211
        unsetShipments();
212
      } else {
213
        setShipments((List<Shipment>)value);
214
      }
215
      break;
216
 
217
    case ID:
218
      if (value == null) {
219
        unsetId();
220
      } else {
221
        setId((Long)value);
222
      }
223
      break;
224
 
225
    }
226
  }
227
 
228
  public void setFieldValue(int fieldID, Object value) {
229
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
230
  }
231
 
232
  public Object getFieldValue(_Fields field) {
233
    switch (field) {
234
    case SHIPMENTS:
235
      return getShipments();
236
 
237
    case ID:
238
      return new Long(getId());
239
 
240
    }
241
    throw new IllegalStateException();
242
  }
243
 
244
  public Object getFieldValue(int fieldId) {
245
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
246
  }
247
 
248
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
249
  public boolean isSet(_Fields field) {
250
    switch (field) {
251
    case SHIPMENTS:
252
      return isSetShipments();
253
    case ID:
254
      return isSetId();
255
    }
256
    throw new IllegalStateException();
257
  }
258
 
259
  public boolean isSet(int fieldID) {
260
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
261
  }
262
 
263
  @Override
264
  public boolean equals(Object that) {
265
    if (that == null)
266
      return false;
267
    if (that instanceof ShipmentInfo)
268
      return this.equals((ShipmentInfo)that);
269
    return false;
270
  }
271
 
272
  public boolean equals(ShipmentInfo that) {
273
    if (that == null)
274
      return false;
275
 
276
    boolean this_present_shipments = true && this.isSetShipments();
277
    boolean that_present_shipments = true && that.isSetShipments();
278
    if (this_present_shipments || that_present_shipments) {
279
      if (!(this_present_shipments && that_present_shipments))
280
        return false;
281
      if (!this.shipments.equals(that.shipments))
282
        return false;
283
    }
284
 
285
    boolean this_present_id = true;
286
    boolean that_present_id = true;
287
    if (this_present_id || that_present_id) {
288
      if (!(this_present_id && that_present_id))
289
        return false;
290
      if (this.id != that.id)
291
        return false;
292
    }
293
 
294
    return true;
295
  }
296
 
297
  @Override
298
  public int hashCode() {
299
    return 0;
300
  }
301
 
302
  public void read(TProtocol iprot) throws TException {
303
    TField field;
304
    iprot.readStructBegin();
305
    while (true)
306
    {
307
      field = iprot.readFieldBegin();
308
      if (field.type == TType.STOP) { 
309
        break;
310
      }
311
      _Fields fieldId = _Fields.findByThriftId(field.id);
312
      if (fieldId == null) {
313
        TProtocolUtil.skip(iprot, field.type);
314
      } else {
315
        switch (fieldId) {
316
          case SHIPMENTS:
317
            if (field.type == TType.LIST) {
318
              {
132 ashish 319
                TList _list21 = iprot.readListBegin();
320
                this.shipments = new ArrayList<Shipment>(_list21.size);
321
                for (int _i22 = 0; _i22 < _list21.size; ++_i22)
68 ashish 322
                {
132 ashish 323
                  Shipment _elem23;
324
                  _elem23 = new Shipment();
325
                  _elem23.read(iprot);
326
                  this.shipments.add(_elem23);
68 ashish 327
                }
328
                iprot.readListEnd();
329
              }
330
            } else { 
331
              TProtocolUtil.skip(iprot, field.type);
332
            }
333
            break;
334
          case ID:
335
            if (field.type == TType.I64) {
336
              this.id = iprot.readI64();
337
              setIdIsSet(true);
338
            } else { 
339
              TProtocolUtil.skip(iprot, field.type);
340
            }
341
            break;
342
        }
343
        iprot.readFieldEnd();
344
      }
345
    }
346
    iprot.readStructEnd();
347
    validate();
348
  }
349
 
350
  public void write(TProtocol oprot) throws TException {
351
    validate();
352
 
353
    oprot.writeStructBegin(STRUCT_DESC);
354
    if (this.shipments != null) {
355
      oprot.writeFieldBegin(SHIPMENTS_FIELD_DESC);
356
      {
357
        oprot.writeListBegin(new TList(TType.STRUCT, this.shipments.size()));
132 ashish 358
        for (Shipment _iter24 : this.shipments)
68 ashish 359
        {
132 ashish 360
          _iter24.write(oprot);
68 ashish 361
        }
362
        oprot.writeListEnd();
363
      }
364
      oprot.writeFieldEnd();
365
    }
366
    oprot.writeFieldBegin(ID_FIELD_DESC);
367
    oprot.writeI64(this.id);
368
    oprot.writeFieldEnd();
369
    oprot.writeFieldStop();
370
    oprot.writeStructEnd();
371
  }
372
 
373
  @Override
374
  public String toString() {
375
    StringBuilder sb = new StringBuilder("ShipmentInfo(");
376
    boolean first = true;
377
 
378
    sb.append("shipments:");
379
    if (this.shipments == null) {
380
      sb.append("null");
381
    } else {
382
      sb.append(this.shipments);
383
    }
384
    first = false;
385
    if (!first) sb.append(", ");
386
    sb.append("id:");
387
    sb.append(this.id);
388
    first = false;
389
    sb.append(")");
390
    return sb.toString();
391
  }
392
 
393
  public void validate() throws TException {
394
    // check for required fields
395
  }
396
 
397
}
398