Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.0)
0003  *
0004  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
0005  *  @generated
0006  */
0007 package org.apache.hive.service.cli.thrift;
0008 
0009 import org.apache.commons.lang.builder.HashCodeBuilder;
0010 import org.apache.thrift.scheme.IScheme;
0011 import org.apache.thrift.scheme.SchemeFactory;
0012 import org.apache.thrift.scheme.StandardScheme;
0013 
0014 import org.apache.thrift.scheme.TupleScheme;
0015 import org.apache.thrift.protocol.TTupleProtocol;
0016 import org.apache.thrift.protocol.TProtocolException;
0017 import org.apache.thrift.EncodingUtils;
0018 import org.apache.thrift.TException;
0019 import java.util.List;
0020 import java.util.ArrayList;
0021 import java.util.Map;
0022 import java.util.HashMap;
0023 import java.util.EnumMap;
0024 import java.util.Set;
0025 import java.util.HashSet;
0026 import java.util.EnumSet;
0027 import java.util.Collections;
0028 import java.util.BitSet;
0029 import java.nio.ByteBuffer;
0030 import java.util.Arrays;
0031 import org.slf4j.Logger;
0032 import org.slf4j.LoggerFactory;
0033 
0034 public class TArrayTypeEntry implements org.apache.thrift.TBase<TArrayTypeEntry, TArrayTypeEntry._Fields>, java.io.Serializable, Cloneable {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TArrayTypeEntry");
0036 
0037   private static final org.apache.thrift.protocol.TField OBJECT_TYPE_PTR_FIELD_DESC = new org.apache.thrift.protocol.TField("objectTypePtr", org.apache.thrift.protocol.TType.I32, (short)1);
0038 
0039   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0040   static {
0041     schemes.put(StandardScheme.class, new TArrayTypeEntryStandardSchemeFactory());
0042     schemes.put(TupleScheme.class, new TArrayTypeEntryTupleSchemeFactory());
0043   }
0044 
0045   private int objectTypePtr; // required
0046 
0047   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0048   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0049     OBJECT_TYPE_PTR((short)1, "objectTypePtr");
0050 
0051     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0052 
0053     static {
0054       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0055         byName.put(field.getFieldName(), field);
0056       }
0057     }
0058 
0059     /**
0060      * Find the _Fields constant that matches fieldId, or null if its not found.
0061      */
0062     public static _Fields findByThriftId(int fieldId) {
0063       switch(fieldId) {
0064         case 1: // OBJECT_TYPE_PTR
0065           return OBJECT_TYPE_PTR;
0066         default:
0067           return null;
0068       }
0069     }
0070 
0071     /**
0072      * Find the _Fields constant that matches fieldId, throwing an exception
0073      * if it is not found.
0074      */
0075     public static _Fields findByThriftIdOrThrow(int fieldId) {
0076       _Fields fields = findByThriftId(fieldId);
0077       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0078       return fields;
0079     }
0080 
0081     /**
0082      * Find the _Fields constant that matches name, or null if its not found.
0083      */
0084     public static _Fields findByName(String name) {
0085       return byName.get(name);
0086     }
0087 
0088     private final short _thriftId;
0089     private final String _fieldName;
0090 
0091     _Fields(short thriftId, String fieldName) {
0092       _thriftId = thriftId;
0093       _fieldName = fieldName;
0094     }
0095 
0096     public short getThriftFieldId() {
0097       return _thriftId;
0098     }
0099 
0100     public String getFieldName() {
0101       return _fieldName;
0102     }
0103   }
0104 
0105   // isset id assignments
0106   private static final int __OBJECTTYPEPTR_ISSET_ID = 0;
0107   private byte __isset_bitfield = 0;
0108   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0109   static {
0110     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0111     tmpMap.put(_Fields.OBJECT_TYPE_PTR, new org.apache.thrift.meta_data.FieldMetaData("objectTypePtr", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0112         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TTypeEntryPtr")));
0113     metaDataMap = Collections.unmodifiableMap(tmpMap);
0114     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TArrayTypeEntry.class, metaDataMap);
0115   }
0116 
0117   public TArrayTypeEntry() {
0118   }
0119 
0120   public TArrayTypeEntry(
0121     int objectTypePtr)
0122   {
0123     this();
0124     this.objectTypePtr = objectTypePtr;
0125     setObjectTypePtrIsSet(true);
0126   }
0127 
0128   /**
0129    * Performs a deep copy on <i>other</i>.
0130    */
0131   public TArrayTypeEntry(TArrayTypeEntry other) {
0132     __isset_bitfield = other.__isset_bitfield;
0133     this.objectTypePtr = other.objectTypePtr;
0134   }
0135 
0136   public TArrayTypeEntry deepCopy() {
0137     return new TArrayTypeEntry(this);
0138   }
0139 
0140   @Override
0141   public void clear() {
0142     setObjectTypePtrIsSet(false);
0143     this.objectTypePtr = 0;
0144   }
0145 
0146   public int getObjectTypePtr() {
0147     return this.objectTypePtr;
0148   }
0149 
0150   public void setObjectTypePtr(int objectTypePtr) {
0151     this.objectTypePtr = objectTypePtr;
0152     setObjectTypePtrIsSet(true);
0153   }
0154 
0155   public void unsetObjectTypePtr() {
0156     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __OBJECTTYPEPTR_ISSET_ID);
0157   }
0158 
0159   /** Returns true if field objectTypePtr is set (has been assigned a value) and false otherwise */
0160   public boolean isSetObjectTypePtr() {
0161     return EncodingUtils.testBit(__isset_bitfield, __OBJECTTYPEPTR_ISSET_ID);
0162   }
0163 
0164   public void setObjectTypePtrIsSet(boolean value) {
0165     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OBJECTTYPEPTR_ISSET_ID, value);
0166   }
0167 
0168   public void setFieldValue(_Fields field, Object value) {
0169     switch (field) {
0170     case OBJECT_TYPE_PTR:
0171       if (value == null) {
0172         unsetObjectTypePtr();
0173       } else {
0174         setObjectTypePtr((Integer)value);
0175       }
0176       break;
0177 
0178     }
0179   }
0180 
0181   public Object getFieldValue(_Fields field) {
0182     switch (field) {
0183     case OBJECT_TYPE_PTR:
0184       return Integer.valueOf(getObjectTypePtr());
0185 
0186     }
0187     throw new IllegalStateException();
0188   }
0189 
0190   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0191   public boolean isSet(_Fields field) {
0192     if (field == null) {
0193       throw new IllegalArgumentException();
0194     }
0195 
0196     switch (field) {
0197     case OBJECT_TYPE_PTR:
0198       return isSetObjectTypePtr();
0199     }
0200     throw new IllegalStateException();
0201   }
0202 
0203   @Override
0204   public boolean equals(Object that) {
0205     if (that == null)
0206       return false;
0207     if (that instanceof TArrayTypeEntry)
0208       return this.equals((TArrayTypeEntry)that);
0209     return false;
0210   }
0211 
0212   public boolean equals(TArrayTypeEntry that) {
0213     if (that == null)
0214       return false;
0215 
0216     boolean this_present_objectTypePtr = true;
0217     boolean that_present_objectTypePtr = true;
0218     if (this_present_objectTypePtr || that_present_objectTypePtr) {
0219       if (!(this_present_objectTypePtr && that_present_objectTypePtr))
0220         return false;
0221       if (this.objectTypePtr != that.objectTypePtr)
0222         return false;
0223     }
0224 
0225     return true;
0226   }
0227 
0228   @Override
0229   public int hashCode() {
0230     HashCodeBuilder builder = new HashCodeBuilder();
0231 
0232     boolean present_objectTypePtr = true;
0233     builder.append(present_objectTypePtr);
0234     if (present_objectTypePtr)
0235       builder.append(objectTypePtr);
0236 
0237     return builder.toHashCode();
0238   }
0239 
0240   public int compareTo(TArrayTypeEntry other) {
0241     if (!getClass().equals(other.getClass())) {
0242       return getClass().getName().compareTo(other.getClass().getName());
0243     }
0244 
0245     int lastComparison = 0;
0246     TArrayTypeEntry typedOther = (TArrayTypeEntry)other;
0247 
0248     lastComparison = Boolean.valueOf(isSetObjectTypePtr()).compareTo(typedOther.isSetObjectTypePtr());
0249     if (lastComparison != 0) {
0250       return lastComparison;
0251     }
0252     if (isSetObjectTypePtr()) {
0253       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.objectTypePtr, typedOther.objectTypePtr);
0254       if (lastComparison != 0) {
0255         return lastComparison;
0256       }
0257     }
0258     return 0;
0259   }
0260 
0261   public _Fields fieldForId(int fieldId) {
0262     return _Fields.findByThriftId(fieldId);
0263   }
0264 
0265   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0266     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0267   }
0268 
0269   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0270     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0271   }
0272 
0273   @Override
0274   public String toString() {
0275     StringBuilder sb = new StringBuilder("TArrayTypeEntry(");
0276     boolean first = true;
0277 
0278     sb.append("objectTypePtr:");
0279     sb.append(this.objectTypePtr);
0280     first = false;
0281     sb.append(")");
0282     return sb.toString();
0283   }
0284 
0285   public void validate() throws org.apache.thrift.TException {
0286     // check for required fields
0287     if (!isSetObjectTypePtr()) {
0288       throw new org.apache.thrift.protocol.TProtocolException("Required field 'objectTypePtr' is unset! Struct:" + toString());
0289     }
0290 
0291     // check for sub-struct validity
0292   }
0293 
0294   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0295     try {
0296       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0297     } catch (org.apache.thrift.TException te) {
0298       throw new java.io.IOException(te);
0299     }
0300   }
0301 
0302   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0303     try {
0304       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
0305       __isset_bitfield = 0;
0306       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0307     } catch (org.apache.thrift.TException te) {
0308       throw new java.io.IOException(te);
0309     }
0310   }
0311 
0312   private static class TArrayTypeEntryStandardSchemeFactory implements SchemeFactory {
0313     public TArrayTypeEntryStandardScheme getScheme() {
0314       return new TArrayTypeEntryStandardScheme();
0315     }
0316   }
0317 
0318   private static class TArrayTypeEntryStandardScheme extends StandardScheme<TArrayTypeEntry> {
0319 
0320     public void read(org.apache.thrift.protocol.TProtocol iprot, TArrayTypeEntry struct) throws org.apache.thrift.TException {
0321       org.apache.thrift.protocol.TField schemeField;
0322       iprot.readStructBegin();
0323       while (true)
0324       {
0325         schemeField = iprot.readFieldBegin();
0326         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0327           break;
0328         }
0329         switch (schemeField.id) {
0330           case 1: // OBJECT_TYPE_PTR
0331             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0332               struct.objectTypePtr = iprot.readI32();
0333               struct.setObjectTypePtrIsSet(true);
0334             } else { 
0335               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0336             }
0337             break;
0338           default:
0339             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0340         }
0341         iprot.readFieldEnd();
0342       }
0343       iprot.readStructEnd();
0344       struct.validate();
0345     }
0346 
0347     public void write(org.apache.thrift.protocol.TProtocol oprot, TArrayTypeEntry struct) throws org.apache.thrift.TException {
0348       struct.validate();
0349 
0350       oprot.writeStructBegin(STRUCT_DESC);
0351       oprot.writeFieldBegin(OBJECT_TYPE_PTR_FIELD_DESC);
0352       oprot.writeI32(struct.objectTypePtr);
0353       oprot.writeFieldEnd();
0354       oprot.writeFieldStop();
0355       oprot.writeStructEnd();
0356     }
0357 
0358   }
0359 
0360   private static class TArrayTypeEntryTupleSchemeFactory implements SchemeFactory {
0361     public TArrayTypeEntryTupleScheme getScheme() {
0362       return new TArrayTypeEntryTupleScheme();
0363     }
0364   }
0365 
0366   private static class TArrayTypeEntryTupleScheme extends TupleScheme<TArrayTypeEntry> {
0367 
0368     @Override
0369     public void write(org.apache.thrift.protocol.TProtocol prot, TArrayTypeEntry struct) throws org.apache.thrift.TException {
0370       TTupleProtocol oprot = (TTupleProtocol) prot;
0371       oprot.writeI32(struct.objectTypePtr);
0372     }
0373 
0374     @Override
0375     public void read(org.apache.thrift.protocol.TProtocol prot, TArrayTypeEntry struct) throws org.apache.thrift.TException {
0376       TTupleProtocol iprot = (TTupleProtocol) prot;
0377       struct.objectTypePtr = iprot.readI32();
0378       struct.setObjectTypePtrIsSet(true);
0379     }
0380   }
0381 
0382 }
0383