Guest User

Untitled

a guest
Jan 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.52 KB | None | 0 0
  1. /**
  2. * Autogenerated by Thrift
  3. *
  4. * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5. */
  6. package flipkart.platform.queueinterface;
  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 Item implements org.apache.thrift.TBase<Item, Item._Fields>, java.io.Serializable, Cloneable {
  24. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Item");
  25.  
  26. private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.STRING, (short)1);
  27. private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)2);
  28. private static final org.apache.thrift.protocol.TField CREATION_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTime", org.apache.thrift.protocol.TType.I64, (short)3);
  29. private static final org.apache.thrift.protocol.TField METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("metadata", org.apache.thrift.protocol.TType.STRING, (short)4);
  30. private static final org.apache.thrift.protocol.TField QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("queueName", org.apache.thrift.protocol.TType.STRING, (short)5);
  31.  
  32. public String itemId;
  33. public String data;
  34. public long creationTime;
  35. public String metadata;
  36. public String queueName;
  37.  
  38. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  39. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  40. ITEM_ID((short)1, "itemId"),
  41. DATA((short)2, "data"),
  42. CREATION_TIME((short)3, "creationTime"),
  43. METADATA((short)4, "metadata"),
  44. QUEUE_NAME((short)5, "queueName");
  45.  
  46. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  47.  
  48. static {
  49. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  50. byName.put(field.getFieldName(), field);
  51. }
  52. }
  53.  
  54. /**
  55. * Find the _Fields constant that matches fieldId, or null if its not found.
  56. */
  57. public static _Fields findByThriftId(int fieldId) {
  58. switch(fieldId) {
  59. case 1: // ITEM_ID
  60. return ITEM_ID;
  61. case 2: // DATA
  62. return DATA;
  63. case 3: // CREATION_TIME
  64. return CREATION_TIME;
  65. case 4: // METADATA
  66. return METADATA;
  67. case 5: // QUEUE_NAME
  68. return QUEUE_NAME;
  69. default:
  70. return null;
  71. }
  72. }
  73.  
  74. /**
  75. * Find the _Fields constant that matches fieldId, throwing an exception
  76. * if it is not found.
  77. */
  78. public static _Fields findByThriftIdOrThrow(int fieldId) {
  79. _Fields fields = findByThriftId(fieldId);
  80. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  81. return fields;
  82. }
  83.  
  84. /**
  85. * Find the _Fields constant that matches name, or null if its not found.
  86. */
  87. public static _Fields findByName(String name) {
  88. return byName.get(name);
  89. }
  90.  
  91. private final short _thriftId;
  92. private final String _fieldName;
  93.  
  94. _Fields(short thriftId, String fieldName) {
  95. _thriftId = thriftId;
  96. _fieldName = fieldName;
  97. }
  98.  
  99. public short getThriftFieldId() {
  100. return _thriftId;
  101. }
  102.  
  103. public String getFieldName() {
  104. return _fieldName;
  105. }
  106. }
  107.  
  108. // isset id assignments
  109. private static final int __CREATIONTIME_ISSET_ID = 0;
  110. private BitSet __isset_bit_vector = new BitSet(1);
  111.  
  112. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  113. static {
  114. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  115. tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.DEFAULT,
  116. new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
  117. tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
  118. new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
  119. tmpMap.put(_Fields.CREATION_TIME, new org.apache.thrift.meta_data.FieldMetaData("creationTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
  120. new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
  121. tmpMap.put(_Fields.METADATA, new org.apache.thrift.meta_data.FieldMetaData("metadata", org.apache.thrift.TFieldRequirementType.DEFAULT,
  122. new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
  123. tmpMap.put(_Fields.QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("queueName", org.apache.thrift.TFieldRequirementType.DEFAULT,
  124. new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
  125. metaDataMap = Collections.unmodifiableMap(tmpMap);
  126. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Item.class, metaDataMap);
  127. }
  128.  
  129. public Item() {
  130. }
  131.  
  132. public Item(
  133. String itemId,
  134. String data,
  135. long creationTime,
  136. String metadata,
  137. String queueName)
  138. {
  139. this();
  140. this.itemId = itemId;
  141. this.data = data;
  142. this.creationTime = creationTime;
  143. setCreationTimeIsSet(true);
  144. this.metadata = metadata;
  145. this.queueName = queueName;
  146. }
  147.  
  148. /**
  149. * Performs a deep copy on <i>other</i>.
  150. */
  151. public Item(Item other) {
  152. __isset_bit_vector.clear();
  153. __isset_bit_vector.or(other.__isset_bit_vector);
  154. if (other.isSetItemId()) {
  155. this.itemId = other.itemId;
  156. }
  157. if (other.isSetData()) {
  158. this.data = other.data;
  159. }
  160. this.creationTime = other.creationTime;
  161. if (other.isSetMetadata()) {
  162. this.metadata = other.metadata;
  163. }
  164. if (other.isSetQueueName()) {
  165. this.queueName = other.queueName;
  166. }
  167. }
  168.  
  169. public Item deepCopy() {
  170. return new Item(this);
  171. }
  172.  
  173. @Override
  174. public void clear() {
  175. this.itemId = null;
  176. this.data = null;
  177. setCreationTimeIsSet(false);
  178. this.creationTime = 0;
  179. this.metadata = null;
  180. this.queueName = null;
  181. }
  182.  
  183. public String getItemId() {
  184. return this.itemId;
  185. }
  186.  
  187. public Item setItemId(String itemId) {
  188. this.itemId = itemId;
  189. return this;
  190. }
  191.  
  192. public void unsetItemId() {
  193. this.itemId = null;
  194. }
  195.  
  196. /** Returns true if field itemId is set (has been assigned a value) and false otherwise */
  197. public boolean isSetItemId() {
  198. return this.itemId != null;
  199. }
  200.  
  201. public void setItemIdIsSet(boolean value) {
  202. if (!value) {
  203. this.itemId = null;
  204. }
  205. }
  206.  
  207. public String getData() {
  208. return this.data;
  209. }
  210.  
  211. public Item setData(String data) {
  212. this.data = data;
  213. return this;
  214. }
  215.  
  216. public void unsetData() {
  217. this.data = null;
  218. }
  219.  
  220. /** Returns true if field data is set (has been assigned a value) and false otherwise */
  221. public boolean isSetData() {
  222. return this.data != null;
  223. }
  224.  
  225. public void setDataIsSet(boolean value) {
  226. if (!value) {
  227. this.data = null;
  228. }
  229. }
  230.  
  231. public long getCreationTime() {
  232. return this.creationTime;
  233. }
  234.  
  235. public Item setCreationTime(long creationTime) {
  236. this.creationTime = creationTime;
  237. setCreationTimeIsSet(true);
  238. return this;
  239. }
  240.  
  241. public void unsetCreationTime() {
  242. __isset_bit_vector.clear(__CREATIONTIME_ISSET_ID);
  243. }
  244.  
  245. /** Returns true if field creationTime is set (has been assigned a value) and false otherwise */
  246. public boolean isSetCreationTime() {
  247. return __isset_bit_vector.get(__CREATIONTIME_ISSET_ID);
  248. }
  249.  
  250. public void setCreationTimeIsSet(boolean value) {
  251. __isset_bit_vector.set(__CREATIONTIME_ISSET_ID, value);
  252. }
  253.  
  254. public String getMetadata() {
  255. return this.metadata;
  256. }
  257.  
  258. public Item setMetadata(String metadata) {
  259. this.metadata = metadata;
  260. return this;
  261. }
  262.  
  263. public void unsetMetadata() {
  264. this.metadata = null;
  265. }
  266.  
  267. /** Returns true if field metadata is set (has been assigned a value) and false otherwise */
  268. public boolean isSetMetadata() {
  269. return this.metadata != null;
  270. }
  271.  
  272. public void setMetadataIsSet(boolean value) {
  273. if (!value) {
  274. this.metadata = null;
  275. }
  276. }
  277.  
  278. public String getQueueName() {
  279. return this.queueName;
  280. }
  281.  
  282. public Item setQueueName(String queueName) {
  283. this.queueName = queueName;
  284. return this;
  285. }
  286.  
  287. public void unsetQueueName() {
  288. this.queueName = null;
  289. }
  290.  
  291. /** Returns true if field queueName is set (has been assigned a value) and false otherwise */
  292. public boolean isSetQueueName() {
  293. return this.queueName != null;
  294. }
  295.  
  296. public void setQueueNameIsSet(boolean value) {
  297. if (!value) {
  298. this.queueName = null;
  299. }
  300. }
  301.  
  302. public void setFieldValue(_Fields field, Object value) {
  303. switch (field) {
  304. case ITEM_ID:
  305. if (value == null) {
  306. unsetItemId();
  307. } else {
  308. setItemId((String)value);
  309. }
  310. break;
  311.  
  312. case DATA:
  313. if (value == null) {
  314. unsetData();
  315. } else {
  316. setData((String)value);
  317. }
  318. break;
  319.  
  320. case CREATION_TIME:
  321. if (value == null) {
  322. unsetCreationTime();
  323. } else {
  324. setCreationTime((Long)value);
  325. }
  326. break;
  327.  
  328. case METADATA:
  329. if (value == null) {
  330. unsetMetadata();
  331. } else {
  332. setMetadata((String)value);
  333. }
  334. break;
  335.  
  336. case QUEUE_NAME:
  337. if (value == null) {
  338. unsetQueueName();
  339. } else {
  340. setQueueName((String)value);
  341. }
  342. break;
  343.  
  344. }
  345. }
  346.  
  347. public Object getFieldValue(_Fields field) {
  348. switch (field) {
  349. case ITEM_ID:
  350. return getItemId();
  351.  
  352. case DATA:
  353. return getData();
  354.  
  355. case CREATION_TIME:
  356. return new Long(getCreationTime());
  357.  
  358. case METADATA:
  359. return getMetadata();
  360.  
  361. case QUEUE_NAME:
  362. return getQueueName();
  363.  
  364. }
  365. throw new IllegalStateException();
  366. }
  367.  
  368. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  369. public boolean isSet(_Fields field) {
  370. if (field == null) {
  371. throw new IllegalArgumentException();
  372. }
  373.  
  374. switch (field) {
  375. case ITEM_ID:
  376. return isSetItemId();
  377. case DATA:
  378. return isSetData();
  379. case CREATION_TIME:
  380. return isSetCreationTime();
  381. case METADATA:
  382. return isSetMetadata();
  383. case QUEUE_NAME:
  384. return isSetQueueName();
  385. }
  386. throw new IllegalStateException();
  387. }
  388.  
  389. @Override
  390. public boolean equals(Object that) {
  391. if (that == null)
  392. return false;
  393. if (that instanceof Item)
  394. return this.equals((Item)that);
  395. return false;
  396. }
  397.  
  398. public boolean equals(Item that) {
  399. if (that == null)
  400. return false;
  401.  
  402. boolean this_present_itemId = true && this.isSetItemId();
  403. boolean that_present_itemId = true && that.isSetItemId();
  404. if (this_present_itemId || that_present_itemId) {
  405. if (!(this_present_itemId && that_present_itemId))
  406. return false;
  407. if (!this.itemId.equals(that.itemId))
  408. return false;
  409. }
  410.  
  411. boolean this_present_data = true && this.isSetData();
  412. boolean that_present_data = true && that.isSetData();
  413. if (this_present_data || that_present_data) {
  414. if (!(this_present_data && that_present_data))
  415. return false;
  416. if (!this.data.equals(that.data))
  417. return false;
  418. }
  419.  
  420. boolean this_present_creationTime = true;
  421. boolean that_present_creationTime = true;
  422. if (this_present_creationTime || that_present_creationTime) {
  423. if (!(this_present_creationTime && that_present_creationTime))
  424. return false;
  425. if (this.creationTime != that.creationTime)
  426. return false;
  427. }
  428.  
  429. boolean this_present_metadata = true && this.isSetMetadata();
  430. boolean that_present_metadata = true && that.isSetMetadata();
  431. if (this_present_metadata || that_present_metadata) {
  432. if (!(this_present_metadata && that_present_metadata))
  433. return false;
  434. if (!this.metadata.equals(that.metadata))
  435. return false;
  436. }
  437.  
  438. boolean this_present_queueName = true && this.isSetQueueName();
  439. boolean that_present_queueName = true && that.isSetQueueName();
  440. if (this_present_queueName || that_present_queueName) {
  441. if (!(this_present_queueName && that_present_queueName))
  442. return false;
  443. if (!this.queueName.equals(that.queueName))
  444. return false;
  445. }
  446.  
  447. return true;
  448. }
  449.  
  450. @Override
  451. public int hashCode() {
  452. return 0;
  453. }
  454.  
  455. public int compareTo(Item other) {
  456. if (!getClass().equals(other.getClass())) {
  457. return getClass().getName().compareTo(other.getClass().getName());
  458. }
  459.  
  460. int lastComparison = 0;
  461. Item typedOther = (Item)other;
  462.  
  463. lastComparison = Boolean.valueOf(isSetItemId()).compareTo(typedOther.isSetItemId());
  464. if (lastComparison != 0) {
  465. return lastComparison;
  466. }
  467. if (isSetItemId()) {
  468. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, typedOther.itemId);
  469. if (lastComparison != 0) {
  470. return lastComparison;
  471. }
  472. }
  473. lastComparison = Boolean.valueOf(isSetData()).compareTo(typedOther.isSetData());
  474. if (lastComparison != 0) {
  475. return lastComparison;
  476. }
  477. if (isSetData()) {
  478. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, typedOther.data);
  479. if (lastComparison != 0) {
  480. return lastComparison;
  481. }
  482. }
  483. lastComparison = Boolean.valueOf(isSetCreationTime()).compareTo(typedOther.isSetCreationTime());
  484. if (lastComparison != 0) {
  485. return lastComparison;
  486. }
  487. if (isSetCreationTime()) {
  488. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creationTime, typedOther.creationTime);
  489. if (lastComparison != 0) {
  490. return lastComparison;
  491. }
  492. }
  493. lastComparison = Boolean.valueOf(isSetMetadata()).compareTo(typedOther.isSetMetadata());
  494. if (lastComparison != 0) {
  495. return lastComparison;
  496. }
  497. if (isSetMetadata()) {
  498. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metadata, typedOther.metadata);
  499. if (lastComparison != 0) {
  500. return lastComparison;
  501. }
  502. }
  503. lastComparison = Boolean.valueOf(isSetQueueName()).compareTo(typedOther.isSetQueueName());
  504. if (lastComparison != 0) {
  505. return lastComparison;
  506. }
  507. if (isSetQueueName()) {
  508. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueName, typedOther.queueName);
  509. if (lastComparison != 0) {
  510. return lastComparison;
  511. }
  512. }
  513. return 0;
  514. }
  515.  
  516. public _Fields fieldForId(int fieldId) {
  517. return _Fields.findByThriftId(fieldId);
  518. }
  519.  
  520. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  521. org.apache.thrift.protocol.TField field;
  522. iprot.readStructBegin();
  523. while (true)
  524. {
  525. field = iprot.readFieldBegin();
  526. if (field.type == org.apache.thrift.protocol.TType.STOP) {
  527. break;
  528. }
  529. switch (field.id) {
  530. case 1: // ITEM_ID
  531. if (field.type == org.apache.thrift.protocol.TType.STRING) {
  532. this.itemId = iprot.readString();
  533. } else {
  534. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  535. }
  536. break;
  537. case 2: // DATA
  538. if (field.type == org.apache.thrift.protocol.TType.STRING) {
  539. this.data = iprot.readString();
  540. } else {
  541. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  542. }
  543. break;
  544. case 3: // CREATION_TIME
  545. if (field.type == org.apache.thrift.protocol.TType.I64) {
  546. this.creationTime = iprot.readI64();
  547. setCreationTimeIsSet(true);
  548. } else {
  549. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  550. }
  551. break;
  552. case 4: // METADATA
  553. if (field.type == org.apache.thrift.protocol.TType.STRING) {
  554. this.metadata = iprot.readString();
  555. } else {
  556. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  557. }
  558. break;
  559. case 5: // QUEUE_NAME
  560. if (field.type == org.apache.thrift.protocol.TType.STRING) {
  561. this.queueName = iprot.readString();
  562. } else {
  563. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  564. }
  565. break;
  566. default:
  567. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  568. }
  569. iprot.readFieldEnd();
  570. }
  571. iprot.readStructEnd();
  572.  
  573. // check for required fields of primitive type, which can't be checked in the validate method
  574. validate();
  575. }
  576.  
  577. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  578. validate();
  579.  
  580. oprot.writeStructBegin(STRUCT_DESC);
  581. if (this.itemId != null) {
  582. oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
  583. oprot.writeString(this.itemId);
  584. oprot.writeFieldEnd();
  585. }
  586. if (this.data != null) {
  587. oprot.writeFieldBegin(DATA_FIELD_DESC);
  588. oprot.writeString(this.data);
  589. oprot.writeFieldEnd();
  590. }
  591. oprot.writeFieldBegin(CREATION_TIME_FIELD_DESC);
  592. oprot.writeI64(this.creationTime);
  593. oprot.writeFieldEnd();
  594. if (this.metadata != null) {
  595. oprot.writeFieldBegin(METADATA_FIELD_DESC);
  596. oprot.writeString(this.metadata);
  597. oprot.writeFieldEnd();
  598. }
  599. if (this.queueName != null) {
  600. oprot.writeFieldBegin(QUEUE_NAME_FIELD_DESC);
  601. oprot.writeString(this.queueName);
  602. oprot.writeFieldEnd();
  603. }
  604. oprot.writeFieldStop();
  605. oprot.writeStructEnd();
  606. }
  607.  
  608. @Override
  609. public String toString() {
  610. StringBuilder sb = new StringBuilder("Item(");
  611. boolean first = true;
  612.  
  613. sb.append("itemId:");
  614. if (this.itemId == null) {
  615. sb.append("null");
  616. } else {
  617. sb.append(this.itemId);
  618. }
  619. first = false;
  620. if (!first) sb.append(", ");
  621. sb.append("data:");
  622. if (this.data == null) {
  623. sb.append("null");
  624. } else {
  625. sb.append(this.data);
  626. }
  627. first = false;
  628. if (!first) sb.append(", ");
  629. sb.append("creationTime:");
  630. sb.append(this.creationTime);
  631. first = false;
  632. if (!first) sb.append(", ");
  633. sb.append("metadata:");
  634. if (this.metadata == null) {
  635. sb.append("null");
  636. } else {
  637. sb.append(this.metadata);
  638. }
  639. first = false;
  640. if (!first) sb.append(", ");
  641. sb.append("queueName:");
  642. if (this.queueName == null) {
  643. sb.append("null");
  644. } else {
  645. sb.append(this.queueName);
  646. }
  647. first = false;
  648. sb.append(")");
  649. return sb.toString();
  650. }
  651.  
  652. public void validate() throws org.apache.thrift.TException {
  653. // check for required fields
  654. }
  655.  
  656. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  657. try {
  658. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  659. } catch (org.apache.thrift.TException te) {
  660. throw new java.io.IOException(te);
  661. }
  662. }
  663.  
  664. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  665. try {
  666. // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
  667. __isset_bit_vector = new BitSet(1);
  668. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  669. } catch (org.apache.thrift.TException te) {
  670. throw new java.io.IOException(te);
  671. }
  672. }
  673.  
  674. }
Add Comment
Please, Sign In to add comment