PageRenderTime 36ms CodeModel.GetById 14ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 1ms

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

#
Java | 392 lines | 310 code | 58 blank | 24 comment | 62 complexity | cfb8f364e1b53cdb85367f238e34bedb 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 Order implements TBase<Order, Order._Fields>, java.io.Serializable, Cloneable {
 30  private static final TStruct STRUCT_DESC = new TStruct("Order");
 31
 32  private static final TField COL_FIELD_DESC = new TField("col", TType.STRING, (short)1);
 33  private static final TField ORDER_FIELD_DESC = new TField("order", TType.I32, (short)2);
 34
 35  private String col;
 36  private int order;
 37
 38  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
 39  public enum _Fields implements TFieldIdEnum {
 40    COL((short)1, "col"),
 41    ORDER((short)2, "order");
 42
 43    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 44
 45    static {
 46      for (_Fields field : EnumSet.allOf(_Fields.class)) {
 47        byName.put(field.getFieldName(), field);
 48      }
 49    }
 50
 51    /**
 52     * Find the _Fields constant that matches fieldId, or null if its not found.
 53     */
 54    public static _Fields findByThriftId(int fieldId) {
 55      switch(fieldId) {
 56        case 1: // COL
 57          return COL;
 58        case 2: // ORDER
 59          return ORDER;
 60        default:
 61          return null;
 62      }
 63    }
 64
 65    /**
 66     * Find the _Fields constant that matches fieldId, throwing an exception
 67     * if it is not found.
 68     */
 69    public static _Fields findByThriftIdOrThrow(int fieldId) {
 70      _Fields fields = findByThriftId(fieldId);
 71      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
 72      return fields;
 73    }
 74
 75    /**
 76     * Find the _Fields constant that matches name, or null if its not found.
 77     */
 78    public static _Fields findByName(String name) {
 79      return byName.get(name);
 80    }
 81
 82    private final short _thriftId;
 83    private final String _fieldName;
 84
 85    _Fields(short thriftId, String fieldName) {
 86      _thriftId = thriftId;
 87      _fieldName = fieldName;
 88    }
 89
 90    public short getThriftFieldId() {
 91      return _thriftId;
 92    }
 93
 94    public String getFieldName() {
 95      return _fieldName;
 96    }
 97  }
 98
 99  // isset id assignments
100  private static final int __ORDER_ISSET_ID = 0;
101  private BitSet __isset_bit_vector = new BitSet(1);
102
103  public static final Map<_Fields, FieldMetaData> metaDataMap;
104  static {
105    Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
106    tmpMap.put(_Fields.COL, new FieldMetaData("col", TFieldRequirementType.DEFAULT, 
107        new FieldValueMetaData(TType.STRING)));
108    tmpMap.put(_Fields.ORDER, new FieldMetaData("order", TFieldRequirementType.DEFAULT, 
109        new FieldValueMetaData(TType.I32)));
110    metaDataMap = Collections.unmodifiableMap(tmpMap);
111    FieldMetaData.addStructMetaDataMap(Order.class, metaDataMap);
112  }
113
114  public Order() {
115  }
116
117  public Order(
118    String col,
119    int order)
120  {
121    this();
122    this.col = col;
123    this.order = order;
124    setOrderIsSet(true);
125  }
126
127  /**
128   * Performs a deep copy on <i>other</i>.
129   */
130  public Order(Order other) {
131    __isset_bit_vector.clear();
132    __isset_bit_vector.or(other.__isset_bit_vector);
133    if (other.isSetCol()) {
134      this.col = other.col;
135    }
136    this.order = other.order;
137  }
138
139  public Order deepCopy() {
140    return new Order(this);
141  }
142
143  @Override
144  public void clear() {
145    this.col = null;
146    setOrderIsSet(false);
147    this.order = 0;
148  }
149
150  public String getCol() {
151    return this.col;
152  }
153
154  public void setCol(String col) {
155    this.col = col;
156  }
157
158  public void unsetCol() {
159    this.col = null;
160  }
161
162  /** Returns true if field col is set (has been asigned a value) and false otherwise */
163  public boolean isSetCol() {
164    return this.col != null;
165  }
166
167  public void setColIsSet(boolean value) {
168    if (!value) {
169      this.col = null;
170    }
171  }
172
173  public int getOrder() {
174    return this.order;
175  }
176
177  public void setOrder(int order) {
178    this.order = order;
179    setOrderIsSet(true);
180  }
181
182  public void unsetOrder() {
183    __isset_bit_vector.clear(__ORDER_ISSET_ID);
184  }
185
186  /** Returns true if field order is set (has been asigned a value) and false otherwise */
187  public boolean isSetOrder() {
188    return __isset_bit_vector.get(__ORDER_ISSET_ID);
189  }
190
191  public void setOrderIsSet(boolean value) {
192    __isset_bit_vector.set(__ORDER_ISSET_ID, value);
193  }
194
195  public void setFieldValue(_Fields field, Object value) {
196    switch (field) {
197    case COL:
198      if (value == null) {
199        unsetCol();
200      } else {
201        setCol((String)value);
202      }
203      break;
204
205    case ORDER:
206      if (value == null) {
207        unsetOrder();
208      } else {
209        setOrder((Integer)value);
210      }
211      break;
212
213    }
214  }
215
216  public Object getFieldValue(_Fields field) {
217    switch (field) {
218    case COL:
219      return getCol();
220
221    case ORDER:
222      return new Integer(getOrder());
223
224    }
225    throw new IllegalStateException();
226  }
227
228  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
229  public boolean isSet(_Fields field) {
230    if (field == null) {
231      throw new IllegalArgumentException();
232    }
233
234    switch (field) {
235    case COL:
236      return isSetCol();
237    case ORDER:
238      return isSetOrder();
239    }
240    throw new IllegalStateException();
241  }
242
243  @Override
244  public boolean equals(Object that) {
245    if (that == null)
246      return false;
247    if (that instanceof Order)
248      return this.equals((Order)that);
249    return false;
250  }
251
252  public boolean equals(Order that) {
253    if (that == null)
254      return false;
255
256    boolean this_present_col = true && this.isSetCol();
257    boolean that_present_col = true && that.isSetCol();
258    if (this_present_col || that_present_col) {
259      if (!(this_present_col && that_present_col))
260        return false;
261      if (!this.col.equals(that.col))
262        return false;
263    }
264
265    boolean this_present_order = true;
266    boolean that_present_order = true;
267    if (this_present_order || that_present_order) {
268      if (!(this_present_order && that_present_order))
269        return false;
270      if (this.order != that.order)
271        return false;
272    }
273
274    return true;
275  }
276
277  @Override
278  public int hashCode() {
279    return 0;
280  }
281
282  public int compareTo(Order other) {
283    if (!getClass().equals(other.getClass())) {
284      return getClass().getName().compareTo(other.getClass().getName());
285    }
286
287    int lastComparison = 0;
288    Order typedOther = (Order)other;
289
290    lastComparison = Boolean.valueOf(isSetCol()).compareTo(typedOther.isSetCol());
291    if (lastComparison != 0) {
292      return lastComparison;
293    }
294    if (isSetCol()) {
295      lastComparison = TBaseHelper.compareTo(this.col, typedOther.col);
296      if (lastComparison != 0) {
297        return lastComparison;
298      }
299    }
300    lastComparison = Boolean.valueOf(isSetOrder()).compareTo(typedOther.isSetOrder());
301    if (lastComparison != 0) {
302      return lastComparison;
303    }
304    if (isSetOrder()) {
305      lastComparison = TBaseHelper.compareTo(this.order, typedOther.order);
306      if (lastComparison != 0) {
307        return lastComparison;
308      }
309    }
310    return 0;
311  }
312
313  public _Fields fieldForId(int fieldId) {
314    return _Fields.findByThriftId(fieldId);
315  }
316
317  public void read(TProtocol iprot) throws TException {
318    TField field;
319    iprot.readStructBegin();
320    while (true)
321    {
322      field = iprot.readFieldBegin();
323      if (field.type == TType.STOP) { 
324        break;
325      }
326      switch (field.id) {
327        case 1: // COL
328          if (field.type == TType.STRING) {
329            this.col = iprot.readString();
330          } else { 
331            TProtocolUtil.skip(iprot, field.type);
332          }
333          break;
334        case 2: // ORDER
335          if (field.type == TType.I32) {
336            this.order = iprot.readI32();
337            setOrderIsSet(true);
338          } else { 
339            TProtocolUtil.skip(iprot, field.type);
340          }
341          break;
342        default:
343          TProtocolUtil.skip(iprot, field.type);
344      }
345      iprot.readFieldEnd();
346    }
347    iprot.readStructEnd();
348    validate();
349  }
350
351  public void write(TProtocol oprot) throws TException {
352    validate();
353
354    oprot.writeStructBegin(STRUCT_DESC);
355    if (this.col != null) {
356      oprot.writeFieldBegin(COL_FIELD_DESC);
357      oprot.writeString(this.col);
358      oprot.writeFieldEnd();
359    }
360    oprot.writeFieldBegin(ORDER_FIELD_DESC);
361    oprot.writeI32(this.order);
362    oprot.writeFieldEnd();
363    oprot.writeFieldStop();
364    oprot.writeStructEnd();
365  }
366
367  @Override
368  public String toString() {
369    StringBuilder sb = new StringBuilder("Order(");
370    boolean first = true;
371
372    sb.append("col:");
373    if (this.col == null) {
374      sb.append("null");
375    } else {
376      sb.append(this.col);
377    }
378    first = false;
379    if (!first) sb.append(", ");
380    sb.append("order:");
381    sb.append(this.order);
382    first = false;
383    sb.append(")");
384    return sb.toString();
385  }
386
387  public void validate() throws TException {
388    // check for required fields
389  }
390
391}
392