| 116 |
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.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.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 |
* Helper service
|
|
|
28 |
* created by @ashish
|
|
|
29 |
* *
|
|
|
30 |
*/
|
|
|
31 |
public class ItemLogistics implements TBase<ItemLogistics._Fields>, java.io.Serializable, Cloneable, Comparable<ItemLogistics> {
|
|
|
32 |
private static final TStruct STRUCT_DESC = new TStruct("ItemLogistics");
|
|
|
33 |
|
|
|
34 |
private static final TField WAREHOUSE_ID_FIELD_DESC = new TField("warehouseId", TType.I64, (short)1);
|
|
|
35 |
private static final TField AVAILABILITY_FIELD_DESC = new TField("availability", TType.I64, (short)2);
|
|
|
36 |
private static final TField DELIVERY_BY_FIELD_DESC = new TField("deliveryBy", TType.I64, (short)3);
|
|
|
37 |
|
|
|
38 |
private long warehouseId;
|
|
|
39 |
private long availability;
|
|
|
40 |
private long deliveryBy;
|
|
|
41 |
|
|
|
42 |
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
|
|
43 |
public enum _Fields implements TFieldIdEnum {
|
|
|
44 |
WAREHOUSE_ID((short)1, "warehouseId"),
|
|
|
45 |
AVAILABILITY((short)2, "availability"),
|
|
|
46 |
DELIVERY_BY((short)3, "deliveryBy");
|
|
|
47 |
|
|
|
48 |
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
|
|
49 |
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
|
|
50 |
|
|
|
51 |
static {
|
|
|
52 |
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
|
|
53 |
byId.put((int)field._thriftId, field);
|
|
|
54 |
byName.put(field.getFieldName(), field);
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
/**
|
|
|
59 |
* Find the _Fields constant that matches fieldId, or null if its not found.
|
|
|
60 |
*/
|
|
|
61 |
public static _Fields findByThriftId(int fieldId) {
|
|
|
62 |
return byId.get(fieldId);
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Find the _Fields constant that matches fieldId, throwing an exception
|
|
|
67 |
* if it is not found.
|
|
|
68 |
*/
|
|
|
69 |
public static _Fields findByThriftIdOrThrow(int fieldId) {
|
|
|
70 |
_Fields fields = findByThriftId(fieldId);
|
|
|
71 |
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
|
|
|
72 |
return fields;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Find the _Fields constant that matches name, or null if its not found.
|
|
|
77 |
*/
|
|
|
78 |
public static _Fields findByName(String name) {
|
|
|
79 |
return byName.get(name);
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
private final short _thriftId;
|
|
|
83 |
private final String _fieldName;
|
|
|
84 |
|
|
|
85 |
_Fields(short thriftId, String fieldName) {
|
|
|
86 |
_thriftId = thriftId;
|
|
|
87 |
_fieldName = fieldName;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public short getThriftFieldId() {
|
|
|
91 |
return _thriftId;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public String getFieldName() {
|
|
|
95 |
return _fieldName;
|
|
|
96 |
}
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
// isset id assignments
|
|
|
100 |
private static final int __WAREHOUSEID_ISSET_ID = 0;
|
|
|
101 |
private static final int __AVAILABILITY_ISSET_ID = 1;
|
|
|
102 |
private static final int __DELIVERYBY_ISSET_ID = 2;
|
|
|
103 |
private BitSet __isset_bit_vector = new BitSet(3);
|
|
|
104 |
|
|
|
105 |
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
|
|
106 |
put(_Fields.WAREHOUSE_ID, new FieldMetaData("warehouseId", TFieldRequirementType.DEFAULT,
|
|
|
107 |
new FieldValueMetaData(TType.I64)));
|
|
|
108 |
put(_Fields.AVAILABILITY, new FieldMetaData("availability", TFieldRequirementType.DEFAULT,
|
|
|
109 |
new FieldValueMetaData(TType.I64)));
|
|
|
110 |
put(_Fields.DELIVERY_BY, new FieldMetaData("deliveryBy", TFieldRequirementType.DEFAULT,
|
|
|
111 |
new FieldValueMetaData(TType.I64)));
|
|
|
112 |
}});
|
|
|
113 |
|
|
|
114 |
static {
|
|
|
115 |
FieldMetaData.addStructMetaDataMap(ItemLogistics.class, metaDataMap);
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public ItemLogistics() {
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
public ItemLogistics(
|
|
|
122 |
long warehouseId,
|
|
|
123 |
long availability,
|
|
|
124 |
long deliveryBy)
|
|
|
125 |
{
|
|
|
126 |
this();
|
|
|
127 |
this.warehouseId = warehouseId;
|
|
|
128 |
setWarehouseIdIsSet(true);
|
|
|
129 |
this.availability = availability;
|
|
|
130 |
setAvailabilityIsSet(true);
|
|
|
131 |
this.deliveryBy = deliveryBy;
|
|
|
132 |
setDeliveryByIsSet(true);
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
/**
|
|
|
136 |
* Performs a deep copy on <i>other</i>.
|
|
|
137 |
*/
|
|
|
138 |
public ItemLogistics(ItemLogistics other) {
|
|
|
139 |
__isset_bit_vector.clear();
|
|
|
140 |
__isset_bit_vector.or(other.__isset_bit_vector);
|
|
|
141 |
this.warehouseId = other.warehouseId;
|
|
|
142 |
this.availability = other.availability;
|
|
|
143 |
this.deliveryBy = other.deliveryBy;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
public ItemLogistics deepCopy() {
|
|
|
147 |
return new ItemLogistics(this);
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
@Deprecated
|
|
|
151 |
public ItemLogistics clone() {
|
|
|
152 |
return new ItemLogistics(this);
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
public long getWarehouseId() {
|
|
|
156 |
return this.warehouseId;
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
public ItemLogistics setWarehouseId(long warehouseId) {
|
|
|
160 |
this.warehouseId = warehouseId;
|
|
|
161 |
setWarehouseIdIsSet(true);
|
|
|
162 |
return this;
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
public void unsetWarehouseId() {
|
|
|
166 |
__isset_bit_vector.clear(__WAREHOUSEID_ISSET_ID);
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
/** Returns true if field warehouseId is set (has been asigned a value) and false otherwise */
|
|
|
170 |
public boolean isSetWarehouseId() {
|
|
|
171 |
return __isset_bit_vector.get(__WAREHOUSEID_ISSET_ID);
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
public void setWarehouseIdIsSet(boolean value) {
|
|
|
175 |
__isset_bit_vector.set(__WAREHOUSEID_ISSET_ID, value);
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
public long getAvailability() {
|
|
|
179 |
return this.availability;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
public ItemLogistics setAvailability(long availability) {
|
|
|
183 |
this.availability = availability;
|
|
|
184 |
setAvailabilityIsSet(true);
|
|
|
185 |
return this;
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
public void unsetAvailability() {
|
|
|
189 |
__isset_bit_vector.clear(__AVAILABILITY_ISSET_ID);
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
/** Returns true if field availability is set (has been asigned a value) and false otherwise */
|
|
|
193 |
public boolean isSetAvailability() {
|
|
|
194 |
return __isset_bit_vector.get(__AVAILABILITY_ISSET_ID);
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
public void setAvailabilityIsSet(boolean value) {
|
|
|
198 |
__isset_bit_vector.set(__AVAILABILITY_ISSET_ID, value);
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
public long getDeliveryBy() {
|
|
|
202 |
return this.deliveryBy;
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
public ItemLogistics setDeliveryBy(long deliveryBy) {
|
|
|
206 |
this.deliveryBy = deliveryBy;
|
|
|
207 |
setDeliveryByIsSet(true);
|
|
|
208 |
return this;
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
public void unsetDeliveryBy() {
|
|
|
212 |
__isset_bit_vector.clear(__DELIVERYBY_ISSET_ID);
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
/** Returns true if field deliveryBy is set (has been asigned a value) and false otherwise */
|
|
|
216 |
public boolean isSetDeliveryBy() {
|
|
|
217 |
return __isset_bit_vector.get(__DELIVERYBY_ISSET_ID);
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
public void setDeliveryByIsSet(boolean value) {
|
|
|
221 |
__isset_bit_vector.set(__DELIVERYBY_ISSET_ID, value);
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
public void setFieldValue(_Fields field, Object value) {
|
|
|
225 |
switch (field) {
|
|
|
226 |
case WAREHOUSE_ID:
|
|
|
227 |
if (value == null) {
|
|
|
228 |
unsetWarehouseId();
|
|
|
229 |
} else {
|
|
|
230 |
setWarehouseId((Long)value);
|
|
|
231 |
}
|
|
|
232 |
break;
|
|
|
233 |
|
|
|
234 |
case AVAILABILITY:
|
|
|
235 |
if (value == null) {
|
|
|
236 |
unsetAvailability();
|
|
|
237 |
} else {
|
|
|
238 |
setAvailability((Long)value);
|
|
|
239 |
}
|
|
|
240 |
break;
|
|
|
241 |
|
|
|
242 |
case DELIVERY_BY:
|
|
|
243 |
if (value == null) {
|
|
|
244 |
unsetDeliveryBy();
|
|
|
245 |
} else {
|
|
|
246 |
setDeliveryBy((Long)value);
|
|
|
247 |
}
|
|
|
248 |
break;
|
|
|
249 |
|
|
|
250 |
}
|
|
|
251 |
}
|
|
|
252 |
|
|
|
253 |
public void setFieldValue(int fieldID, Object value) {
|
|
|
254 |
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
public Object getFieldValue(_Fields field) {
|
|
|
258 |
switch (field) {
|
|
|
259 |
case WAREHOUSE_ID:
|
|
|
260 |
return new Long(getWarehouseId());
|
|
|
261 |
|
|
|
262 |
case AVAILABILITY:
|
|
|
263 |
return new Long(getAvailability());
|
|
|
264 |
|
|
|
265 |
case DELIVERY_BY:
|
|
|
266 |
return new Long(getDeliveryBy());
|
|
|
267 |
|
|
|
268 |
}
|
|
|
269 |
throw new IllegalStateException();
|
|
|
270 |
}
|
|
|
271 |
|
|
|
272 |
public Object getFieldValue(int fieldId) {
|
|
|
273 |
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
|
|
277 |
public boolean isSet(_Fields field) {
|
|
|
278 |
switch (field) {
|
|
|
279 |
case WAREHOUSE_ID:
|
|
|
280 |
return isSetWarehouseId();
|
|
|
281 |
case AVAILABILITY:
|
|
|
282 |
return isSetAvailability();
|
|
|
283 |
case DELIVERY_BY:
|
|
|
284 |
return isSetDeliveryBy();
|
|
|
285 |
}
|
|
|
286 |
throw new IllegalStateException();
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
public boolean isSet(int fieldID) {
|
|
|
290 |
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
@Override
|
|
|
294 |
public boolean equals(Object that) {
|
|
|
295 |
if (that == null)
|
|
|
296 |
return false;
|
|
|
297 |
if (that instanceof ItemLogistics)
|
|
|
298 |
return this.equals((ItemLogistics)that);
|
|
|
299 |
return false;
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
public boolean equals(ItemLogistics that) {
|
|
|
303 |
if (that == null)
|
|
|
304 |
return false;
|
|
|
305 |
|
|
|
306 |
boolean this_present_warehouseId = true;
|
|
|
307 |
boolean that_present_warehouseId = true;
|
|
|
308 |
if (this_present_warehouseId || that_present_warehouseId) {
|
|
|
309 |
if (!(this_present_warehouseId && that_present_warehouseId))
|
|
|
310 |
return false;
|
|
|
311 |
if (this.warehouseId != that.warehouseId)
|
|
|
312 |
return false;
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
boolean this_present_availability = true;
|
|
|
316 |
boolean that_present_availability = true;
|
|
|
317 |
if (this_present_availability || that_present_availability) {
|
|
|
318 |
if (!(this_present_availability && that_present_availability))
|
|
|
319 |
return false;
|
|
|
320 |
if (this.availability != that.availability)
|
|
|
321 |
return false;
|
|
|
322 |
}
|
|
|
323 |
|
|
|
324 |
boolean this_present_deliveryBy = true;
|
|
|
325 |
boolean that_present_deliveryBy = true;
|
|
|
326 |
if (this_present_deliveryBy || that_present_deliveryBy) {
|
|
|
327 |
if (!(this_present_deliveryBy && that_present_deliveryBy))
|
|
|
328 |
return false;
|
|
|
329 |
if (this.deliveryBy != that.deliveryBy)
|
|
|
330 |
return false;
|
|
|
331 |
}
|
|
|
332 |
|
|
|
333 |
return true;
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
@Override
|
|
|
337 |
public int hashCode() {
|
|
|
338 |
return 0;
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
public int compareTo(ItemLogistics other) {
|
|
|
342 |
if (!getClass().equals(other.getClass())) {
|
|
|
343 |
return getClass().getName().compareTo(other.getClass().getName());
|
|
|
344 |
}
|
|
|
345 |
|
|
|
346 |
int lastComparison = 0;
|
|
|
347 |
ItemLogistics typedOther = (ItemLogistics)other;
|
|
|
348 |
|
|
|
349 |
lastComparison = Boolean.valueOf(isSetWarehouseId()).compareTo(isSetWarehouseId());
|
|
|
350 |
if (lastComparison != 0) {
|
|
|
351 |
return lastComparison;
|
|
|
352 |
}
|
|
|
353 |
lastComparison = TBaseHelper.compareTo(warehouseId, typedOther.warehouseId);
|
|
|
354 |
if (lastComparison != 0) {
|
|
|
355 |
return lastComparison;
|
|
|
356 |
}
|
|
|
357 |
lastComparison = Boolean.valueOf(isSetAvailability()).compareTo(isSetAvailability());
|
|
|
358 |
if (lastComparison != 0) {
|
|
|
359 |
return lastComparison;
|
|
|
360 |
}
|
|
|
361 |
lastComparison = TBaseHelper.compareTo(availability, typedOther.availability);
|
|
|
362 |
if (lastComparison != 0) {
|
|
|
363 |
return lastComparison;
|
|
|
364 |
}
|
|
|
365 |
lastComparison = Boolean.valueOf(isSetDeliveryBy()).compareTo(isSetDeliveryBy());
|
|
|
366 |
if (lastComparison != 0) {
|
|
|
367 |
return lastComparison;
|
|
|
368 |
}
|
|
|
369 |
lastComparison = TBaseHelper.compareTo(deliveryBy, typedOther.deliveryBy);
|
|
|
370 |
if (lastComparison != 0) {
|
|
|
371 |
return lastComparison;
|
|
|
372 |
}
|
|
|
373 |
return 0;
|
|
|
374 |
}
|
|
|
375 |
|
|
|
376 |
public void read(TProtocol iprot) throws TException {
|
|
|
377 |
TField field;
|
|
|
378 |
iprot.readStructBegin();
|
|
|
379 |
while (true)
|
|
|
380 |
{
|
|
|
381 |
field = iprot.readFieldBegin();
|
|
|
382 |
if (field.type == TType.STOP) {
|
|
|
383 |
break;
|
|
|
384 |
}
|
|
|
385 |
_Fields fieldId = _Fields.findByThriftId(field.id);
|
|
|
386 |
if (fieldId == null) {
|
|
|
387 |
TProtocolUtil.skip(iprot, field.type);
|
|
|
388 |
} else {
|
|
|
389 |
switch (fieldId) {
|
|
|
390 |
case WAREHOUSE_ID:
|
|
|
391 |
if (field.type == TType.I64) {
|
|
|
392 |
this.warehouseId = iprot.readI64();
|
|
|
393 |
setWarehouseIdIsSet(true);
|
|
|
394 |
} else {
|
|
|
395 |
TProtocolUtil.skip(iprot, field.type);
|
|
|
396 |
}
|
|
|
397 |
break;
|
|
|
398 |
case AVAILABILITY:
|
|
|
399 |
if (field.type == TType.I64) {
|
|
|
400 |
this.availability = iprot.readI64();
|
|
|
401 |
setAvailabilityIsSet(true);
|
|
|
402 |
} else {
|
|
|
403 |
TProtocolUtil.skip(iprot, field.type);
|
|
|
404 |
}
|
|
|
405 |
break;
|
|
|
406 |
case DELIVERY_BY:
|
|
|
407 |
if (field.type == TType.I64) {
|
|
|
408 |
this.deliveryBy = iprot.readI64();
|
|
|
409 |
setDeliveryByIsSet(true);
|
|
|
410 |
} else {
|
|
|
411 |
TProtocolUtil.skip(iprot, field.type);
|
|
|
412 |
}
|
|
|
413 |
break;
|
|
|
414 |
}
|
|
|
415 |
iprot.readFieldEnd();
|
|
|
416 |
}
|
|
|
417 |
}
|
|
|
418 |
iprot.readStructEnd();
|
|
|
419 |
validate();
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
public void write(TProtocol oprot) throws TException {
|
|
|
423 |
validate();
|
|
|
424 |
|
|
|
425 |
oprot.writeStructBegin(STRUCT_DESC);
|
|
|
426 |
oprot.writeFieldBegin(WAREHOUSE_ID_FIELD_DESC);
|
|
|
427 |
oprot.writeI64(this.warehouseId);
|
|
|
428 |
oprot.writeFieldEnd();
|
|
|
429 |
oprot.writeFieldBegin(AVAILABILITY_FIELD_DESC);
|
|
|
430 |
oprot.writeI64(this.availability);
|
|
|
431 |
oprot.writeFieldEnd();
|
|
|
432 |
oprot.writeFieldBegin(DELIVERY_BY_FIELD_DESC);
|
|
|
433 |
oprot.writeI64(this.deliveryBy);
|
|
|
434 |
oprot.writeFieldEnd();
|
|
|
435 |
oprot.writeFieldStop();
|
|
|
436 |
oprot.writeStructEnd();
|
|
|
437 |
}
|
|
|
438 |
|
|
|
439 |
@Override
|
|
|
440 |
public String toString() {
|
|
|
441 |
StringBuilder sb = new StringBuilder("ItemLogistics(");
|
|
|
442 |
boolean first = true;
|
|
|
443 |
|
|
|
444 |
sb.append("warehouseId:");
|
|
|
445 |
sb.append(this.warehouseId);
|
|
|
446 |
first = false;
|
|
|
447 |
if (!first) sb.append(", ");
|
|
|
448 |
sb.append("availability:");
|
|
|
449 |
sb.append(this.availability);
|
|
|
450 |
first = false;
|
|
|
451 |
if (!first) sb.append(", ");
|
|
|
452 |
sb.append("deliveryBy:");
|
|
|
453 |
sb.append(this.deliveryBy);
|
|
|
454 |
first = false;
|
|
|
455 |
sb.append(")");
|
|
|
456 |
return sb.toString();
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
public void validate() throws TException {
|
|
|
460 |
// check for required fields
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
}
|
|
|
464 |
|