PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Role.java

#
Java | 480 lines | 389 code | 66 blank | 25 comment | 89 complexity | 5f0b14905aeeb83249596952c9564596 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 Role implements TBase<Role, Role._Fields>, java.io.Serializable, Cloneable {
  27. private static final TStruct STRUCT_DESC = new TStruct("Role");
  28. private static final TField ROLE_NAME_FIELD_DESC = new TField("roleName", TType.STRING, (short)1);
  29. private static final TField CREATE_TIME_FIELD_DESC = new TField("createTime", TType.I32, (short)2);
  30. private static final TField OWNER_NAME_FIELD_DESC = new TField("ownerName", TType.STRING, (short)3);
  31. private String roleName;
  32. private int createTime;
  33. private String ownerName;
  34. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  35. public enum _Fields implements TFieldIdEnum {
  36. ROLE_NAME((short)1, "roleName"),
  37. CREATE_TIME((short)2, "createTime"),
  38. OWNER_NAME((short)3, "ownerName");
  39. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  40. static {
  41. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  42. byName.put(field.getFieldName(), field);
  43. }
  44. }
  45. /**
  46. * Find the _Fields constant that matches fieldId, or null if its not found.
  47. */
  48. public static _Fields findByThriftId(int fieldId) {
  49. switch(fieldId) {
  50. case 1: // ROLE_NAME
  51. return ROLE_NAME;
  52. case 2: // CREATE_TIME
  53. return CREATE_TIME;
  54. case 3: // OWNER_NAME
  55. return OWNER_NAME;
  56. default:
  57. return null;
  58. }
  59. }
  60. /**
  61. * Find the _Fields constant that matches fieldId, throwing an exception
  62. * if it is not found.
  63. */
  64. public static _Fields findByThriftIdOrThrow(int fieldId) {
  65. _Fields fields = findByThriftId(fieldId);
  66. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  67. return fields;
  68. }
  69. /**
  70. * Find the _Fields constant that matches name, or null if its not found.
  71. */
  72. public static _Fields findByName(String name) {
  73. return byName.get(name);
  74. }
  75. private final short _thriftId;
  76. private final String _fieldName;
  77. _Fields(short thriftId, String fieldName) {
  78. _thriftId = thriftId;
  79. _fieldName = fieldName;
  80. }
  81. public short getThriftFieldId() {
  82. return _thriftId;
  83. }
  84. public String getFieldName() {
  85. return _fieldName;
  86. }
  87. }
  88. // isset id assignments
  89. private static final int __CREATETIME_ISSET_ID = 0;
  90. private BitSet __isset_bit_vector = new BitSet(1);
  91. public static final Map<_Fields, FieldMetaData> metaDataMap;
  92. static {
  93. Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
  94. tmpMap.put(_Fields.ROLE_NAME, new FieldMetaData("roleName", TFieldRequirementType.DEFAULT,
  95. new FieldValueMetaData(TType.STRING)));
  96. tmpMap.put(_Fields.CREATE_TIME, new FieldMetaData("createTime", TFieldRequirementType.DEFAULT,
  97. new FieldValueMetaData(TType.I32)));
  98. tmpMap.put(_Fields.OWNER_NAME, new FieldMetaData("ownerName", TFieldRequirementType.DEFAULT,
  99. new FieldValueMetaData(TType.STRING)));
  100. metaDataMap = Collections.unmodifiableMap(tmpMap);
  101. FieldMetaData.addStructMetaDataMap(Role.class, metaDataMap);
  102. }
  103. public Role() {
  104. }
  105. public Role(
  106. String roleName,
  107. int createTime,
  108. String ownerName)
  109. {
  110. this();
  111. this.roleName = roleName;
  112. this.createTime = createTime;
  113. setCreateTimeIsSet(true);
  114. this.ownerName = ownerName;
  115. }
  116. /**
  117. * Performs a deep copy on <i>other</i>.
  118. */
  119. public Role(Role other) {
  120. __isset_bit_vector.clear();
  121. __isset_bit_vector.or(other.__isset_bit_vector);
  122. if (other.isSetRoleName()) {
  123. this.roleName = other.roleName;
  124. }
  125. this.createTime = other.createTime;
  126. if (other.isSetOwnerName()) {
  127. this.ownerName = other.ownerName;
  128. }
  129. }
  130. public Role deepCopy() {
  131. return new Role(this);
  132. }
  133. @Override
  134. public void clear() {
  135. this.roleName = null;
  136. setCreateTimeIsSet(false);
  137. this.createTime = 0;
  138. this.ownerName = null;
  139. }
  140. public String getRoleName() {
  141. return this.roleName;
  142. }
  143. public void setRoleName(String roleName) {
  144. this.roleName = roleName;
  145. }
  146. public void unsetRoleName() {
  147. this.roleName = null;
  148. }
  149. /** Returns true if field roleName is set (has been asigned a value) and false otherwise */
  150. public boolean isSetRoleName() {
  151. return this.roleName != null;
  152. }
  153. public void setRoleNameIsSet(boolean value) {
  154. if (!value) {
  155. this.roleName = null;
  156. }
  157. }
  158. public int getCreateTime() {
  159. return this.createTime;
  160. }
  161. public void setCreateTime(int createTime) {
  162. this.createTime = createTime;
  163. setCreateTimeIsSet(true);
  164. }
  165. public void unsetCreateTime() {
  166. __isset_bit_vector.clear(__CREATETIME_ISSET_ID);
  167. }
  168. /** Returns true if field createTime is set (has been asigned a value) and false otherwise */
  169. public boolean isSetCreateTime() {
  170. return __isset_bit_vector.get(__CREATETIME_ISSET_ID);
  171. }
  172. public void setCreateTimeIsSet(boolean value) {
  173. __isset_bit_vector.set(__CREATETIME_ISSET_ID, value);
  174. }
  175. public String getOwnerName() {
  176. return this.ownerName;
  177. }
  178. public void setOwnerName(String ownerName) {
  179. this.ownerName = ownerName;
  180. }
  181. public void unsetOwnerName() {
  182. this.ownerName = null;
  183. }
  184. /** Returns true if field ownerName is set (has been asigned a value) and false otherwise */
  185. public boolean isSetOwnerName() {
  186. return this.ownerName != null;
  187. }
  188. public void setOwnerNameIsSet(boolean value) {
  189. if (!value) {
  190. this.ownerName = null;
  191. }
  192. }
  193. public void setFieldValue(_Fields field, Object value) {
  194. switch (field) {
  195. case ROLE_NAME:
  196. if (value == null) {
  197. unsetRoleName();
  198. } else {
  199. setRoleName((String)value);
  200. }
  201. break;
  202. case CREATE_TIME:
  203. if (value == null) {
  204. unsetCreateTime();
  205. } else {
  206. setCreateTime((Integer)value);
  207. }
  208. break;
  209. case OWNER_NAME:
  210. if (value == null) {
  211. unsetOwnerName();
  212. } else {
  213. setOwnerName((String)value);
  214. }
  215. break;
  216. }
  217. }
  218. public Object getFieldValue(_Fields field) {
  219. switch (field) {
  220. case ROLE_NAME:
  221. return getRoleName();
  222. case CREATE_TIME:
  223. return new Integer(getCreateTime());
  224. case OWNER_NAME:
  225. return getOwnerName();
  226. }
  227. throw new IllegalStateException();
  228. }
  229. /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  230. public boolean isSet(_Fields field) {
  231. if (field == null) {
  232. throw new IllegalArgumentException();
  233. }
  234. switch (field) {
  235. case ROLE_NAME:
  236. return isSetRoleName();
  237. case CREATE_TIME:
  238. return isSetCreateTime();
  239. case OWNER_NAME:
  240. return isSetOwnerName();
  241. }
  242. throw new IllegalStateException();
  243. }
  244. @Override
  245. public boolean equals(Object that) {
  246. if (that == null)
  247. return false;
  248. if (that instanceof Role)
  249. return this.equals((Role)that);
  250. return false;
  251. }
  252. public boolean equals(Role that) {
  253. if (that == null)
  254. return false;
  255. boolean this_present_roleName = true && this.isSetRoleName();
  256. boolean that_present_roleName = true && that.isSetRoleName();
  257. if (this_present_roleName || that_present_roleName) {
  258. if (!(this_present_roleName && that_present_roleName))
  259. return false;
  260. if (!this.roleName.equals(that.roleName))
  261. return false;
  262. }
  263. boolean this_present_createTime = true;
  264. boolean that_present_createTime = true;
  265. if (this_present_createTime || that_present_createTime) {
  266. if (!(this_present_createTime && that_present_createTime))
  267. return false;
  268. if (this.createTime != that.createTime)
  269. return false;
  270. }
  271. boolean this_present_ownerName = true && this.isSetOwnerName();
  272. boolean that_present_ownerName = true && that.isSetOwnerName();
  273. if (this_present_ownerName || that_present_ownerName) {
  274. if (!(this_present_ownerName && that_present_ownerName))
  275. return false;
  276. if (!this.ownerName.equals(that.ownerName))
  277. return false;
  278. }
  279. return true;
  280. }
  281. @Override
  282. public int hashCode() {
  283. return 0;
  284. }
  285. public int compareTo(Role other) {
  286. if (!getClass().equals(other.getClass())) {
  287. return getClass().getName().compareTo(other.getClass().getName());
  288. }
  289. int lastComparison = 0;
  290. Role typedOther = (Role)other;
  291. lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
  292. if (lastComparison != 0) {
  293. return lastComparison;
  294. }
  295. if (isSetRoleName()) {
  296. lastComparison = TBaseHelper.compareTo(this.roleName, typedOther.roleName);
  297. if (lastComparison != 0) {
  298. return lastComparison;
  299. }
  300. }
  301. lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime());
  302. if (lastComparison != 0) {
  303. return lastComparison;
  304. }
  305. if (isSetCreateTime()) {
  306. lastComparison = TBaseHelper.compareTo(this.createTime, typedOther.createTime);
  307. if (lastComparison != 0) {
  308. return lastComparison;
  309. }
  310. }
  311. lastComparison = Boolean.valueOf(isSetOwnerName()).compareTo(typedOther.isSetOwnerName());
  312. if (lastComparison != 0) {
  313. return lastComparison;
  314. }
  315. if (isSetOwnerName()) {
  316. lastComparison = TBaseHelper.compareTo(this.ownerName, typedOther.ownerName);
  317. if (lastComparison != 0) {
  318. return lastComparison;
  319. }
  320. }
  321. return 0;
  322. }
  323. public _Fields fieldForId(int fieldId) {
  324. return _Fields.findByThriftId(fieldId);
  325. }
  326. public void read(TProtocol iprot) throws TException {
  327. TField field;
  328. iprot.readStructBegin();
  329. while (true)
  330. {
  331. field = iprot.readFieldBegin();
  332. if (field.type == TType.STOP) {
  333. break;
  334. }
  335. switch (field.id) {
  336. case 1: // ROLE_NAME
  337. if (field.type == TType.STRING) {
  338. this.roleName = iprot.readString();
  339. } else {
  340. TProtocolUtil.skip(iprot, field.type);
  341. }
  342. break;
  343. case 2: // CREATE_TIME
  344. if (field.type == TType.I32) {
  345. this.createTime = iprot.readI32();
  346. setCreateTimeIsSet(true);
  347. } else {
  348. TProtocolUtil.skip(iprot, field.type);
  349. }
  350. break;
  351. case 3: // OWNER_NAME
  352. if (field.type == TType.STRING) {
  353. this.ownerName = iprot.readString();
  354. } else {
  355. TProtocolUtil.skip(iprot, field.type);
  356. }
  357. break;
  358. default:
  359. TProtocolUtil.skip(iprot, field.type);
  360. }
  361. iprot.readFieldEnd();
  362. }
  363. iprot.readStructEnd();
  364. validate();
  365. }
  366. public void write(TProtocol oprot) throws TException {
  367. validate();
  368. oprot.writeStructBegin(STRUCT_DESC);
  369. if (this.roleName != null) {
  370. oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
  371. oprot.writeString(this.roleName);
  372. oprot.writeFieldEnd();
  373. }
  374. oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
  375. oprot.writeI32(this.createTime);
  376. oprot.writeFieldEnd();
  377. if (this.ownerName != null) {
  378. oprot.writeFieldBegin(OWNER_NAME_FIELD_DESC);
  379. oprot.writeString(this.ownerName);
  380. oprot.writeFieldEnd();
  381. }
  382. oprot.writeFieldStop();
  383. oprot.writeStructEnd();
  384. }
  385. @Override
  386. public String toString() {
  387. StringBuilder sb = new StringBuilder("Role(");
  388. boolean first = true;
  389. sb.append("roleName:");
  390. if (this.roleName == null) {
  391. sb.append("null");
  392. } else {
  393. sb.append(this.roleName);
  394. }
  395. first = false;
  396. if (!first) sb.append(", ");
  397. sb.append("createTime:");
  398. sb.append(this.createTime);
  399. first = false;
  400. if (!first) sb.append(", ");
  401. sb.append("ownerName:");
  402. if (this.ownerName == null) {
  403. sb.append("null");
  404. } else {
  405. sb.append(this.ownerName);
  406. }
  407. first = false;
  408. sb.append(")");
  409. return sb.toString();
  410. }
  411. public void validate() throws TException {
  412. // check for required fields
  413. }
  414. }