Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.3)
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.rpc.thrift;
0008 
0009 import org.apache.thrift.scheme.IScheme;
0010 import org.apache.thrift.scheme.SchemeFactory;
0011 import org.apache.thrift.scheme.StandardScheme;
0012 
0013 import org.apache.thrift.scheme.TupleScheme;
0014 import org.apache.thrift.protocol.TTupleProtocol;
0015 import org.apache.thrift.protocol.TProtocolException;
0016 import org.apache.thrift.EncodingUtils;
0017 import org.apache.thrift.TException;
0018 import org.apache.thrift.async.AsyncMethodCallback;
0019 import org.apache.thrift.server.AbstractNonblockingServer.*;
0020 import java.util.List;
0021 import java.util.ArrayList;
0022 import java.util.Map;
0023 import java.util.HashMap;
0024 import java.util.EnumMap;
0025 import java.util.Set;
0026 import java.util.HashSet;
0027 import java.util.EnumSet;
0028 import java.util.Collections;
0029 import java.util.BitSet;
0030 import java.nio.ByteBuffer;
0031 import java.util.Arrays;
0032 import javax.annotation.Generated;
0033 import org.slf4j.Logger;
0034 import org.slf4j.LoggerFactory;
0035 
0036 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
0037 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
0038 public class TTypeDesc implements org.apache.thrift.TBase<TTypeDesc, TTypeDesc._Fields>, java.io.Serializable, Cloneable, Comparable<TTypeDesc> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTypeDesc");
0040 
0041   private static final org.apache.thrift.protocol.TField TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("types", org.apache.thrift.protocol.TType.LIST, (short)1);
0042 
0043   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0044   static {
0045     schemes.put(StandardScheme.class, new TTypeDescStandardSchemeFactory());
0046     schemes.put(TupleScheme.class, new TTypeDescTupleSchemeFactory());
0047   }
0048 
0049   private List<TTypeEntry> types; // required
0050 
0051   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0052   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053     TYPES((short)1, "types");
0054 
0055     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0056 
0057     static {
0058       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0059         byName.put(field.getFieldName(), field);
0060       }
0061     }
0062 
0063     /**
0064      * Find the _Fields constant that matches fieldId, or null if its not found.
0065      */
0066     public static _Fields findByThriftId(int fieldId) {
0067       switch(fieldId) {
0068         case 1: // TYPES
0069           return TYPES;
0070         default:
0071           return null;
0072       }
0073     }
0074 
0075     /**
0076      * Find the _Fields constant that matches fieldId, throwing an exception
0077      * if it is not found.
0078      */
0079     public static _Fields findByThriftIdOrThrow(int fieldId) {
0080       _Fields fields = findByThriftId(fieldId);
0081       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0082       return fields;
0083     }
0084 
0085     /**
0086      * Find the _Fields constant that matches name, or null if its not found.
0087      */
0088     public static _Fields findByName(String name) {
0089       return byName.get(name);
0090     }
0091 
0092     private final short _thriftId;
0093     private final String _fieldName;
0094 
0095     _Fields(short thriftId, String fieldName) {
0096       _thriftId = thriftId;
0097       _fieldName = fieldName;
0098     }
0099 
0100     public short getThriftFieldId() {
0101       return _thriftId;
0102     }
0103 
0104     public String getFieldName() {
0105       return _fieldName;
0106     }
0107   }
0108 
0109   // isset id assignments
0110   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0111   static {
0112     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0113     tmpMap.put(_Fields.TYPES, new org.apache.thrift.meta_data.FieldMetaData("types", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0114         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
0115             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TTypeEntry.class))));
0116     metaDataMap = Collections.unmodifiableMap(tmpMap);
0117     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTypeDesc.class, metaDataMap);
0118   }
0119 
0120   public TTypeDesc() {
0121   }
0122 
0123   public TTypeDesc(
0124     List<TTypeEntry> types)
0125   {
0126     this();
0127     this.types = types;
0128   }
0129 
0130   /**
0131    * Performs a deep copy on <i>other</i>.
0132    */
0133   public TTypeDesc(TTypeDesc other) {
0134     if (other.isSetTypes()) {
0135       List<TTypeEntry> __this__types = new ArrayList<TTypeEntry>(other.types.size());
0136       for (TTypeEntry other_element : other.types) {
0137         __this__types.add(new TTypeEntry(other_element));
0138       }
0139       this.types = __this__types;
0140     }
0141   }
0142 
0143   public TTypeDesc deepCopy() {
0144     return new TTypeDesc(this);
0145   }
0146 
0147   @Override
0148   public void clear() {
0149     this.types = null;
0150   }
0151 
0152   public int getTypesSize() {
0153     return (this.types == null) ? 0 : this.types.size();
0154   }
0155 
0156   public java.util.Iterator<TTypeEntry> getTypesIterator() {
0157     return (this.types == null) ? null : this.types.iterator();
0158   }
0159 
0160   public void addToTypes(TTypeEntry elem) {
0161     if (this.types == null) {
0162       this.types = new ArrayList<TTypeEntry>();
0163     }
0164     this.types.add(elem);
0165   }
0166 
0167   public List<TTypeEntry> getTypes() {
0168     return this.types;
0169   }
0170 
0171   public void setTypes(List<TTypeEntry> types) {
0172     this.types = types;
0173   }
0174 
0175   public void unsetTypes() {
0176     this.types = null;
0177   }
0178 
0179   /** Returns true if field types is set (has been assigned a value) and false otherwise */
0180   public boolean isSetTypes() {
0181     return this.types != null;
0182   }
0183 
0184   public void setTypesIsSet(boolean value) {
0185     if (!value) {
0186       this.types = null;
0187     }
0188   }
0189 
0190   public void setFieldValue(_Fields field, Object value) {
0191     switch (field) {
0192     case TYPES:
0193       if (value == null) {
0194         unsetTypes();
0195       } else {
0196         setTypes((List<TTypeEntry>)value);
0197       }
0198       break;
0199 
0200     }
0201   }
0202 
0203   public Object getFieldValue(_Fields field) {
0204     switch (field) {
0205     case TYPES:
0206       return getTypes();
0207 
0208     }
0209     throw new IllegalStateException();
0210   }
0211 
0212   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0213   public boolean isSet(_Fields field) {
0214     if (field == null) {
0215       throw new IllegalArgumentException();
0216     }
0217 
0218     switch (field) {
0219     case TYPES:
0220       return isSetTypes();
0221     }
0222     throw new IllegalStateException();
0223   }
0224 
0225   @Override
0226   public boolean equals(Object that) {
0227     if (that == null)
0228       return false;
0229     if (that instanceof TTypeDesc)
0230       return this.equals((TTypeDesc)that);
0231     return false;
0232   }
0233 
0234   public boolean equals(TTypeDesc that) {
0235     if (that == null)
0236       return false;
0237 
0238     boolean this_present_types = true && this.isSetTypes();
0239     boolean that_present_types = true && that.isSetTypes();
0240     if (this_present_types || that_present_types) {
0241       if (!(this_present_types && that_present_types))
0242         return false;
0243       if (!this.types.equals(that.types))
0244         return false;
0245     }
0246 
0247     return true;
0248   }
0249 
0250   @Override
0251   public int hashCode() {
0252     List<Object> list = new ArrayList<Object>();
0253 
0254     boolean present_types = true && (isSetTypes());
0255     list.add(present_types);
0256     if (present_types)
0257       list.add(types);
0258 
0259     return list.hashCode();
0260   }
0261 
0262   @Override
0263   public int compareTo(TTypeDesc other) {
0264     if (!getClass().equals(other.getClass())) {
0265       return getClass().getName().compareTo(other.getClass().getName());
0266     }
0267 
0268     int lastComparison = 0;
0269 
0270     lastComparison = Boolean.valueOf(isSetTypes()).compareTo(other.isSetTypes());
0271     if (lastComparison != 0) {
0272       return lastComparison;
0273     }
0274     if (isSetTypes()) {
0275       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.types, other.types);
0276       if (lastComparison != 0) {
0277         return lastComparison;
0278       }
0279     }
0280     return 0;
0281   }
0282 
0283   public _Fields fieldForId(int fieldId) {
0284     return _Fields.findByThriftId(fieldId);
0285   }
0286 
0287   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0288     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0289   }
0290 
0291   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0292     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0293   }
0294 
0295   @Override
0296   public String toString() {
0297     StringBuilder sb = new StringBuilder("TTypeDesc(");
0298     boolean first = true;
0299 
0300     sb.append("types:");
0301     if (this.types == null) {
0302       sb.append("null");
0303     } else {
0304       sb.append(this.types);
0305     }
0306     first = false;
0307     sb.append(")");
0308     return sb.toString();
0309   }
0310 
0311   public void validate() throws org.apache.thrift.TException {
0312     // check for required fields
0313     if (!isSetTypes()) {
0314       throw new org.apache.thrift.protocol.TProtocolException("Required field 'types' is unset! Struct:" + toString());
0315     }
0316 
0317     // check for sub-struct validity
0318   }
0319 
0320   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0321     try {
0322       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0323     } catch (org.apache.thrift.TException te) {
0324       throw new java.io.IOException(te);
0325     }
0326   }
0327 
0328   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0329     try {
0330       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0331     } catch (org.apache.thrift.TException te) {
0332       throw new java.io.IOException(te);
0333     }
0334   }
0335 
0336   private static class TTypeDescStandardSchemeFactory implements SchemeFactory {
0337     public TTypeDescStandardScheme getScheme() {
0338       return new TTypeDescStandardScheme();
0339     }
0340   }
0341 
0342   private static class TTypeDescStandardScheme extends StandardScheme<TTypeDesc> {
0343 
0344     public void read(org.apache.thrift.protocol.TProtocol iprot, TTypeDesc struct) throws org.apache.thrift.TException {
0345       org.apache.thrift.protocol.TField schemeField;
0346       iprot.readStructBegin();
0347       while (true)
0348       {
0349         schemeField = iprot.readFieldBegin();
0350         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0351           break;
0352         }
0353         switch (schemeField.id) {
0354           case 1: // TYPES
0355             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
0356               {
0357                 org.apache.thrift.protocol.TList _list30 = iprot.readListBegin();
0358                 struct.types = new ArrayList<TTypeEntry>(_list30.size);
0359                 TTypeEntry _elem31;
0360                 for (int _i32 = 0; _i32 < _list30.size; ++_i32)
0361                 {
0362                   _elem31 = new TTypeEntry();
0363                   _elem31.read(iprot);
0364                   struct.types.add(_elem31);
0365                 }
0366                 iprot.readListEnd();
0367               }
0368               struct.setTypesIsSet(true);
0369             } else { 
0370               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0371             }
0372             break;
0373           default:
0374             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0375         }
0376         iprot.readFieldEnd();
0377       }
0378       iprot.readStructEnd();
0379       struct.validate();
0380     }
0381 
0382     public void write(org.apache.thrift.protocol.TProtocol oprot, TTypeDesc struct) throws org.apache.thrift.TException {
0383       struct.validate();
0384 
0385       oprot.writeStructBegin(STRUCT_DESC);
0386       if (struct.types != null) {
0387         oprot.writeFieldBegin(TYPES_FIELD_DESC);
0388         {
0389           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.types.size()));
0390           for (TTypeEntry _iter33 : struct.types)
0391           {
0392             _iter33.write(oprot);
0393           }
0394           oprot.writeListEnd();
0395         }
0396         oprot.writeFieldEnd();
0397       }
0398       oprot.writeFieldStop();
0399       oprot.writeStructEnd();
0400     }
0401 
0402   }
0403 
0404   private static class TTypeDescTupleSchemeFactory implements SchemeFactory {
0405     public TTypeDescTupleScheme getScheme() {
0406       return new TTypeDescTupleScheme();
0407     }
0408   }
0409 
0410   private static class TTypeDescTupleScheme extends TupleScheme<TTypeDesc> {
0411 
0412     @Override
0413     public void write(org.apache.thrift.protocol.TProtocol prot, TTypeDesc struct) throws org.apache.thrift.TException {
0414       TTupleProtocol oprot = (TTupleProtocol) prot;
0415       {
0416         oprot.writeI32(struct.types.size());
0417         for (TTypeEntry _iter34 : struct.types)
0418         {
0419           _iter34.write(oprot);
0420         }
0421       }
0422     }
0423 
0424     @Override
0425     public void read(org.apache.thrift.protocol.TProtocol prot, TTypeDesc struct) throws org.apache.thrift.TException {
0426       TTupleProtocol iprot = (TTupleProtocol) prot;
0427       {
0428         org.apache.thrift.protocol.TList _list35 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
0429         struct.types = new ArrayList<TTypeEntry>(_list35.size);
0430         TTypeEntry _elem36;
0431         for (int _i37 = 0; _i37 < _list35.size; ++_i37)
0432         {
0433           _elem36 = new TTypeEntry();
0434           _elem36.read(iprot);
0435           struct.types.add(_elem36);
0436         }
0437       }
0438       struct.setTypesIsSet(true);
0439     }
0440   }
0441 
0442 }
0443