PageRenderTime 49ms CodeModel.GetById 14ms app.highlight 30ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/HiveObjectRef.java

#
Java | 707 lines | 583 code | 85 blank | 39 comment | 159 complexity | 27596cefee35a8ad803e5ce999694f88 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 HiveObjectRef implements TBase<HiveObjectRef, HiveObjectRef._Fields>, java.io.Serializable, Cloneable {
 30  private static final TStruct STRUCT_DESC = new TStruct("HiveObjectRef");
 31
 32  private static final TField OBJECT_TYPE_FIELD_DESC = new TField("objectType", TType.I32, (short)1);
 33  private static final TField DB_NAME_FIELD_DESC = new TField("dbName", TType.STRING, (short)2);
 34  private static final TField OBJECT_NAME_FIELD_DESC = new TField("objectName", TType.STRING, (short)3);
 35  private static final TField PART_VALUES_FIELD_DESC = new TField("partValues", TType.LIST, (short)4);
 36  private static final TField COLUMN_NAME_FIELD_DESC = new TField("columnName", TType.STRING, (short)5);
 37
 38  private HiveObjectType objectType;
 39  private String dbName;
 40  private String objectName;
 41  private List<String> partValues;
 42  private String columnName;
 43
 44  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
 45  public enum _Fields implements TFieldIdEnum {
 46    /**
 47     * 
 48     * @see HiveObjectType
 49     */
 50    OBJECT_TYPE((short)1, "objectType"),
 51    DB_NAME((short)2, "dbName"),
 52    OBJECT_NAME((short)3, "objectName"),
 53    PART_VALUES((short)4, "partValues"),
 54    COLUMN_NAME((short)5, "columnName");
 55
 56    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 57
 58    static {
 59      for (_Fields field : EnumSet.allOf(_Fields.class)) {
 60        byName.put(field.getFieldName(), field);
 61      }
 62    }
 63
 64    /**
 65     * Find the _Fields constant that matches fieldId, or null if its not found.
 66     */
 67    public static _Fields findByThriftId(int fieldId) {
 68      switch(fieldId) {
 69        case 1: // OBJECT_TYPE
 70          return OBJECT_TYPE;
 71        case 2: // DB_NAME
 72          return DB_NAME;
 73        case 3: // OBJECT_NAME
 74          return OBJECT_NAME;
 75        case 4: // PART_VALUES
 76          return PART_VALUES;
 77        case 5: // COLUMN_NAME
 78          return COLUMN_NAME;
 79        default:
 80          return null;
 81      }
 82    }
 83
 84    /**
 85     * Find the _Fields constant that matches fieldId, throwing an exception
 86     * if it is not found.
 87     */
 88    public static _Fields findByThriftIdOrThrow(int fieldId) {
 89      _Fields fields = findByThriftId(fieldId);
 90      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
 91      return fields;
 92    }
 93
 94    /**
 95     * Find the _Fields constant that matches name, or null if its not found.
 96     */
 97    public static _Fields findByName(String name) {
 98      return byName.get(name);
 99    }
100
101    private final short _thriftId;
102    private final String _fieldName;
103
104    _Fields(short thriftId, String fieldName) {
105      _thriftId = thriftId;
106      _fieldName = fieldName;
107    }
108
109    public short getThriftFieldId() {
110      return _thriftId;
111    }
112
113    public String getFieldName() {
114      return _fieldName;
115    }
116  }
117
118  // isset id assignments
119
120  public static final Map<_Fields, FieldMetaData> metaDataMap;
121  static {
122    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
123    tmpMap.put(_Fields.OBJECT_TYPE, new FieldMetaData("objectType", TFieldRequirementType.DEFAULT, 
124        new EnumMetaData(TType.ENUM, HiveObjectType.class)));
125    tmpMap.put(_Fields.DB_NAME, new FieldMetaData("dbName", TFieldRequirementType.DEFAULT, 
126        new FieldValueMetaData(TType.STRING)));
127    tmpMap.put(_Fields.OBJECT_NAME, new FieldMetaData("objectName", TFieldRequirementType.DEFAULT, 
128        new FieldValueMetaData(TType.STRING)));
129    tmpMap.put(_Fields.PART_VALUES, new FieldMetaData("partValues", TFieldRequirementType.DEFAULT, 
130        new ListMetaData(TType.LIST, 
131            new FieldValueMetaData(TType.STRING))));
132    tmpMap.put(_Fields.COLUMN_NAME, new FieldMetaData("columnName", TFieldRequirementType.DEFAULT, 
133        new FieldValueMetaData(TType.STRING)));
134    metaDataMap = Collections.unmodifiableMap(tmpMap);
135    FieldMetaData.addStructMetaDataMap(HiveObjectRef.class, metaDataMap);
136  }
137
138  public HiveObjectRef() {
139  }
140
141  public HiveObjectRef(
142    HiveObjectType objectType,
143    String dbName,
144    String objectName,
145    List<String> partValues,
146    String columnName)
147  {
148    this();
149    this.objectType = objectType;
150    this.dbName = dbName;
151    this.objectName = objectName;
152    this.partValues = partValues;
153    this.columnName = columnName;
154  }
155
156  /**
157   * Performs a deep copy on <i>other</i>.
158   */
159  public HiveObjectRef(HiveObjectRef other) {
160    if (other.isSetObjectType()) {
161      this.objectType = other.objectType;
162    }
163    if (other.isSetDbName()) {
164      this.dbName = other.dbName;
165    }
166    if (other.isSetObjectName()) {
167      this.objectName = other.objectName;
168    }
169    if (other.isSetPartValues()) {
170      List<String> __this__partValues = new ArrayList<String>();
171      for (String other_element : other.partValues) {
172        __this__partValues.add(other_element);
173      }
174      this.partValues = __this__partValues;
175    }
176    if (other.isSetColumnName()) {
177      this.columnName = other.columnName;
178    }
179  }
180
181  public HiveObjectRef deepCopy() {
182    return new HiveObjectRef(this);
183  }
184
185  @Override
186  public void clear() {
187    this.objectType = null;
188    this.dbName = null;
189    this.objectName = null;
190    this.partValues = null;
191    this.columnName = null;
192  }
193
194  /**
195   * 
196   * @see HiveObjectType
197   */
198  public HiveObjectType getObjectType() {
199    return this.objectType;
200  }
201
202  /**
203   * 
204   * @see HiveObjectType
205   */
206  public void setObjectType(HiveObjectType objectType) {
207    this.objectType = objectType;
208  }
209
210  public void unsetObjectType() {
211    this.objectType = null;
212  }
213
214  /** Returns true if field objectType is set (has been asigned a value) and false otherwise */
215  public boolean isSetObjectType() {
216    return this.objectType != null;
217  }
218
219  public void setObjectTypeIsSet(boolean value) {
220    if (!value) {
221      this.objectType = null;
222    }
223  }
224
225  public String getDbName() {
226    return this.dbName;
227  }
228
229  public void setDbName(String dbName) {
230    this.dbName = dbName;
231  }
232
233  public void unsetDbName() {
234    this.dbName = null;
235  }
236
237  /** Returns true if field dbName is set (has been asigned a value) and false otherwise */
238  public boolean isSetDbName() {
239    return this.dbName != null;
240  }
241
242  public void setDbNameIsSet(boolean value) {
243    if (!value) {
244      this.dbName = null;
245    }
246  }
247
248  public String getObjectName() {
249    return this.objectName;
250  }
251
252  public void setObjectName(String objectName) {
253    this.objectName = objectName;
254  }
255
256  public void unsetObjectName() {
257    this.objectName = null;
258  }
259
260  /** Returns true if field objectName is set (has been asigned a value) and false otherwise */
261  public boolean isSetObjectName() {
262    return this.objectName != null;
263  }
264
265  public void setObjectNameIsSet(boolean value) {
266    if (!value) {
267      this.objectName = null;
268    }
269  }
270
271  public int getPartValuesSize() {
272    return (this.partValues == null) ? 0 : this.partValues.size();
273  }
274
275  public java.util.Iterator<String> getPartValuesIterator() {
276    return (this.partValues == null) ? null : this.partValues.iterator();
277  }
278
279  public void addToPartValues(String elem) {
280    if (this.partValues == null) {
281      this.partValues = new ArrayList<String>();
282    }
283    this.partValues.add(elem);
284  }
285
286  public List<String> getPartValues() {
287    return this.partValues;
288  }
289
290  public void setPartValues(List<String> partValues) {
291    this.partValues = partValues;
292  }
293
294  public void unsetPartValues() {
295    this.partValues = null;
296  }
297
298  /** Returns true if field partValues is set (has been asigned a value) and false otherwise */
299  public boolean isSetPartValues() {
300    return this.partValues != null;
301  }
302
303  public void setPartValuesIsSet(boolean value) {
304    if (!value) {
305      this.partValues = null;
306    }
307  }
308
309  public String getColumnName() {
310    return this.columnName;
311  }
312
313  public void setColumnName(String columnName) {
314    this.columnName = columnName;
315  }
316
317  public void unsetColumnName() {
318    this.columnName = null;
319  }
320
321  /** Returns true if field columnName is set (has been asigned a value) and false otherwise */
322  public boolean isSetColumnName() {
323    return this.columnName != null;
324  }
325
326  public void setColumnNameIsSet(boolean value) {
327    if (!value) {
328      this.columnName = null;
329    }
330  }
331
332  public void setFieldValue(_Fields field, Object value) {
333    switch (field) {
334    case OBJECT_TYPE:
335      if (value == null) {
336        unsetObjectType();
337      } else {
338        setObjectType((HiveObjectType)value);
339      }
340      break;
341
342    case DB_NAME:
343      if (value == null) {
344        unsetDbName();
345      } else {
346        setDbName((String)value);
347      }
348      break;
349
350    case OBJECT_NAME:
351      if (value == null) {
352        unsetObjectName();
353      } else {
354        setObjectName((String)value);
355      }
356      break;
357
358    case PART_VALUES:
359      if (value == null) {
360        unsetPartValues();
361      } else {
362        setPartValues((List<String>)value);
363      }
364      break;
365
366    case COLUMN_NAME:
367      if (value == null) {
368        unsetColumnName();
369      } else {
370        setColumnName((String)value);
371      }
372      break;
373
374    }
375  }
376
377  public Object getFieldValue(_Fields field) {
378    switch (field) {
379    case OBJECT_TYPE:
380      return getObjectType();
381
382    case DB_NAME:
383      return getDbName();
384
385    case OBJECT_NAME:
386      return getObjectName();
387
388    case PART_VALUES:
389      return getPartValues();
390
391    case COLUMN_NAME:
392      return getColumnName();
393
394    }
395    throw new IllegalStateException();
396  }
397
398  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
399  public boolean isSet(_Fields field) {
400    if (field == null) {
401      throw new IllegalArgumentException();
402    }
403
404    switch (field) {
405    case OBJECT_TYPE:
406      return isSetObjectType();
407    case DB_NAME:
408      return isSetDbName();
409    case OBJECT_NAME:
410      return isSetObjectName();
411    case PART_VALUES:
412      return isSetPartValues();
413    case COLUMN_NAME:
414      return isSetColumnName();
415    }
416    throw new IllegalStateException();
417  }
418
419  @Override
420  public boolean equals(Object that) {
421    if (that == null)
422      return false;
423    if (that instanceof HiveObjectRef)
424      return this.equals((HiveObjectRef)that);
425    return false;
426  }
427
428  public boolean equals(HiveObjectRef that) {
429    if (that == null)
430      return false;
431
432    boolean this_present_objectType = true && this.isSetObjectType();
433    boolean that_present_objectType = true && that.isSetObjectType();
434    if (this_present_objectType || that_present_objectType) {
435      if (!(this_present_objectType && that_present_objectType))
436        return false;
437      if (!this.objectType.equals(that.objectType))
438        return false;
439    }
440
441    boolean this_present_dbName = true && this.isSetDbName();
442    boolean that_present_dbName = true && that.isSetDbName();
443    if (this_present_dbName || that_present_dbName) {
444      if (!(this_present_dbName && that_present_dbName))
445        return false;
446      if (!this.dbName.equals(that.dbName))
447        return false;
448    }
449
450    boolean this_present_objectName = true && this.isSetObjectName();
451    boolean that_present_objectName = true && that.isSetObjectName();
452    if (this_present_objectName || that_present_objectName) {
453      if (!(this_present_objectName && that_present_objectName))
454        return false;
455      if (!this.objectName.equals(that.objectName))
456        return false;
457    }
458
459    boolean this_present_partValues = true && this.isSetPartValues();
460    boolean that_present_partValues = true && that.isSetPartValues();
461    if (this_present_partValues || that_present_partValues) {
462      if (!(this_present_partValues && that_present_partValues))
463        return false;
464      if (!this.partValues.equals(that.partValues))
465        return false;
466    }
467
468    boolean this_present_columnName = true && this.isSetColumnName();
469    boolean that_present_columnName = true && that.isSetColumnName();
470    if (this_present_columnName || that_present_columnName) {
471      if (!(this_present_columnName && that_present_columnName))
472        return false;
473      if (!this.columnName.equals(that.columnName))
474        return false;
475    }
476
477    return true;
478  }
479
480  @Override
481  public int hashCode() {
482    return 0;
483  }
484
485  public int compareTo(HiveObjectRef other) {
486    if (!getClass().equals(other.getClass())) {
487      return getClass().getName().compareTo(other.getClass().getName());
488    }
489
490    int lastComparison = 0;
491    HiveObjectRef typedOther = (HiveObjectRef)other;
492
493    lastComparison = Boolean.valueOf(isSetObjectType()).compareTo(typedOther.isSetObjectType());
494    if (lastComparison != 0) {
495      return lastComparison;
496    }
497    if (isSetObjectType()) {
498      lastComparison = TBaseHelper.compareTo(this.objectType, typedOther.objectType);
499      if (lastComparison != 0) {
500        return lastComparison;
501      }
502    }
503    lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
504    if (lastComparison != 0) {
505      return lastComparison;
506    }
507    if (isSetDbName()) {
508      lastComparison = TBaseHelper.compareTo(this.dbName, typedOther.dbName);
509      if (lastComparison != 0) {
510        return lastComparison;
511      }
512    }
513    lastComparison = Boolean.valueOf(isSetObjectName()).compareTo(typedOther.isSetObjectName());
514    if (lastComparison != 0) {
515      return lastComparison;
516    }
517    if (isSetObjectName()) {
518      lastComparison = TBaseHelper.compareTo(this.objectName, typedOther.objectName);
519      if (lastComparison != 0) {
520        return lastComparison;
521      }
522    }
523    lastComparison = Boolean.valueOf(isSetPartValues()).compareTo(typedOther.isSetPartValues());
524    if (lastComparison != 0) {
525      return lastComparison;
526    }
527    if (isSetPartValues()) {
528      lastComparison = TBaseHelper.compareTo(this.partValues, typedOther.partValues);
529      if (lastComparison != 0) {
530        return lastComparison;
531      }
532    }
533    lastComparison = Boolean.valueOf(isSetColumnName()).compareTo(typedOther.isSetColumnName());
534    if (lastComparison != 0) {
535      return lastComparison;
536    }
537    if (isSetColumnName()) {
538      lastComparison = TBaseHelper.compareTo(this.columnName, typedOther.columnName);
539      if (lastComparison != 0) {
540        return lastComparison;
541      }
542    }
543    return 0;
544  }
545
546  public _Fields fieldForId(int fieldId) {
547    return _Fields.findByThriftId(fieldId);
548  }
549
550  public void read(TProtocol iprot) throws TException {
551    TField field;
552    iprot.readStructBegin();
553    while (true)
554    {
555      field = iprot.readFieldBegin();
556      if (field.type == TType.STOP) { 
557        break;
558      }
559      switch (field.id) {
560        case 1: // OBJECT_TYPE
561          if (field.type == TType.I32) {
562            this.objectType = HiveObjectType.findByValue(iprot.readI32());
563          } else { 
564            TProtocolUtil.skip(iprot, field.type);
565          }
566          break;
567        case 2: // DB_NAME
568          if (field.type == TType.STRING) {
569            this.dbName = iprot.readString();
570          } else { 
571            TProtocolUtil.skip(iprot, field.type);
572          }
573          break;
574        case 3: // OBJECT_NAME
575          if (field.type == TType.STRING) {
576            this.objectName = iprot.readString();
577          } else { 
578            TProtocolUtil.skip(iprot, field.type);
579          }
580          break;
581        case 4: // PART_VALUES
582          if (field.type == TType.LIST) {
583            {
584              TList _list4 = iprot.readListBegin();
585              this.partValues = new ArrayList<String>(_list4.size);
586              for (int _i5 = 0; _i5 < _list4.size; ++_i5)
587              {
588                String _elem6;
589                _elem6 = iprot.readString();
590                this.partValues.add(_elem6);
591              }
592              iprot.readListEnd();
593            }
594          } else { 
595            TProtocolUtil.skip(iprot, field.type);
596          }
597          break;
598        case 5: // COLUMN_NAME
599          if (field.type == TType.STRING) {
600            this.columnName = iprot.readString();
601          } else { 
602            TProtocolUtil.skip(iprot, field.type);
603          }
604          break;
605        default:
606          TProtocolUtil.skip(iprot, field.type);
607      }
608      iprot.readFieldEnd();
609    }
610    iprot.readStructEnd();
611    validate();
612  }
613
614  public void write(TProtocol oprot) throws TException {
615    validate();
616
617    oprot.writeStructBegin(STRUCT_DESC);
618    if (this.objectType != null) {
619      oprot.writeFieldBegin(OBJECT_TYPE_FIELD_DESC);
620      oprot.writeI32(this.objectType.getValue());
621      oprot.writeFieldEnd();
622    }
623    if (this.dbName != null) {
624      oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
625      oprot.writeString(this.dbName);
626      oprot.writeFieldEnd();
627    }
628    if (this.objectName != null) {
629      oprot.writeFieldBegin(OBJECT_NAME_FIELD_DESC);
630      oprot.writeString(this.objectName);
631      oprot.writeFieldEnd();
632    }
633    if (this.partValues != null) {
634      oprot.writeFieldBegin(PART_VALUES_FIELD_DESC);
635      {
636        oprot.writeListBegin(new TList(TType.STRING, this.partValues.size()));
637        for (String _iter7 : this.partValues)
638        {
639          oprot.writeString(_iter7);
640        }
641        oprot.writeListEnd();
642      }
643      oprot.writeFieldEnd();
644    }
645    if (this.columnName != null) {
646      oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
647      oprot.writeString(this.columnName);
648      oprot.writeFieldEnd();
649    }
650    oprot.writeFieldStop();
651    oprot.writeStructEnd();
652  }
653
654  @Override
655  public String toString() {
656    StringBuilder sb = new StringBuilder("HiveObjectRef(");
657    boolean first = true;
658
659    sb.append("objectType:");
660    if (this.objectType == null) {
661      sb.append("null");
662    } else {
663      sb.append(this.objectType);
664    }
665    first = false;
666    if (!first) sb.append(", ");
667    sb.append("dbName:");
668    if (this.dbName == null) {
669      sb.append("null");
670    } else {
671      sb.append(this.dbName);
672    }
673    first = false;
674    if (!first) sb.append(", ");
675    sb.append("objectName:");
676    if (this.objectName == null) {
677      sb.append("null");
678    } else {
679      sb.append(this.objectName);
680    }
681    first = false;
682    if (!first) sb.append(", ");
683    sb.append("partValues:");
684    if (this.partValues == null) {
685      sb.append("null");
686    } else {
687      sb.append(this.partValues);
688    }
689    first = false;
690    if (!first) sb.append(", ");
691    sb.append("columnName:");
692    if (this.columnName == null) {
693      sb.append("null");
694    } else {
695      sb.append(this.columnName);
696    }
697    first = false;
698    sb.append(")");
699    return sb.toString();
700  }
701
702  public void validate() throws TException {
703    // check for required fields
704  }
705
706}
707