PageRenderTime 43ms CodeModel.GetById 15ms 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/PrivilegeBag.java

#
Java | 344 lines | 268 code | 53 blank | 23 comment | 51 complexity | 614679a3f6144746bcc695fe3883519c 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 PrivilegeBag implements TBase<PrivilegeBag, PrivilegeBag._Fields>, java.io.Serializable, Cloneable {
  27. private static final TStruct STRUCT_DESC = new TStruct("PrivilegeBag");
  28. private static final TField PRIVILEGES_FIELD_DESC = new TField("privileges", TType.LIST, (short)1);
  29. private List<HiveObjectPrivilege> privileges;
  30. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  31. public enum _Fields implements TFieldIdEnum {
  32. PRIVILEGES((short)1, "privileges");
  33. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  34. static {
  35. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  36. byName.put(field.getFieldName(), field);
  37. }
  38. }
  39. /**
  40. * Find the _Fields constant that matches fieldId, or null if its not found.
  41. */
  42. public static _Fields findByThriftId(int fieldId) {
  43. switch(fieldId) {
  44. case 1: // PRIVILEGES
  45. return PRIVILEGES;
  46. default:
  47. return null;
  48. }
  49. }
  50. /**
  51. * Find the _Fields constant that matches fieldId, throwing an exception
  52. * if it is not found.
  53. */
  54. public static _Fields findByThriftIdOrThrow(int fieldId) {
  55. _Fields fields = findByThriftId(fieldId);
  56. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  57. return fields;
  58. }
  59. /**
  60. * Find the _Fields constant that matches name, or null if its not found.
  61. */
  62. public static _Fields findByName(String name) {
  63. return byName.get(name);
  64. }
  65. private final short _thriftId;
  66. private final String _fieldName;
  67. _Fields(short thriftId, String fieldName) {
  68. _thriftId = thriftId;
  69. _fieldName = fieldName;
  70. }
  71. public short getThriftFieldId() {
  72. return _thriftId;
  73. }
  74. public String getFieldName() {
  75. return _fieldName;
  76. }
  77. }
  78. // isset id assignments
  79. public static final Map<_Fields, FieldMetaData> metaDataMap;
  80. static {
  81. Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
  82. tmpMap.put(_Fields.PRIVILEGES, new FieldMetaData("privileges", TFieldRequirementType.DEFAULT,
  83. new ListMetaData(TType.LIST,
  84. new StructMetaData(TType.STRUCT, HiveObjectPrivilege.class))));
  85. metaDataMap = Collections.unmodifiableMap(tmpMap);
  86. FieldMetaData.addStructMetaDataMap(PrivilegeBag.class, metaDataMap);
  87. }
  88. public PrivilegeBag() {
  89. }
  90. public PrivilegeBag(
  91. List<HiveObjectPrivilege> privileges)
  92. {
  93. this();
  94. this.privileges = privileges;
  95. }
  96. /**
  97. * Performs a deep copy on <i>other</i>.
  98. */
  99. public PrivilegeBag(PrivilegeBag other) {
  100. if (other.isSetPrivileges()) {
  101. List<HiveObjectPrivilege> __this__privileges = new ArrayList<HiveObjectPrivilege>();
  102. for (HiveObjectPrivilege other_element : other.privileges) {
  103. __this__privileges.add(new HiveObjectPrivilege(other_element));
  104. }
  105. this.privileges = __this__privileges;
  106. }
  107. }
  108. public PrivilegeBag deepCopy() {
  109. return new PrivilegeBag(this);
  110. }
  111. @Override
  112. public void clear() {
  113. this.privileges = null;
  114. }
  115. public int getPrivilegesSize() {
  116. return (this.privileges == null) ? 0 : this.privileges.size();
  117. }
  118. public java.util.Iterator<HiveObjectPrivilege> getPrivilegesIterator() {
  119. return (this.privileges == null) ? null : this.privileges.iterator();
  120. }
  121. public void addToPrivileges(HiveObjectPrivilege elem) {
  122. if (this.privileges == null) {
  123. this.privileges = new ArrayList<HiveObjectPrivilege>();
  124. }
  125. this.privileges.add(elem);
  126. }
  127. public List<HiveObjectPrivilege> getPrivileges() {
  128. return this.privileges;
  129. }
  130. public void setPrivileges(List<HiveObjectPrivilege> privileges) {
  131. this.privileges = privileges;
  132. }
  133. public void unsetPrivileges() {
  134. this.privileges = null;
  135. }
  136. /** Returns true if field privileges is set (has been asigned a value) and false otherwise */
  137. public boolean isSetPrivileges() {
  138. return this.privileges != null;
  139. }
  140. public void setPrivilegesIsSet(boolean value) {
  141. if (!value) {
  142. this.privileges = null;
  143. }
  144. }
  145. public void setFieldValue(_Fields field, Object value) {
  146. switch (field) {
  147. case PRIVILEGES:
  148. if (value == null) {
  149. unsetPrivileges();
  150. } else {
  151. setPrivileges((List<HiveObjectPrivilege>)value);
  152. }
  153. break;
  154. }
  155. }
  156. public Object getFieldValue(_Fields field) {
  157. switch (field) {
  158. case PRIVILEGES:
  159. return getPrivileges();
  160. }
  161. throw new IllegalStateException();
  162. }
  163. /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  164. public boolean isSet(_Fields field) {
  165. if (field == null) {
  166. throw new IllegalArgumentException();
  167. }
  168. switch (field) {
  169. case PRIVILEGES:
  170. return isSetPrivileges();
  171. }
  172. throw new IllegalStateException();
  173. }
  174. @Override
  175. public boolean equals(Object that) {
  176. if (that == null)
  177. return false;
  178. if (that instanceof PrivilegeBag)
  179. return this.equals((PrivilegeBag)that);
  180. return false;
  181. }
  182. public boolean equals(PrivilegeBag that) {
  183. if (that == null)
  184. return false;
  185. boolean this_present_privileges = true && this.isSetPrivileges();
  186. boolean that_present_privileges = true && that.isSetPrivileges();
  187. if (this_present_privileges || that_present_privileges) {
  188. if (!(this_present_privileges && that_present_privileges))
  189. return false;
  190. if (!this.privileges.equals(that.privileges))
  191. return false;
  192. }
  193. return true;
  194. }
  195. @Override
  196. public int hashCode() {
  197. return 0;
  198. }
  199. public int compareTo(PrivilegeBag other) {
  200. if (!getClass().equals(other.getClass())) {
  201. return getClass().getName().compareTo(other.getClass().getName());
  202. }
  203. int lastComparison = 0;
  204. PrivilegeBag typedOther = (PrivilegeBag)other;
  205. lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
  206. if (lastComparison != 0) {
  207. return lastComparison;
  208. }
  209. if (isSetPrivileges()) {
  210. lastComparison = TBaseHelper.compareTo(this.privileges, typedOther.privileges);
  211. if (lastComparison != 0) {
  212. return lastComparison;
  213. }
  214. }
  215. return 0;
  216. }
  217. public _Fields fieldForId(int fieldId) {
  218. return _Fields.findByThriftId(fieldId);
  219. }
  220. public void read(TProtocol iprot) throws TException {
  221. TField field;
  222. iprot.readStructBegin();
  223. while (true)
  224. {
  225. field = iprot.readFieldBegin();
  226. if (field.type == TType.STOP) {
  227. break;
  228. }
  229. switch (field.id) {
  230. case 1: // PRIVILEGES
  231. if (field.type == TType.LIST) {
  232. {
  233. TList _list8 = iprot.readListBegin();
  234. this.privileges = new ArrayList<HiveObjectPrivilege>(_list8.size);
  235. for (int _i9 = 0; _i9 < _list8.size; ++_i9)
  236. {
  237. HiveObjectPrivilege _elem10;
  238. _elem10 = new HiveObjectPrivilege();
  239. _elem10.read(iprot);
  240. this.privileges.add(_elem10);
  241. }
  242. iprot.readListEnd();
  243. }
  244. } else {
  245. TProtocolUtil.skip(iprot, field.type);
  246. }
  247. break;
  248. default:
  249. TProtocolUtil.skip(iprot, field.type);
  250. }
  251. iprot.readFieldEnd();
  252. }
  253. iprot.readStructEnd();
  254. validate();
  255. }
  256. public void write(TProtocol oprot) throws TException {
  257. validate();
  258. oprot.writeStructBegin(STRUCT_DESC);
  259. if (this.privileges != null) {
  260. oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
  261. {
  262. oprot.writeListBegin(new TList(TType.STRUCT, this.privileges.size()));
  263. for (HiveObjectPrivilege _iter11 : this.privileges)
  264. {
  265. _iter11.write(oprot);
  266. }
  267. oprot.writeListEnd();
  268. }
  269. oprot.writeFieldEnd();
  270. }
  271. oprot.writeFieldStop();
  272. oprot.writeStructEnd();
  273. }
  274. @Override
  275. public String toString() {
  276. StringBuilder sb = new StringBuilder("PrivilegeBag(");
  277. boolean first = true;
  278. sb.append("privileges:");
  279. if (this.privileges == null) {
  280. sb.append("null");
  281. } else {
  282. sb.append(this.privileges);
  283. }
  284. first = false;
  285. sb.append(")");
  286. return sb.toString();
  287. }
  288. public void validate() throws TException {
  289. // check for required fields
  290. }
  291. }