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 / TSentryRole.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 TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryRole> {
39 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryRole");
40
41 private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)1);
42 private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", 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 TSentryRoleStandardSchemeFactory());
47 schemes.put(TupleScheme.class, new TSentryRoleTupleSchemeFactory());
48 }
49
50 private String roleName; // required
51 private Set<String> groups; // required
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 ROLE_NAME((short)1, "roleName"),
56 GROUPS((short)2, "groups");
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: // ROLE_NAME
72 return ROLE_NAME;
73 case 2: // GROUPS
74 return GROUPS;
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 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
116 static {
117 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
118 tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
119 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
120 tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
121 new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
122 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
123 metaDataMap = Collections.unmodifiableMap(tmpMap);
124 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryRole.class, metaDataMap);
125 }
126
127 public TSentryRole() {
128 }
129
130 public TSentryRole(
131 String roleName,
132 Set<String> groups)
133 {
134 this();
135 this.roleName = roleName;
136 this.groups = groups;
137 }
138
139 /**
140 * Performs a deep copy on <i>other</i>.
141 */
142 public TSentryRole(TSentryRole other) {
143 if (other.isSetRoleName()) {
144 this.roleName = other.roleName;
145 }
146 if (other.isSetGroups()) {
147 Set<String> __this__groups = new HashSet<String>(other.groups);
148 this.groups = __this__groups;
149 }
150 }
151
152 public TSentryRole deepCopy() {
153 return new TSentryRole(this);
154 }
155
156 @Override
157 public void clear() {
158 this.roleName = null;
159 this.groups = null;
160 }
161
162 public String getRoleName() {
163 return this.roleName;
164 }
165
166 public void setRoleName(String roleName) {
167 this.roleName = roleName;
168 }
169
170 public void unsetRoleName() {
171 this.roleName = null;
172 }
173
174 /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
175 public boolean isSetRoleName() {
176 return this.roleName != null;
177 }
178
179 public void setRoleNameIsSet(boolean value) {
180 if (!value) {
181 this.roleName = null;
182 }
183 }
184
185 public int getGroupsSize() {
186 return (this.groups == null) ? 0 : this.groups.size();
187 }
188
189 public java.util.Iterator<String> getGroupsIterator() {
190 return (this.groups == null) ? null : this.groups.iterator();
191 }
192
193 public void addToGroups(String elem) {
194 if (this.groups == null) {
195 this.groups = new HashSet<String>();
196 }
197 this.groups.add(elem);
198 }
199
200 public Set<String> getGroups() {
201 return this.groups;
202 }
203
204 public void setGroups(Set<String> groups) {
205 this.groups = groups;
206 }
207
208 public void unsetGroups() {
209 this.groups = null;
210 }
211
212 /** Returns true if field groups is set (has been assigned a value) and false otherwise */
213 public boolean isSetGroups() {
214 return this.groups != null;
215 }
216
217 public void setGroupsIsSet(boolean value) {
218 if (!value) {
219 this.groups = null;
220 }
221 }
222
223 public void setFieldValue(_Fields field, Object value) {
224 switch (field) {
225 case ROLE_NAME:
226 if (value == null) {
227 unsetRoleName();
228 } else {
229 setRoleName((String)value);
230 }
231 break;
232
233 case GROUPS:
234 if (value == null) {
235 unsetGroups();
236 } else {
237 setGroups((Set<String>)value);
238 }
239 break;
240
241 }
242 }
243
244 public Object getFieldValue(_Fields field) {
245 switch (field) {
246 case ROLE_NAME:
247 return getRoleName();
248
249 case GROUPS:
250 return getGroups();
251
252 }
253 throw new IllegalStateException();
254 }
255
256 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
257 public boolean isSet(_Fields field) {
258 if (field == null) {
259 throw new IllegalArgumentException();
260 }
261
262 switch (field) {
263 case ROLE_NAME:
264 return isSetRoleName();
265 case GROUPS:
266 return isSetGroups();
267 }
268 throw new IllegalStateException();
269 }
270
271 @Override
272 public boolean equals(Object that) {
273 if (that == null)
274 return false;
275 if (that instanceof TSentryRole)
276 return this.equals((TSentryRole)that);
277 return false;
278 }
279
280 public boolean equals(TSentryRole that) {
281 if (that == null)
282 return false;
283
284 boolean this_present_roleName = true && this.isSetRoleName();
285 boolean that_present_roleName = true && that.isSetRoleName();
286 if (this_present_roleName || that_present_roleName) {
287 if (!(this_present_roleName && that_present_roleName))
288 return false;
289 if (!this.roleName.equals(that.roleName))
290 return false;
291 }
292
293 boolean this_present_groups = true && this.isSetGroups();
294 boolean that_present_groups = true && that.isSetGroups();
295 if (this_present_groups || that_present_groups) {
296 if (!(this_present_groups && that_present_groups))
297 return false;
298 if (!this.groups.equals(that.groups))
299 return false;
300 }
301
302 return true;
303 }
304
305 @Override
306 public int hashCode() {
307 List<Object> list = new ArrayList<Object>();
308
309 boolean present_roleName = true && (isSetRoleName());
310 list.add(present_roleName);
311 if (present_roleName)
312 list.add(roleName);
313
314 boolean present_groups = true && (isSetGroups());
315 list.add(present_groups);
316 if (present_groups)
317 list.add(groups);
318
319 return list.hashCode();
320 }
321
322 @Override
323 public int compareTo(TSentryRole other) {
324 if (!getClass().equals(other.getClass())) {
325 return getClass().getName().compareTo(other.getClass().getName());
326 }
327
328 int lastComparison = 0;
329
330 lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
331 if (lastComparison != 0) {
332 return lastComparison;
333 }
334 if (isSetRoleName()) {
335 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
336 if (lastComparison != 0) {
337 return lastComparison;
338 }
339 }
340 lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
341 if (lastComparison != 0) {
342 return lastComparison;
343 }
344 if (isSetGroups()) {
345 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
346 if (lastComparison != 0) {
347 return lastComparison;
348 }
349 }
350 return 0;
351 }
352
353 public _Fields fieldForId(int fieldId) {
354 return _Fields.findByThriftId(fieldId);
355 }
356
357 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
358 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
359 }
360
361 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
362 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
363 }
364
365 @Override
366 public String toString() {
367 StringBuilder sb = new StringBuilder("TSentryRole(");
368 boolean first = true;
369
370 sb.append("roleName:");
371 if (this.roleName == null) {
372 sb.append("null");
373 } else {
374 sb.append(this.roleName);
375 }
376 first = false;
377 if (!first) sb.append(", ");
378 sb.append("groups:");
379 if (this.groups == null) {
380 sb.append("null");
381 } else {
382 sb.append(this.groups);
383 }
384 first = false;
385 sb.append(")");
386 return sb.toString();
387 }
388
389 public void validate() throws org.apache.thrift.TException {
390 // check for required fields
391 if (!isSetRoleName()) {
392 throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
393 }
394
395 if (!isSetGroups()) {
396 throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' 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 TSentryRoleStandardSchemeFactory implements SchemeFactory {
419 public TSentryRoleStandardScheme getScheme() {
420 return new TSentryRoleStandardScheme();
421 }
422 }
423
424 private static class TSentryRoleStandardScheme extends StandardScheme<TSentryRole> {
425
426 public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryRole 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: // ROLE_NAME
437 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
438 struct.roleName = iprot.readString();
439 struct.setRoleNameIsSet(true);
440 } else {
441 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
442 }
443 break;
444 case 2: // GROUPS
445 if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
446 {
447 org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
448 struct.groups = new HashSet<String>(2*_set24.size);
449 String _elem25;
450 for (int _i26 = 0; _i26 < _set24.size; ++_i26)
451 {
452 _elem25 = iprot.readString();
453 struct.groups.add(_elem25);
454 }
455 iprot.readSetEnd();
456 }
457 struct.setGroupsIsSet(true);
458 } else {
459 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
460 }
461 break;
462 default:
463 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
464 }
465 iprot.readFieldEnd();
466 }
467 iprot.readStructEnd();
468 struct.validate();
469 }
470
471 public void write(org.apache.thrift.protocol.TProtocol oprot, TSentryRole struct) throws org.apache.thrift.TException {
472 struct.validate();
473
474 oprot.writeStructBegin(STRUCT_DESC);
475 if (struct.roleName != null) {
476 oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
477 oprot.writeString(struct.roleName);
478 oprot.writeFieldEnd();
479 }
480 if (struct.groups != null) {
481 oprot.writeFieldBegin(GROUPS_FIELD_DESC);
482 {
483 oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
484 for (String _iter27 : struct.groups)
485 {
486 oprot.writeString(_iter27);
487 }
488 oprot.writeSetEnd();
489 }
490 oprot.writeFieldEnd();
491 }
492 oprot.writeFieldStop();
493 oprot.writeStructEnd();
494 }
495
496 }
497
498 private static class TSentryRoleTupleSchemeFactory implements SchemeFactory {
499 public TSentryRoleTupleScheme getScheme() {
500 return new TSentryRoleTupleScheme();
501 }
502 }
503
504 private static class TSentryRoleTupleScheme extends TupleScheme<TSentryRole> {
505
506 @Override
507 public void write(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
508 TTupleProtocol oprot = (TTupleProtocol) prot;
509 oprot.writeString(struct.roleName);
510 {
511 oprot.writeI32(struct.groups.size());
512 for (String _iter28 : struct.groups)
513 {
514 oprot.writeString(_iter28);
515 }
516 }
517 }
518
519 @Override
520 public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
521 TTupleProtocol iprot = (TTupleProtocol) prot;
522 struct.roleName = iprot.readString();
523 struct.setRoleNameIsSet(true);
524 {
525 org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
526 struct.groups = new HashSet<String>(2*_set29.size);
527 String _elem30;
528 for (int _i31 = 0; _i31 < _set29.size; ++_i31)
529 {
530 _elem30 = iprot.readString();
531 struct.groups.add(_elem30);
532 }
533 }
534 struct.setGroupsIsSet(true);
535 }
536 }
537
538 }
539