PageRenderTime 51ms CodeModel.GetById 20ms 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/HiveObjectRef.java

#
Java | 707 lines | 583 code | 85 blank | 39 comment | 159 complexity | 27596cefee35a8ad803e5ce999694f88 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 HiveObjectRef implements TBase<HiveObjectRef, HiveObjectRef._Fields>, java.io.Serializable, Cloneable {
  27. private static final TStruct STRUCT_DESC = new TStruct("HiveObjectRef");
  28. private static final TField OBJECT_TYPE_FIELD_DESC = new TField("objectType", TType.I32, (short)1);
  29. private static final TField DB_NAME_FIELD_DESC = new TField("dbName", TType.STRING, (short)2);
  30. private static final TField OBJECT_NAME_FIELD_DESC = new TField("objectName", TType.STRING, (short)3);
  31. private static final TField PART_VALUES_FIELD_DESC = new TField("partValues", TType.LIST, (short)4);
  32. private static final TField COLUMN_NAME_FIELD_DESC = new TField("columnName", TType.STRING, (short)5);
  33. private HiveObjectType objectType;
  34. private String dbName;
  35. private String objectName;
  36. private List<String> partValues;
  37. private String columnName;
  38. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  39. public enum _Fields implements TFieldIdEnum {
  40. /**
  41. *
  42. * @see HiveObjectType
  43. */
  44. OBJECT_TYPE((short)1, "objectType"),
  45. DB_NAME((short)2, "dbName"),
  46. OBJECT_NAME((short)3, "objectName"),
  47. PART_VALUES((short)4, "partValues"),
  48. COLUMN_NAME((short)5, "columnName");
  49. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  50. static {
  51. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  52. byName.put(field.getFieldName(), field);
  53. }
  54. }
  55. /**
  56. * Find the _Fields constant that matches fieldId, or null if its not found.
  57. */
  58. public static _Fields findByThriftId(int fieldId) {
  59. switch(fieldId) {
  60. case 1: // OBJECT_TYPE
  61. return OBJECT_TYPE;
  62. case 2: // DB_NAME
  63. return DB_NAME;
  64. case 3: // OBJECT_NAME
  65. return OBJECT_NAME;
  66. case 4: // PART_VALUES
  67. return PART_VALUES;
  68. case 5: // COLUMN_NAME
  69. return COLUMN_NAME;
  70. default:
  71. return null;
  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. * Find the _Fields constant that matches name, or null if its not found.
  85. */
  86. public static _Fields findByName(String name) {
  87. return byName.get(name);
  88. }
  89. private final short _thriftId;
  90. private final String _fieldName;
  91. _Fields(short thriftId, String fieldName) {
  92. _thriftId = thriftId;
  93. _fieldName = fieldName;
  94. }
  95. public short getThriftFieldId() {
  96. return _thriftId;
  97. }
  98. public String getFieldName() {
  99. return _fieldName;
  100. }
  101. }
  102. // isset id assignments
  103. public static final Map<_Fields, FieldMetaData> metaDataMap;
  104. static {
  105. Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
  106. tmpMap.put(_Fields.OBJECT_TYPE, new FieldMetaData("objectType", TFieldRequirementType.DEFAULT,
  107. new EnumMetaData(TType.ENUM, HiveObjectType.class)));
  108. tmpMap.put(_Fields.DB_NAME, new FieldMetaData("dbName", TFieldRequirementType.DEFAULT,
  109. new FieldValueMetaData(TType.STRING)));
  110. tmpMap.put(_Fields.OBJECT_NAME, new FieldMetaData("objectName", TFieldRequirementType.DEFAULT,
  111. new FieldValueMetaData(TType.STRING)));
  112. tmpMap.put(_Fields.PART_VALUES, new FieldMetaData("partValues", TFieldRequirementType.DEFAULT,
  113. new ListMetaData(TType.LIST,
  114. new FieldValueMetaData(TType.STRING))));
  115. tmpMap.put(_Fields.COLUMN_NAME, new FieldMetaData("columnName", TFieldRequirementType.DEFAULT,
  116. new FieldValueMetaData(TType.STRING)));
  117. metaDataMap = Collections.unmodifiableMap(tmpMap);
  118. FieldMetaData.addStructMetaDataMap(HiveObjectRef.class, metaDataMap);
  119. }
  120. public HiveObjectRef() {
  121. }
  122. public HiveObjectRef(
  123. HiveObjectType objectType,
  124. String dbName,
  125. String objectName,
  126. List<String> partValues,
  127. String columnName)
  128. {
  129. this();
  130. this.objectType = objectType;
  131. this.dbName = dbName;
  132. this.objectName = objectName;
  133. this.partValues = partValues;
  134. this.columnName = columnName;
  135. }
  136. /**
  137. * Performs a deep copy on <i>other</i>.
  138. */
  139. public HiveObjectRef(HiveObjectRef other) {
  140. if (other.isSetObjectType()) {
  141. this.objectType = other.objectType;
  142. }
  143. if (other.isSetDbName()) {
  144. this.dbName = other.dbName;
  145. }
  146. if (other.isSetObjectName()) {
  147. this.objectName = other.objectName;
  148. }
  149. if (other.isSetPartValues()) {
  150. List<String> __this__partValues = new ArrayList<String>();
  151. for (String other_element : other.partValues) {
  152. __this__partValues.add(other_element);
  153. }
  154. this.partValues = __this__partValues;
  155. }
  156. if (other.isSetColumnName()) {
  157. this.columnName = other.columnName;
  158. }
  159. }
  160. public HiveObjectRef deepCopy() {
  161. return new HiveObjectRef(this);
  162. }
  163. @Override
  164. public void clear() {
  165. this.objectType = null;
  166. this.dbName = null;
  167. this.objectName = null;
  168. this.partValues = null;
  169. this.columnName = null;
  170. }
  171. /**
  172. *
  173. * @see HiveObjectType
  174. */
  175. public HiveObjectType getObjectType() {
  176. return this.objectType;
  177. }
  178. /**
  179. *
  180. * @see HiveObjectType
  181. */
  182. public void setObjectType(HiveObjectType objectType) {
  183. this.objectType = objectType;
  184. }
  185. public void unsetObjectType() {
  186. this.objectType = null;
  187. }
  188. /** Returns true if field objectType is set (has been asigned a value) and false otherwise */
  189. public boolean isSetObjectType() {
  190. return this.objectType != null;
  191. }
  192. public void setObjectTypeIsSet(boolean value) {
  193. if (!value) {
  194. this.objectType = null;
  195. }
  196. }
  197. public String getDbName() {
  198. return this.dbName;
  199. }
  200. public void setDbName(String dbName) {
  201. this.dbName = dbName;
  202. }
  203. public void unsetDbName() {
  204. this.dbName = null;
  205. }
  206. /** Returns true if field dbName is set (has been asigned a value) and false otherwise */
  207. public boolean isSetDbName() {
  208. return this.dbName != null;
  209. }
  210. public void setDbNameIsSet(boolean value) {
  211. if (!value) {
  212. this.dbName = null;
  213. }
  214. }
  215. public String getObjectName() {
  216. return this.objectName;
  217. }
  218. public void setObjectName(String objectName) {
  219. this.objectName = objectName;
  220. }
  221. public void unsetObjectName() {
  222. this.objectName = null;
  223. }
  224. /** Returns true if field objectName is set (has been asigned a value) and false otherwise */
  225. public boolean isSetObjectName() {
  226. return this.objectName != null;
  227. }
  228. public void setObjectNameIsSet(boolean value) {
  229. if (!value) {
  230. this.objectName = null;
  231. }
  232. }
  233. public int getPartValuesSize() {
  234. return (this.partValues == null) ? 0 : this.partValues.size();
  235. }
  236. public java.util.Iterator<String> getPartValuesIterator() {
  237. return (this.partValues == null) ? null : this.partValues.iterator();
  238. }
  239. public void addToPartValues(String elem) {
  240. if (this.partValues == null) {
  241. this.partValues = new ArrayList<String>();
  242. }
  243. this.partValues.add(elem);
  244. }
  245. public List<String> getPartValues() {
  246. return this.partValues;
  247. }
  248. public void setPartValues(List<String> partValues) {
  249. this.partValues = partValues;
  250. }
  251. public void unsetPartValues() {
  252. this.partValues = null;
  253. }
  254. /** Returns true if field partValues is set (has been asigned a value) and false otherwise */
  255. public boolean isSetPartValues() {
  256. return this.partValues != null;
  257. }
  258. public void setPartValuesIsSet(boolean value) {
  259. if (!value) {
  260. this.partValues = null;
  261. }
  262. }
  263. public String getColumnName() {
  264. return this.columnName;
  265. }
  266. public void setColumnName(String columnName) {
  267. this.columnName = columnName;
  268. }
  269. public void unsetColumnName() {
  270. this.columnName = null;
  271. }
  272. /** Returns true if field columnName is set (has been asigned a value) and false otherwise */
  273. public boolean isSetColumnName() {
  274. return this.columnName != null;
  275. }
  276. public void setColumnNameIsSet(boolean value) {
  277. if (!value) {
  278. this.columnName = null;
  279. }
  280. }
  281. public void setFieldValue(_Fields field, Object value) {
  282. switch (field) {
  283. case OBJECT_TYPE:
  284. if (value == null) {
  285. unsetObjectType();
  286. } else {
  287. setObjectType((HiveObjectType)value);
  288. }
  289. break;
  290. case DB_NAME:
  291. if (value == null) {
  292. unsetDbName();
  293. } else {
  294. setDbName((String)value);
  295. }
  296. break;
  297. case OBJECT_NAME:
  298. if (value == null) {
  299. unsetObjectName();
  300. } else {
  301. setObjectName((String)value);
  302. }
  303. break;
  304. case PART_VALUES:
  305. if (value == null) {
  306. unsetPartValues();
  307. } else {
  308. setPartValues((List<String>)value);
  309. }
  310. break;
  311. case COLUMN_NAME:
  312. if (value == null) {
  313. unsetColumnName();
  314. } else {
  315. setColumnName((String)value);
  316. }
  317. break;
  318. }
  319. }
  320. public Object getFieldValue(_Fields field) {
  321. switch (field) {
  322. case OBJECT_TYPE:
  323. return getObjectType();
  324. case DB_NAME:
  325. return getDbName();
  326. case OBJECT_NAME:
  327. return getObjectName();
  328. case PART_VALUES:
  329. return getPartValues();
  330. case COLUMN_NAME:
  331. return getColumnName();
  332. }
  333. throw new IllegalStateException();
  334. }
  335. /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  336. public boolean isSet(_Fields field) {
  337. if (field == null) {
  338. throw new IllegalArgumentException();
  339. }
  340. switch (field) {
  341. case OBJECT_TYPE:
  342. return isSetObjectType();
  343. case DB_NAME:
  344. return isSetDbName();
  345. case OBJECT_NAME:
  346. return isSetObjectName();
  347. case PART_VALUES:
  348. return isSetPartValues();
  349. case COLUMN_NAME:
  350. return isSetColumnName();
  351. }
  352. throw new IllegalStateException();
  353. }
  354. @Override
  355. public boolean equals(Object that) {
  356. if (that == null)
  357. return false;
  358. if (that instanceof HiveObjectRef)
  359. return this.equals((HiveObjectRef)that);
  360. return false;
  361. }
  362. public boolean equals(HiveObjectRef that) {
  363. if (that == null)
  364. return false;
  365. boolean this_present_objectType = true && this.isSetObjectType();
  366. boolean that_present_objectType = true && that.isSetObjectType();
  367. if (this_present_objectType || that_present_objectType) {
  368. if (!(this_present_objectType && that_present_objectType))
  369. return false;
  370. if (!this.objectType.equals(that.objectType))
  371. return false;
  372. }
  373. boolean this_present_dbName = true && this.isSetDbName();
  374. boolean that_present_dbName = true && that.isSetDbName();
  375. if (this_present_dbName || that_present_dbName) {
  376. if (!(this_present_dbName && that_present_dbName))
  377. return false;
  378. if (!this.dbName.equals(that.dbName))
  379. return false;
  380. }
  381. boolean this_present_objectName = true && this.isSetObjectName();
  382. boolean that_present_objectName = true && that.isSetObjectName();
  383. if (this_present_objectName || that_present_objectName) {
  384. if (!(this_present_objectName && that_present_objectName))
  385. return false;
  386. if (!this.objectName.equals(that.objectName))
  387. return false;
  388. }
  389. boolean this_present_partValues = true && this.isSetPartValues();
  390. boolean that_present_partValues = true && that.isSetPartValues();
  391. if (this_present_partValues || that_present_partValues) {
  392. if (!(this_present_partValues && that_present_partValues))
  393. return false;
  394. if (!this.partValues.equals(that.partValues))
  395. return false;
  396. }
  397. boolean this_present_columnName = true && this.isSetColumnName();
  398. boolean that_present_columnName = true && that.isSetColumnName();
  399. if (this_present_columnName || that_present_columnName) {
  400. if (!(this_present_columnName && that_present_columnName))
  401. return false;
  402. if (!this.columnName.equals(that.columnName))
  403. return false;
  404. }
  405. return true;
  406. }
  407. @Override
  408. public int hashCode() {
  409. return 0;
  410. }
  411. public int compareTo(HiveObjectRef other) {
  412. if (!getClass().equals(other.getClass())) {
  413. return getClass().getName().compareTo(other.getClass().getName());
  414. }
  415. int lastComparison = 0;
  416. HiveObjectRef typedOther = (HiveObjectRef)other;
  417. lastComparison = Boolean.valueOf(isSetObjectType()).compareTo(typedOther.isSetObjectType());
  418. if (lastComparison != 0) {
  419. return lastComparison;
  420. }
  421. if (isSetObjectType()) {
  422. lastComparison = TBaseHelper.compareTo(this.objectType, typedOther.objectType);
  423. if (lastComparison != 0) {
  424. return lastComparison;
  425. }
  426. }
  427. lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
  428. if (lastComparison != 0) {
  429. return lastComparison;
  430. }
  431. if (isSetDbName()) {
  432. lastComparison = TBaseHelper.compareTo(this.dbName, typedOther.dbName);
  433. if (lastComparison != 0) {
  434. return lastComparison;
  435. }
  436. }
  437. lastComparison = Boolean.valueOf(isSetObjectName()).compareTo(typedOther.isSetObjectName());
  438. if (lastComparison != 0) {
  439. return lastComparison;
  440. }
  441. if (isSetObjectName()) {
  442. lastComparison = TBaseHelper.compareTo(this.objectName, typedOther.objectName);
  443. if (lastComparison != 0) {
  444. return lastComparison;
  445. }
  446. }
  447. lastComparison = Boolean.valueOf(isSetPartValues()).compareTo(typedOther.isSetPartValues());
  448. if (lastComparison != 0) {
  449. return lastComparison;
  450. }
  451. if (isSetPartValues()) {
  452. lastComparison = TBaseHelper.compareTo(this.partValues, typedOther.partValues);
  453. if (lastComparison != 0) {
  454. return lastComparison;
  455. }
  456. }
  457. lastComparison = Boolean.valueOf(isSetColumnName()).compareTo(typedOther.isSetColumnName());
  458. if (lastComparison != 0) {
  459. return lastComparison;
  460. }
  461. if (isSetColumnName()) {
  462. lastComparison = TBaseHelper.compareTo(this.columnName, typedOther.columnName);
  463. if (lastComparison != 0) {
  464. return lastComparison;
  465. }
  466. }
  467. return 0;
  468. }
  469. public _Fields fieldForId(int fieldId) {
  470. return _Fields.findByThriftId(fieldId);
  471. }
  472. public void read(TProtocol iprot) throws TException {
  473. TField field;
  474. iprot.readStructBegin();
  475. while (true)
  476. {
  477. field = iprot.readFieldBegin();
  478. if (field.type == TType.STOP) {
  479. break;
  480. }
  481. switch (field.id) {
  482. case 1: // OBJECT_TYPE
  483. if (field.type == TType.I32) {
  484. this.objectType = HiveObjectType.findByValue(iprot.readI32());
  485. } else {
  486. TProtocolUtil.skip(iprot, field.type);
  487. }
  488. break;
  489. case 2: // DB_NAME
  490. if (field.type == TType.STRING) {
  491. this.dbName = iprot.readString();
  492. } else {
  493. TProtocolUtil.skip(iprot, field.type);
  494. }
  495. break;
  496. case 3: // OBJECT_NAME
  497. if (field.type == TType.STRING) {
  498. this.objectName = iprot.readString();
  499. } else {
  500. TProtocolUtil.skip(iprot, field.type);
  501. }
  502. break;
  503. case 4: // PART_VALUES
  504. if (field.type == TType.LIST) {
  505. {
  506. TList _list4 = iprot.readListBegin();
  507. this.partValues = new ArrayList<String>(_list4.size);
  508. for (int _i5 = 0; _i5 < _list4.size; ++_i5)
  509. {
  510. String _elem6;
  511. _elem6 = iprot.readString();
  512. this.partValues.add(_elem6);
  513. }
  514. iprot.readListEnd();
  515. }
  516. } else {
  517. TProtocolUtil.skip(iprot, field.type);
  518. }
  519. break;
  520. case 5: // COLUMN_NAME
  521. if (field.type == TType.STRING) {
  522. this.columnName = iprot.readString();
  523. } else {
  524. TProtocolUtil.skip(iprot, field.type);
  525. }
  526. break;
  527. default:
  528. TProtocolUtil.skip(iprot, field.type);
  529. }
  530. iprot.readFieldEnd();
  531. }
  532. iprot.readStructEnd();
  533. validate();
  534. }
  535. public void write(TProtocol oprot) throws TException {
  536. validate();
  537. oprot.writeStructBegin(STRUCT_DESC);
  538. if (this.objectType != null) {
  539. oprot.writeFieldBegin(OBJECT_TYPE_FIELD_DESC);
  540. oprot.writeI32(this.objectType.getValue());
  541. oprot.writeFieldEnd();
  542. }
  543. if (this.dbName != null) {
  544. oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
  545. oprot.writeString(this.dbName);
  546. oprot.writeFieldEnd();
  547. }
  548. if (this.objectName != null) {
  549. oprot.writeFieldBegin(OBJECT_NAME_FIELD_DESC);
  550. oprot.writeString(this.objectName);
  551. oprot.writeFieldEnd();
  552. }
  553. if (this.partValues != null) {
  554. oprot.writeFieldBegin(PART_VALUES_FIELD_DESC);
  555. {
  556. oprot.writeListBegin(new TList(TType.STRING, this.partValues.size()));
  557. for (String _iter7 : this.partValues)
  558. {
  559. oprot.writeString(_iter7);
  560. }
  561. oprot.writeListEnd();
  562. }
  563. oprot.writeFieldEnd();
  564. }
  565. if (this.columnName != null) {
  566. oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
  567. oprot.writeString(this.columnName);
  568. oprot.writeFieldEnd();
  569. }
  570. oprot.writeFieldStop();
  571. oprot.writeStructEnd();
  572. }
  573. @Override
  574. public String toString() {
  575. StringBuilder sb = new StringBuilder("HiveObjectRef(");
  576. boolean first = true;
  577. sb.append("objectType:");
  578. if (this.objectType == null) {
  579. sb.append("null");
  580. } else {
  581. sb.append(this.objectType);
  582. }
  583. first = false;
  584. if (!first) sb.append(", ");
  585. sb.append("dbName:");
  586. if (this.dbName == null) {
  587. sb.append("null");
  588. } else {
  589. sb.append(this.dbName);
  590. }
  591. first = false;
  592. if (!first) sb.append(", ");
  593. sb.append("objectName:");
  594. if (this.objectName == null) {
  595. sb.append("null");
  596. } else {
  597. sb.append(this.objectName);
  598. }
  599. first = false;
  600. if (!first) sb.append(", ");
  601. sb.append("partValues:");
  602. if (this.partValues == null) {
  603. sb.append("null");
  604. } else {
  605. sb.append(this.partValues);
  606. }
  607. first = false;
  608. if (!first) sb.append(", ");
  609. sb.append("columnName:");
  610. if (this.columnName == null) {
  611. sb.append("null");
  612. } else {
  613. sb.append(this.columnName);
  614. }
  615. first = false;
  616. sb.append(")");
  617. return sb.toString();
  618. }
  619. public void validate() throws TException {
  620. // check for required fields
  621. }
  622. }