PageRenderTime 46ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/hw3/hadoop-thrift-qydeng/hadoop-thrift-qydeng/target/generated-sources/thrift/edu/uchicago/mpcs53013/UserProperty.java

https://gitlab.com/rovero/2016mpcs53013-qydeng
Java | 496 lines | 396 code | 73 blank | 27 comment | 79 complexity | e2599f51a5df3789b583d1995445f739 MD5 | raw file
  1. /**
  2. * Autogenerated by Thrift Compiler (0.9.3)
  3. *
  4. * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5. * @generated
  6. */
  7. package edu.uchicago.mpcs53013;
  8. import org.apache.thrift.scheme.IScheme;
  9. import org.apache.thrift.scheme.SchemeFactory;
  10. import org.apache.thrift.scheme.StandardScheme;
  11. import org.apache.thrift.scheme.TupleScheme;
  12. import org.apache.thrift.protocol.TTupleProtocol;
  13. import org.apache.thrift.protocol.TProtocolException;
  14. import org.apache.thrift.EncodingUtils;
  15. import org.apache.thrift.TException;
  16. import org.apache.thrift.async.AsyncMethodCallback;
  17. import org.apache.thrift.server.AbstractNonblockingServer.*;
  18. import java.util.List;
  19. import java.util.ArrayList;
  20. import java.util.Map;
  21. import java.util.HashMap;
  22. import java.util.EnumMap;
  23. import java.util.Set;
  24. import java.util.HashSet;
  25. import java.util.EnumSet;
  26. import java.util.Collections;
  27. import java.util.BitSet;
  28. import java.nio.ByteBuffer;
  29. import java.util.Arrays;
  30. import javax.annotation.Generated;
  31. import org.slf4j.Logger;
  32. import org.slf4j.LoggerFactory;
  33. @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
  34. @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-19")
  35. public class UserProperty implements org.apache.thrift.TBase<UserProperty, UserProperty._Fields>, java.io.Serializable, Cloneable, Comparable<UserProperty> {
  36. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserProperty");
  37. private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  38. private static final org.apache.thrift.protocol.TField PVAL_FIELD_DESC = new org.apache.thrift.protocol.TField("pval", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  39. private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  40. static {
  41. schemes.put(StandardScheme.class, new UserPropertyStandardSchemeFactory());
  42. schemes.put(TupleScheme.class, new UserPropertyTupleSchemeFactory());
  43. }
  44. public UserID id; // required
  45. public UserPropertyValue pval; // required
  46. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  47. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  48. ID((short)1, "id"),
  49. PVAL((short)2, "pval");
  50. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  51. static {
  52. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  53. byName.put(field.getFieldName(), field);
  54. }
  55. }
  56. /**
  57. * Find the _Fields constant that matches fieldId, or null if its not found.
  58. */
  59. public static _Fields findByThriftId(int fieldId) {
  60. switch(fieldId) {
  61. case 1: // ID
  62. return ID;
  63. case 2: // PVAL
  64. return PVAL;
  65. default:
  66. return null;
  67. }
  68. }
  69. /**
  70. * Find the _Fields constant that matches fieldId, throwing an exception
  71. * if it is not found.
  72. */
  73. public static _Fields findByThriftIdOrThrow(int fieldId) {
  74. _Fields fields = findByThriftId(fieldId);
  75. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  76. return fields;
  77. }
  78. /**
  79. * Find the _Fields constant that matches name, or null if its not found.
  80. */
  81. public static _Fields findByName(String name) {
  82. return byName.get(name);
  83. }
  84. private final short _thriftId;
  85. private final String _fieldName;
  86. _Fields(short thriftId, String fieldName) {
  87. _thriftId = thriftId;
  88. _fieldName = fieldName;
  89. }
  90. public short getThriftFieldId() {
  91. return _thriftId;
  92. }
  93. public String getFieldName() {
  94. return _fieldName;
  95. }
  96. }
  97. // isset id assignments
  98. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  99. static {
  100. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  101. tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED,
  102. new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserID.class)));
  103. tmpMap.put(_Fields.PVAL, new org.apache.thrift.meta_data.FieldMetaData("pval", org.apache.thrift.TFieldRequirementType.REQUIRED,
  104. new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserPropertyValue.class)));
  105. metaDataMap = Collections.unmodifiableMap(tmpMap);
  106. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserProperty.class, metaDataMap);
  107. }
  108. public UserProperty() {
  109. }
  110. public UserProperty(
  111. UserID id,
  112. UserPropertyValue pval)
  113. {
  114. this();
  115. this.id = id;
  116. this.pval = pval;
  117. }
  118. /**
  119. * Performs a deep copy on <i>other</i>.
  120. */
  121. public UserProperty(UserProperty other) {
  122. if (other.isSetId()) {
  123. this.id = new UserID(other.id);
  124. }
  125. if (other.isSetPval()) {
  126. this.pval = new UserPropertyValue(other.pval);
  127. }
  128. }
  129. public UserProperty deepCopy() {
  130. return new UserProperty(this);
  131. }
  132. @Override
  133. public void clear() {
  134. this.id = null;
  135. this.pval = null;
  136. }
  137. public UserID getId() {
  138. return this.id;
  139. }
  140. public UserProperty setId(UserID id) {
  141. this.id = id;
  142. return this;
  143. }
  144. public void unsetId() {
  145. this.id = null;
  146. }
  147. /** Returns true if field id is set (has been assigned a value) and false otherwise */
  148. public boolean isSetId() {
  149. return this.id != null;
  150. }
  151. public void setIdIsSet(boolean value) {
  152. if (!value) {
  153. this.id = null;
  154. }
  155. }
  156. public UserPropertyValue getPval() {
  157. return this.pval;
  158. }
  159. public UserProperty setPval(UserPropertyValue pval) {
  160. this.pval = pval;
  161. return this;
  162. }
  163. public void unsetPval() {
  164. this.pval = null;
  165. }
  166. /** Returns true if field pval is set (has been assigned a value) and false otherwise */
  167. public boolean isSetPval() {
  168. return this.pval != null;
  169. }
  170. public void setPvalIsSet(boolean value) {
  171. if (!value) {
  172. this.pval = null;
  173. }
  174. }
  175. public void setFieldValue(_Fields field, Object value) {
  176. switch (field) {
  177. case ID:
  178. if (value == null) {
  179. unsetId();
  180. } else {
  181. setId((UserID)value);
  182. }
  183. break;
  184. case PVAL:
  185. if (value == null) {
  186. unsetPval();
  187. } else {
  188. setPval((UserPropertyValue)value);
  189. }
  190. break;
  191. }
  192. }
  193. public Object getFieldValue(_Fields field) {
  194. switch (field) {
  195. case ID:
  196. return getId();
  197. case PVAL:
  198. return getPval();
  199. }
  200. throw new IllegalStateException();
  201. }
  202. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  203. public boolean isSet(_Fields field) {
  204. if (field == null) {
  205. throw new IllegalArgumentException();
  206. }
  207. switch (field) {
  208. case ID:
  209. return isSetId();
  210. case PVAL:
  211. return isSetPval();
  212. }
  213. throw new IllegalStateException();
  214. }
  215. @Override
  216. public boolean equals(Object that) {
  217. if (that == null)
  218. return false;
  219. if (that instanceof UserProperty)
  220. return this.equals((UserProperty)that);
  221. return false;
  222. }
  223. public boolean equals(UserProperty that) {
  224. if (that == null)
  225. return false;
  226. boolean this_present_id = true && this.isSetId();
  227. boolean that_present_id = true && that.isSetId();
  228. if (this_present_id || that_present_id) {
  229. if (!(this_present_id && that_present_id))
  230. return false;
  231. if (!this.id.equals(that.id))
  232. return false;
  233. }
  234. boolean this_present_pval = true && this.isSetPval();
  235. boolean that_present_pval = true && that.isSetPval();
  236. if (this_present_pval || that_present_pval) {
  237. if (!(this_present_pval && that_present_pval))
  238. return false;
  239. if (!this.pval.equals(that.pval))
  240. return false;
  241. }
  242. return true;
  243. }
  244. @Override
  245. public int hashCode() {
  246. List<Object> list = new ArrayList<Object>();
  247. boolean present_id = true && (isSetId());
  248. list.add(present_id);
  249. if (present_id)
  250. list.add(id);
  251. boolean present_pval = true && (isSetPval());
  252. list.add(present_pval);
  253. if (present_pval)
  254. list.add(pval);
  255. return list.hashCode();
  256. }
  257. @Override
  258. public int compareTo(UserProperty other) {
  259. if (!getClass().equals(other.getClass())) {
  260. return getClass().getName().compareTo(other.getClass().getName());
  261. }
  262. int lastComparison = 0;
  263. lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
  264. if (lastComparison != 0) {
  265. return lastComparison;
  266. }
  267. if (isSetId()) {
  268. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
  269. if (lastComparison != 0) {
  270. return lastComparison;
  271. }
  272. }
  273. lastComparison = Boolean.valueOf(isSetPval()).compareTo(other.isSetPval());
  274. if (lastComparison != 0) {
  275. return lastComparison;
  276. }
  277. if (isSetPval()) {
  278. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pval, other.pval);
  279. if (lastComparison != 0) {
  280. return lastComparison;
  281. }
  282. }
  283. return 0;
  284. }
  285. public _Fields fieldForId(int fieldId) {
  286. return _Fields.findByThriftId(fieldId);
  287. }
  288. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  289. schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  290. }
  291. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  292. schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  293. }
  294. @Override
  295. public String toString() {
  296. StringBuilder sb = new StringBuilder("UserProperty(");
  297. boolean first = true;
  298. sb.append("id:");
  299. if (this.id == null) {
  300. sb.append("null");
  301. } else {
  302. sb.append(this.id);
  303. }
  304. first = false;
  305. if (!first) sb.append(", ");
  306. sb.append("pval:");
  307. if (this.pval == null) {
  308. sb.append("null");
  309. } else {
  310. sb.append(this.pval);
  311. }
  312. first = false;
  313. sb.append(")");
  314. return sb.toString();
  315. }
  316. public void validate() throws org.apache.thrift.TException {
  317. // check for required fields
  318. if (id == null) {
  319. throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' was not present! Struct: " + toString());
  320. }
  321. if (pval == null) {
  322. throw new org.apache.thrift.protocol.TProtocolException("Required field 'pval' was not present! Struct: " + toString());
  323. }
  324. // check for sub-struct validity
  325. }
  326. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  327. try {
  328. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  329. } catch (org.apache.thrift.TException te) {
  330. throw new java.io.IOException(te);
  331. }
  332. }
  333. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  334. try {
  335. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  336. } catch (org.apache.thrift.TException te) {
  337. throw new java.io.IOException(te);
  338. }
  339. }
  340. private static class UserPropertyStandardSchemeFactory implements SchemeFactory {
  341. public UserPropertyStandardScheme getScheme() {
  342. return new UserPropertyStandardScheme();
  343. }
  344. }
  345. private static class UserPropertyStandardScheme extends StandardScheme<UserProperty> {
  346. public void read(org.apache.thrift.protocol.TProtocol iprot, UserProperty struct) throws org.apache.thrift.TException {
  347. org.apache.thrift.protocol.TField schemeField;
  348. iprot.readStructBegin();
  349. while (true)
  350. {
  351. schemeField = iprot.readFieldBegin();
  352. if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
  353. break;
  354. }
  355. switch (schemeField.id) {
  356. case 1: // ID
  357. if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  358. struct.id = new UserID();
  359. struct.id.read(iprot);
  360. struct.setIdIsSet(true);
  361. } else {
  362. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  363. }
  364. break;
  365. case 2: // PVAL
  366. if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  367. struct.pval = new UserPropertyValue();
  368. struct.pval.read(iprot);
  369. struct.setPvalIsSet(true);
  370. } else {
  371. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  372. }
  373. break;
  374. default:
  375. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  376. }
  377. iprot.readFieldEnd();
  378. }
  379. iprot.readStructEnd();
  380. // check for required fields of primitive type, which can't be checked in the validate method
  381. struct.validate();
  382. }
  383. public void write(org.apache.thrift.protocol.TProtocol oprot, UserProperty struct) throws org.apache.thrift.TException {
  384. struct.validate();
  385. oprot.writeStructBegin(STRUCT_DESC);
  386. if (struct.id != null) {
  387. oprot.writeFieldBegin(ID_FIELD_DESC);
  388. struct.id.write(oprot);
  389. oprot.writeFieldEnd();
  390. }
  391. if (struct.pval != null) {
  392. oprot.writeFieldBegin(PVAL_FIELD_DESC);
  393. struct.pval.write(oprot);
  394. oprot.writeFieldEnd();
  395. }
  396. oprot.writeFieldStop();
  397. oprot.writeStructEnd();
  398. }
  399. }
  400. private static class UserPropertyTupleSchemeFactory implements SchemeFactory {
  401. public UserPropertyTupleScheme getScheme() {
  402. return new UserPropertyTupleScheme();
  403. }
  404. }
  405. private static class UserPropertyTupleScheme extends TupleScheme<UserProperty> {
  406. @Override
  407. public void write(org.apache.thrift.protocol.TProtocol prot, UserProperty struct) throws org.apache.thrift.TException {
  408. TTupleProtocol oprot = (TTupleProtocol) prot;
  409. struct.id.write(oprot);
  410. struct.pval.write(oprot);
  411. }
  412. @Override
  413. public void read(org.apache.thrift.protocol.TProtocol prot, UserProperty struct) throws org.apache.thrift.TException {
  414. TTupleProtocol iprot = (TTupleProtocol) prot;
  415. struct.id = new UserID();
  416. struct.id.read(iprot);
  417. struct.setIdIsSet(true);
  418. struct.pval = new UserPropertyValue();
  419. struct.pval.read(iprot);
  420. struct.setPvalIsSet(true);
  421. }
  422. }
  423. }