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