PageRenderTime 39ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Order.java

#
Java | 392 lines | 310 code | 58 blank | 24 comment | 62 complexity | cfb8f364e1b53cdb85367f238e34bedb MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.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 org.apache.hadoop.hive.metastore.api;
  7. import java.util.List;
  8. import java.util.ArrayList;
  9. import java.util.Map;
  10. import java.util.HashMap;
  11. import java.util.EnumMap;
  12. import java.util.Set;
  13. import java.util.HashSet;
  14. import java.util.EnumSet;
  15. import java.util.Collections;
  16. import java.util.BitSet;
  17. import java.nio.ByteBuffer;
  18. import java.util.Arrays;
  19. import org.slf4j.Logger;
  20. import org.slf4j.LoggerFactory;
  21. import org.apache.thrift.*;
  22. import org.apache.thrift.async.*;
  23. import org.apache.thrift.meta_data.*;
  24. import org.apache.thrift.transport.*;
  25. import org.apache.thrift.protocol.*;
  26. public class Order implements TBase<Order, Order._Fields>, java.io.Serializable, Cloneable {
  27. private static final TStruct STRUCT_DESC = new TStruct("Order");
  28. private static final TField COL_FIELD_DESC = new TField("col", TType.STRING, (short)1);
  29. private static final TField ORDER_FIELD_DESC = new TField("order", TType.I32, (short)2);
  30. private String col;
  31. private int order;
  32. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  33. public enum _Fields implements TFieldIdEnum {
  34. COL((short)1, "col"),
  35. ORDER((short)2, "order");
  36. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  37. static {
  38. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  39. byName.put(field.getFieldName(), field);
  40. }
  41. }
  42. /**
  43. * Find the _Fields constant that matches fieldId, or null if its not found.
  44. */
  45. public static _Fields findByThriftId(int fieldId) {
  46. switch(fieldId) {
  47. case 1: // COL
  48. return COL;
  49. case 2: // ORDER
  50. return ORDER;
  51. default:
  52. return null;
  53. }
  54. }
  55. /**
  56. * Find the _Fields constant that matches fieldId, throwing an exception
  57. * if it is not found.
  58. */
  59. public static _Fields findByThriftIdOrThrow(int fieldId) {
  60. _Fields fields = findByThriftId(fieldId);
  61. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  62. return fields;
  63. }
  64. /**
  65. * Find the _Fields constant that matches name, or null if its not found.
  66. */
  67. public static _Fields findByName(String name) {
  68. return byName.get(name);
  69. }
  70. private final short _thriftId;
  71. private final String _fieldName;
  72. _Fields(short thriftId, String fieldName) {
  73. _thriftId = thriftId;
  74. _fieldName = fieldName;
  75. }
  76. public short getThriftFieldId() {
  77. return _thriftId;
  78. }
  79. public String getFieldName() {
  80. return _fieldName;
  81. }
  82. }
  83. // isset id assignments
  84. private static final int __ORDER_ISSET_ID = 0;
  85. private BitSet __isset_bit_vector = new BitSet(1);
  86. public static final Map<_Fields, FieldMetaData> metaDataMap;
  87. static {
  88. Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
  89. tmpMap.put(_Fields.COL, new FieldMetaData("col", TFieldRequirementType.DEFAULT,
  90. new FieldValueMetaData(TType.STRING)));
  91. tmpMap.put(_Fields.ORDER, new FieldMetaData("order", TFieldRequirementType.DEFAULT,
  92. new FieldValueMetaData(TType.I32)));
  93. metaDataMap = Collections.unmodifiableMap(tmpMap);
  94. FieldMetaData.addStructMetaDataMap(Order.class, metaDataMap);
  95. }
  96. public Order() {
  97. }
  98. public Order(
  99. String col,
  100. int order)
  101. {
  102. this();
  103. this.col = col;
  104. this.order = order;
  105. setOrderIsSet(true);
  106. }
  107. /**
  108. * Performs a deep copy on <i>other</i>.
  109. */
  110. public Order(Order other) {
  111. __isset_bit_vector.clear();
  112. __isset_bit_vector.or(other.__isset_bit_vector);
  113. if (other.isSetCol()) {
  114. this.col = other.col;
  115. }
  116. this.order = other.order;
  117. }
  118. public Order deepCopy() {
  119. return new Order(this);
  120. }
  121. @Override
  122. public void clear() {
  123. this.col = null;
  124. setOrderIsSet(false);
  125. this.order = 0;
  126. }
  127. public String getCol() {
  128. return this.col;
  129. }
  130. public void setCol(String col) {
  131. this.col = col;
  132. }
  133. public void unsetCol() {
  134. this.col = null;
  135. }
  136. /** Returns true if field col is set (has been asigned a value) and false otherwise */
  137. public boolean isSetCol() {
  138. return this.col != null;
  139. }
  140. public void setColIsSet(boolean value) {
  141. if (!value) {
  142. this.col = null;
  143. }
  144. }
  145. public int getOrder() {
  146. return this.order;
  147. }
  148. public void setOrder(int order) {
  149. this.order = order;
  150. setOrderIsSet(true);
  151. }
  152. public void unsetOrder() {
  153. __isset_bit_vector.clear(__ORDER_ISSET_ID);
  154. }
  155. /** Returns true if field order is set (has been asigned a value) and false otherwise */
  156. public boolean isSetOrder() {
  157. return __isset_bit_vector.get(__ORDER_ISSET_ID);
  158. }
  159. public void setOrderIsSet(boolean value) {
  160. __isset_bit_vector.set(__ORDER_ISSET_ID, value);
  161. }
  162. public void setFieldValue(_Fields field, Object value) {
  163. switch (field) {
  164. case COL:
  165. if (value == null) {
  166. unsetCol();
  167. } else {
  168. setCol((String)value);
  169. }
  170. break;
  171. case ORDER:
  172. if (value == null) {
  173. unsetOrder();
  174. } else {
  175. setOrder((Integer)value);
  176. }
  177. break;
  178. }
  179. }
  180. public Object getFieldValue(_Fields field) {
  181. switch (field) {
  182. case COL:
  183. return getCol();
  184. case ORDER:
  185. return new Integer(getOrder());
  186. }
  187. throw new IllegalStateException();
  188. }
  189. /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  190. public boolean isSet(_Fields field) {
  191. if (field == null) {
  192. throw new IllegalArgumentException();
  193. }
  194. switch (field) {
  195. case COL:
  196. return isSetCol();
  197. case ORDER:
  198. return isSetOrder();
  199. }
  200. throw new IllegalStateException();
  201. }
  202. @Override
  203. public boolean equals(Object that) {
  204. if (that == null)
  205. return false;
  206. if (that instanceof Order)
  207. return this.equals((Order)that);
  208. return false;
  209. }
  210. public boolean equals(Order that) {
  211. if (that == null)
  212. return false;
  213. boolean this_present_col = true && this.isSetCol();
  214. boolean that_present_col = true && that.isSetCol();
  215. if (this_present_col || that_present_col) {
  216. if (!(this_present_col && that_present_col))
  217. return false;
  218. if (!this.col.equals(that.col))
  219. return false;
  220. }
  221. boolean this_present_order = true;
  222. boolean that_present_order = true;
  223. if (this_present_order || that_present_order) {
  224. if (!(this_present_order && that_present_order))
  225. return false;
  226. if (this.order != that.order)
  227. return false;
  228. }
  229. return true;
  230. }
  231. @Override
  232. public int hashCode() {
  233. return 0;
  234. }
  235. public int compareTo(Order other) {
  236. if (!getClass().equals(other.getClass())) {
  237. return getClass().getName().compareTo(other.getClass().getName());
  238. }
  239. int lastComparison = 0;
  240. Order typedOther = (Order)other;
  241. lastComparison = Boolean.valueOf(isSetCol()).compareTo(typedOther.isSetCol());
  242. if (lastComparison != 0) {
  243. return lastComparison;
  244. }
  245. if (isSetCol()) {
  246. lastComparison = TBaseHelper.compareTo(this.col, typedOther.col);
  247. if (lastComparison != 0) {
  248. return lastComparison;
  249. }
  250. }
  251. lastComparison = Boolean.valueOf(isSetOrder()).compareTo(typedOther.isSetOrder());
  252. if (lastComparison != 0) {
  253. return lastComparison;
  254. }
  255. if (isSetOrder()) {
  256. lastComparison = TBaseHelper.compareTo(this.order, typedOther.order);
  257. if (lastComparison != 0) {
  258. return lastComparison;
  259. }
  260. }
  261. return 0;
  262. }
  263. public _Fields fieldForId(int fieldId) {
  264. return _Fields.findByThriftId(fieldId);
  265. }
  266. public void read(TProtocol iprot) throws TException {
  267. TField field;
  268. iprot.readStructBegin();
  269. while (true)
  270. {
  271. field = iprot.readFieldBegin();
  272. if (field.type == TType.STOP) {
  273. break;
  274. }
  275. switch (field.id) {
  276. case 1: // COL
  277. if (field.type == TType.STRING) {
  278. this.col = iprot.readString();
  279. } else {
  280. TProtocolUtil.skip(iprot, field.type);
  281. }
  282. break;
  283. case 2: // ORDER
  284. if (field.type == TType.I32) {
  285. this.order = iprot.readI32();
  286. setOrderIsSet(true);
  287. } else {
  288. TProtocolUtil.skip(iprot, field.type);
  289. }
  290. break;
  291. default:
  292. TProtocolUtil.skip(iprot, field.type);
  293. }
  294. iprot.readFieldEnd();
  295. }
  296. iprot.readStructEnd();
  297. validate();
  298. }
  299. public void write(TProtocol oprot) throws TException {
  300. validate();
  301. oprot.writeStructBegin(STRUCT_DESC);
  302. if (this.col != null) {
  303. oprot.writeFieldBegin(COL_FIELD_DESC);
  304. oprot.writeString(this.col);
  305. oprot.writeFieldEnd();
  306. }
  307. oprot.writeFieldBegin(ORDER_FIELD_DESC);
  308. oprot.writeI32(this.order);
  309. oprot.writeFieldEnd();
  310. oprot.writeFieldStop();
  311. oprot.writeStructEnd();
  312. }
  313. @Override
  314. public String toString() {
  315. StringBuilder sb = new StringBuilder("Order(");
  316. boolean first = true;
  317. sb.append("col:");
  318. if (this.col == null) {
  319. sb.append("null");
  320. } else {
  321. sb.append(this.col);
  322. }
  323. first = false;
  324. if (!first) sb.append(", ");
  325. sb.append("order:");
  326. sb.append(this.order);
  327. first = false;
  328. sb.append(")");
  329. return sb.toString();
  330. }
  331. public void validate() throws TException {
  332. // check for required fields
  333. }
  334. }