SENTRY-2192: supress date value in @Generated annotation generated by thrift.(Kalyan...
[sentry.git] / sentry-provider / sentry-provider-db / src / gen / thrift / gen-javabean / org / apache / sentry / provider / db / generic / service / thrift / TListSentryPrivilegesResponse.java
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 org.apache.sentry.provider.db.generic.service.thrift;
8
9 import org.apache.thrift.scheme.IScheme;
10 import org.apache.thrift.scheme.SchemeFactory;
11 import org.apache.thrift.scheme.StandardScheme;
12
13 import org.apache.thrift.scheme.TupleScheme;
14 import org.apache.thrift.protocol.TTupleProtocol;
15 import org.apache.thrift.protocol.TProtocolException;
16 import org.apache.thrift.EncodingUtils;
17 import org.apache.thrift.TException;
18 import org.apache.thrift.async.AsyncMethodCallback;
19 import org.apache.thrift.server.AbstractNonblockingServer.*;
20 import java.util.List;
21 import java.util.ArrayList;
22 import java.util.Map;
23 import java.util.HashMap;
24 import java.util.EnumMap;
25 import java.util.Set;
26 import java.util.HashSet;
27 import java.util.EnumSet;
28 import java.util.Collections;
29 import java.util.BitSet;
30 import java.nio.ByteBuffer;
31 import java.util.Arrays;
32 import javax.annotation.Generated;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
37 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
38 public class TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TListSentryPrivilegesResponse> {
39 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
40
41 private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
42 private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
43
44 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
45 static {
46 schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
47 schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
48 }
49
50 private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
51 private Set<TSentryPrivilege> privileges; // optional
52
53 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
54 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
55 STATUS((short)1, "status"),
56 PRIVILEGES((short)2, "privileges");
57
58 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
59
60 static {
61 for (_Fields field : EnumSet.allOf(_Fields.class)) {
62 byName.put(field.getFieldName(), field);
63 }
64 }
65
66 /**
67 * Find the _Fields constant that matches fieldId, or null if its not found.
68 */
69 public static _Fields findByThriftId(int fieldId) {
70 switch(fieldId) {
71 case 1: // STATUS
72 return STATUS;
73 case 2: // PRIVILEGES
74 return PRIVILEGES;
75 default:
76 return null;
77 }
78 }
79
80 /**
81 * Find the _Fields constant that matches fieldId, throwing an exception
82 * if it is not found.
83 */
84 public static _Fields findByThriftIdOrThrow(int fieldId) {
85 _Fields fields = findByThriftId(fieldId);
86 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
87 return fields;
88 }
89
90 /**
91 * Find the _Fields constant that matches name, or null if its not found.
92 */
93 public static _Fields findByName(String name) {
94 return byName.get(name);
95 }
96
97 private final short _thriftId;
98 private final String _fieldName;
99
100 _Fields(short thriftId, String fieldName) {
101 _thriftId = thriftId;
102 _fieldName = fieldName;
103 }
104
105 public short getThriftFieldId() {
106 return _thriftId;
107 }
108
109 public String getFieldName() {
110 return _fieldName;
111 }
112 }
113
114 // isset id assignments
115 private static final _Fields optionals[] = {_Fields.PRIVILEGES};
116 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
117 static {
118 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
119 tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
120 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "TSentryResponseStatus")));
121 tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
122 new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
123 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
124 metaDataMap = Collections.unmodifiableMap(tmpMap);
125 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
126 }
127
128 public TListSentryPrivilegesResponse() {
129 }
130
131 public TListSentryPrivilegesResponse(
132 org.apache.sentry.service.thrift.TSentryResponseStatus status)
133 {
134 this();
135 this.status = status;
136 }
137
138 /**
139 * Performs a deep copy on <i>other</i>.
140 */
141 public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
142 if (other.isSetStatus()) {
143 this.status = other.status;
144 }
145 if (other.isSetPrivileges()) {
146 Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
147 for (TSentryPrivilege other_element : other.privileges) {
148 __this__privileges.add(new TSentryPrivilege(other_element));
149 }
150 this.privileges = __this__privileges;
151 }
152 }
153
154 public TListSentryPrivilegesResponse deepCopy() {
155 return new TListSentryPrivilegesResponse(this);
156 }
157
158 @Override
159 public void clear() {
160 this.status = null;
161 this.privileges = null;
162 }
163
164 public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
165 return this.status;
166 }
167
168 public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
169 this.status = status;
170 }
171
172 public void unsetStatus() {
173 this.status = null;
174 }
175
176 /** Returns true if field status is set (has been assigned a value) and false otherwise */
177 public boolean isSetStatus() {
178 return this.status != null;
179 }
180
181 public void setStatusIsSet(boolean value) {
182 if (!value) {
183 this.status = null;
184 }
185 }
186
187 public int getPrivilegesSize() {
188 return (this.privileges == null) ? 0 : this.privileges.size();
189 }
190
191 public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
192 return (this.privileges == null) ? null : this.privileges.iterator();
193 }
194
195 public void addToPrivileges(TSentryPrivilege elem) {
196 if (this.privileges == null) {
197 this.privileges = new HashSet<TSentryPrivilege>();
198 }
199 this.privileges.add(elem);
200 }
201
202 public Set<TSentryPrivilege> getPrivileges() {
203 return this.privileges;
204 }
205
206 public void setPrivileges(Set<TSentryPrivilege> privileges) {
207 this.privileges = privileges;
208 }
209
210 public void unsetPrivileges() {
211 this.privileges = null;
212 }
213
214 /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
215 public boolean isSetPrivileges() {
216 return this.privileges != null;
217 }
218
219 public void setPrivilegesIsSet(boolean value) {
220 if (!value) {
221 this.privileges = null;
222 }
223 }
224
225 public void setFieldValue(_Fields field, Object value) {
226 switch (field) {
227 case STATUS:
228 if (value == null) {
229 unsetStatus();
230 } else {
231 setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
232 }
233 break;
234
235 case PRIVILEGES:
236 if (value == null) {
237 unsetPrivileges();
238 } else {
239 setPrivileges((Set<TSentryPrivilege>)value);
240 }
241 break;
242
243 }
244 }
245
246 public Object getFieldValue(_Fields field) {
247 switch (field) {
248 case STATUS:
249 return getStatus();
250
251 case PRIVILEGES:
252 return getPrivileges();
253
254 }
255 throw new IllegalStateException();
256 }
257
258 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
259 public boolean isSet(_Fields field) {
260 if (field == null) {
261 throw new IllegalArgumentException();
262 }
263
264 switch (field) {
265 case STATUS:
266 return isSetStatus();
267 case PRIVILEGES:
268 return isSetPrivileges();
269 }
270 throw new IllegalStateException();
271 }
272
273 @Override
274 public boolean equals(Object that) {
275 if (that == null)
276 return false;
277 if (that instanceof TListSentryPrivilegesResponse)
278 return this.equals((TListSentryPrivilegesResponse)that);
279 return false;
280 }
281
282 public boolean equals(TListSentryPrivilegesResponse that) {
283 if (that == null)
284 return false;
285
286 boolean this_present_status = true && this.isSetStatus();
287 boolean that_present_status = true && that.isSetStatus();
288 if (this_present_status || that_present_status) {
289 if (!(this_present_status && that_present_status))
290 return false;
291 if (!this.status.equals(that.status))
292 return false;
293 }
294
295 boolean this_present_privileges = true && this.isSetPrivileges();
296 boolean that_present_privileges = true && that.isSetPrivileges();
297 if (this_present_privileges || that_present_privileges) {
298 if (!(this_present_privileges && that_present_privileges))
299 return false;
300 if (!this.privileges.equals(that.privileges))
301 return false;
302 }
303
304 return true;
305 }
306
307 @Override
308 public int hashCode() {
309 List<Object> list = new ArrayList<Object>();
310
311 boolean present_status = true && (isSetStatus());
312 list.add(present_status);
313 if (present_status)
314 list.add(status);
315
316 boolean present_privileges = true && (isSetPrivileges());
317 list.add(present_privileges);
318 if (present_privileges)
319 list.add(privileges);
320
321 return list.hashCode();
322 }
323
324 @Override
325 public int compareTo(TListSentryPrivilegesResponse other) {
326 if (!getClass().equals(other.getClass())) {
327 return getClass().getName().compareTo(other.getClass().getName());
328 }
329
330 int lastComparison = 0;
331
332 lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
333 if (lastComparison != 0) {
334 return lastComparison;
335 }
336 if (isSetStatus()) {
337 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
338 if (lastComparison != 0) {
339 return lastComparison;
340 }
341 }
342 lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(other.isSetPrivileges());
343 if (lastComparison != 0) {
344 return lastComparison;
345 }
346 if (isSetPrivileges()) {
347 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
348 if (lastComparison != 0) {
349 return lastComparison;
350 }
351 }
352 return 0;
353 }
354
355 public _Fields fieldForId(int fieldId) {
356 return _Fields.findByThriftId(fieldId);
357 }
358
359 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
360 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
361 }
362
363 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
364 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
365 }
366
367 @Override
368 public String toString() {
369 StringBuilder sb = new StringBuilder("TListSentryPrivilegesResponse(");
370 boolean first = true;
371
372 sb.append("status:");
373 if (this.status == null) {
374 sb.append("null");
375 } else {
376 sb.append(this.status);
377 }
378 first = false;
379 if (isSetPrivileges()) {
380 if (!first) sb.append(", ");
381 sb.append("privileges:");
382 if (this.privileges == null) {
383 sb.append("null");
384 } else {
385 sb.append(this.privileges);
386 }
387 first = false;
388 }
389 sb.append(")");
390 return sb.toString();
391 }
392
393 public void validate() throws org.apache.thrift.TException {
394 // check for required fields
395 if (!isSetStatus()) {
396 throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
397 }
398
399 // check for sub-struct validity
400 }
401
402 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
403 try {
404 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
405 } catch (org.apache.thrift.TException te) {
406 throw new java.io.IOException(te);
407 }
408 }
409
410 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
411 try {
412 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
413 } catch (org.apache.thrift.TException te) {
414 throw new java.io.IOException(te);
415 }
416 }
417
418 private static class TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
419 public TListSentryPrivilegesResponseStandardScheme getScheme() {
420 return new TListSentryPrivilegesResponseStandardScheme();
421 }
422 }
423
424 private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
425
426 public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
427 org.apache.thrift.protocol.TField schemeField;
428 iprot.readStructBegin();
429 while (true)
430 {
431 schemeField = iprot.readFieldBegin();
432 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
433 break;
434 }
435 switch (schemeField.id) {
436 case 1: // STATUS
437 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
438 struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
439 struct.status.read(iprot);
440 struct.setStatusIsSet(true);
441 } else {
442 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
443 }
444 break;
445 case 2: // PRIVILEGES
446 if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
447 {
448 org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
449 struct.privileges = new HashSet<TSentryPrivilege>(2*_set48.size);
450 TSentryPrivilege _elem49;
451 for (int _i50 = 0; _i50 < _set48.size; ++_i50)
452 {
453 _elem49 = new TSentryPrivilege();
454 _elem49.read(iprot);
455 struct.privileges.add(_elem49);
456 }
457 iprot.readSetEnd();
458 }
459 struct.setPrivilegesIsSet(true);
460 } else {
461 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
462 }
463 break;
464 default:
465 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
466 }
467 iprot.readFieldEnd();
468 }
469 iprot.readStructEnd();
470 struct.validate();
471 }
472
473 public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
474 struct.validate();
475
476 oprot.writeStructBegin(STRUCT_DESC);
477 if (struct.status != null) {
478 oprot.writeFieldBegin(STATUS_FIELD_DESC);
479 struct.status.write(oprot);
480 oprot.writeFieldEnd();
481 }
482 if (struct.privileges != null) {
483 if (struct.isSetPrivileges()) {
484 oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
485 {
486 oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
487 for (TSentryPrivilege _iter51 : struct.privileges)
488 {
489 _iter51.write(oprot);
490 }
491 oprot.writeSetEnd();
492 }
493 oprot.writeFieldEnd();
494 }
495 }
496 oprot.writeFieldStop();
497 oprot.writeStructEnd();
498 }
499
500 }
501
502 private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
503 public TListSentryPrivilegesResponseTupleScheme getScheme() {
504 return new TListSentryPrivilegesResponseTupleScheme();
505 }
506 }
507
508 private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
509
510 @Override
511 public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
512 TTupleProtocol oprot = (TTupleProtocol) prot;
513 struct.status.write(oprot);
514 BitSet optionals = new BitSet();
515 if (struct.isSetPrivileges()) {
516 optionals.set(0);
517 }
518 oprot.writeBitSet(optionals, 1);
519 if (struct.isSetPrivileges()) {
520 {
521 oprot.writeI32(struct.privileges.size());
522 for (TSentryPrivilege _iter52 : struct.privileges)
523 {
524 _iter52.write(oprot);
525 }
526 }
527 }
528 }
529
530 @Override
531 public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
532 TTupleProtocol iprot = (TTupleProtocol) prot;
533 struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
534 struct.status.read(iprot);
535 struct.setStatusIsSet(true);
536 BitSet incoming = iprot.readBitSet(1);
537 if (incoming.get(0)) {
538 {
539 org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
540 struct.privileges = new HashSet<TSentryPrivilege>(2*_set53.size);
541 TSentryPrivilege _elem54;
542 for (int _i55 = 0; _i55 < _set53.size; ++_i55)
543 {
544 _elem54 = new TSentryPrivilege();
545 _elem54.read(iprot);
546 struct.privileges.add(_elem54);
547 }
548 }
549 struct.setPrivilegesIsSet(true);
550 }
551 }
552 }
553
554 }
555