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 TGetTypeInfoReq implements org.apache.thrift.TBase<TGetTypeInfoReq, TGetTypeInfoReq._Fields>, java.io.Serializable, Cloneable {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetTypeInfoReq");
0036 
0037   private static final org.apache.thrift.protocol.TField SESSION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionHandle", org.apache.thrift.protocol.TType.STRUCT, (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 TGetTypeInfoReqStandardSchemeFactory());
0042     schemes.put(TupleScheme.class, new TGetTypeInfoReqTupleSchemeFactory());
0043   }
0044 
0045   private TSessionHandle sessionHandle; // 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     SESSION_HANDLE((short)1, "sessionHandle");
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: // SESSION_HANDLE
0065           return SESSION_HANDLE;
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   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0107   static {
0108     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0109     tmpMap.put(_Fields.SESSION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("sessionHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0110         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSessionHandle.class)));
0111     metaDataMap = Collections.unmodifiableMap(tmpMap);
0112     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetTypeInfoReq.class, metaDataMap);
0113   }
0114 
0115   public TGetTypeInfoReq() {
0116   }
0117 
0118   public TGetTypeInfoReq(
0119     TSessionHandle sessionHandle)
0120   {
0121     this();
0122     this.sessionHandle = sessionHandle;
0123   }
0124 
0125   /**
0126    * Performs a deep copy on <i>other</i>.
0127    */
0128   public TGetTypeInfoReq(TGetTypeInfoReq other) {
0129     if (other.isSetSessionHandle()) {
0130       this.sessionHandle = new TSessionHandle(other.sessionHandle);
0131     }
0132   }
0133 
0134   public TGetTypeInfoReq deepCopy() {
0135     return new TGetTypeInfoReq(this);
0136   }
0137 
0138   @Override
0139   public void clear() {
0140     this.sessionHandle = null;
0141   }
0142 
0143   public TSessionHandle getSessionHandle() {
0144     return this.sessionHandle;
0145   }
0146 
0147   public void setSessionHandle(TSessionHandle sessionHandle) {
0148     this.sessionHandle = sessionHandle;
0149   }
0150 
0151   public void unsetSessionHandle() {
0152     this.sessionHandle = null;
0153   }
0154 
0155   /** Returns true if field sessionHandle is set (has been assigned a value) and false otherwise */
0156   public boolean isSetSessionHandle() {
0157     return this.sessionHandle != null;
0158   }
0159 
0160   public void setSessionHandleIsSet(boolean value) {
0161     if (!value) {
0162       this.sessionHandle = null;
0163     }
0164   }
0165 
0166   public void setFieldValue(_Fields field, Object value) {
0167     switch (field) {
0168     case SESSION_HANDLE:
0169       if (value == null) {
0170         unsetSessionHandle();
0171       } else {
0172         setSessionHandle((TSessionHandle)value);
0173       }
0174       break;
0175 
0176     }
0177   }
0178 
0179   public Object getFieldValue(_Fields field) {
0180     switch (field) {
0181     case SESSION_HANDLE:
0182       return getSessionHandle();
0183 
0184     }
0185     throw new IllegalStateException();
0186   }
0187 
0188   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0189   public boolean isSet(_Fields field) {
0190     if (field == null) {
0191       throw new IllegalArgumentException();
0192     }
0193 
0194     switch (field) {
0195     case SESSION_HANDLE:
0196       return isSetSessionHandle();
0197     }
0198     throw new IllegalStateException();
0199   }
0200 
0201   @Override
0202   public boolean equals(Object that) {
0203     if (that == null)
0204       return false;
0205     if (that instanceof TGetTypeInfoReq)
0206       return this.equals((TGetTypeInfoReq)that);
0207     return false;
0208   }
0209 
0210   public boolean equals(TGetTypeInfoReq that) {
0211     if (that == null)
0212       return false;
0213 
0214     boolean this_present_sessionHandle = true && this.isSetSessionHandle();
0215     boolean that_present_sessionHandle = true && that.isSetSessionHandle();
0216     if (this_present_sessionHandle || that_present_sessionHandle) {
0217       if (!(this_present_sessionHandle && that_present_sessionHandle))
0218         return false;
0219       if (!this.sessionHandle.equals(that.sessionHandle))
0220         return false;
0221     }
0222 
0223     return true;
0224   }
0225 
0226   @Override
0227   public int hashCode() {
0228     HashCodeBuilder builder = new HashCodeBuilder();
0229 
0230     boolean present_sessionHandle = true && (isSetSessionHandle());
0231     builder.append(present_sessionHandle);
0232     if (present_sessionHandle)
0233       builder.append(sessionHandle);
0234 
0235     return builder.toHashCode();
0236   }
0237 
0238   public int compareTo(TGetTypeInfoReq other) {
0239     if (!getClass().equals(other.getClass())) {
0240       return getClass().getName().compareTo(other.getClass().getName());
0241     }
0242 
0243     int lastComparison = 0;
0244     TGetTypeInfoReq typedOther = (TGetTypeInfoReq)other;
0245 
0246     lastComparison = Boolean.valueOf(isSetSessionHandle()).compareTo(typedOther.isSetSessionHandle());
0247     if (lastComparison != 0) {
0248       return lastComparison;
0249     }
0250     if (isSetSessionHandle()) {
0251       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionHandle, typedOther.sessionHandle);
0252       if (lastComparison != 0) {
0253         return lastComparison;
0254       }
0255     }
0256     return 0;
0257   }
0258 
0259   public _Fields fieldForId(int fieldId) {
0260     return _Fields.findByThriftId(fieldId);
0261   }
0262 
0263   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0264     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0265   }
0266 
0267   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0268     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0269   }
0270 
0271   @Override
0272   public String toString() {
0273     StringBuilder sb = new StringBuilder("TGetTypeInfoReq(");
0274     boolean first = true;
0275 
0276     sb.append("sessionHandle:");
0277     if (this.sessionHandle == null) {
0278       sb.append("null");
0279     } else {
0280       sb.append(this.sessionHandle);
0281     }
0282     first = false;
0283     sb.append(")");
0284     return sb.toString();
0285   }
0286 
0287   public void validate() throws org.apache.thrift.TException {
0288     // check for required fields
0289     if (!isSetSessionHandle()) {
0290       throw new org.apache.thrift.protocol.TProtocolException("Required field 'sessionHandle' is unset! Struct:" + toString());
0291     }
0292 
0293     // check for sub-struct validity
0294     if (sessionHandle != null) {
0295       sessionHandle.validate();
0296     }
0297   }
0298 
0299   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0300     try {
0301       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0302     } catch (org.apache.thrift.TException te) {
0303       throw new java.io.IOException(te);
0304     }
0305   }
0306 
0307   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0308     try {
0309       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0310     } catch (org.apache.thrift.TException te) {
0311       throw new java.io.IOException(te);
0312     }
0313   }
0314 
0315   private static class TGetTypeInfoReqStandardSchemeFactory implements SchemeFactory {
0316     public TGetTypeInfoReqStandardScheme getScheme() {
0317       return new TGetTypeInfoReqStandardScheme();
0318     }
0319   }
0320 
0321   private static class TGetTypeInfoReqStandardScheme extends StandardScheme<TGetTypeInfoReq> {
0322 
0323     public void read(org.apache.thrift.protocol.TProtocol iprot, TGetTypeInfoReq struct) throws org.apache.thrift.TException {
0324       org.apache.thrift.protocol.TField schemeField;
0325       iprot.readStructBegin();
0326       while (true)
0327       {
0328         schemeField = iprot.readFieldBegin();
0329         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0330           break;
0331         }
0332         switch (schemeField.id) {
0333           case 1: // SESSION_HANDLE
0334             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0335               struct.sessionHandle = new TSessionHandle();
0336               struct.sessionHandle.read(iprot);
0337               struct.setSessionHandleIsSet(true);
0338             } else { 
0339               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0340             }
0341             break;
0342           default:
0343             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0344         }
0345         iprot.readFieldEnd();
0346       }
0347       iprot.readStructEnd();
0348       struct.validate();
0349     }
0350 
0351     public void write(org.apache.thrift.protocol.TProtocol oprot, TGetTypeInfoReq struct) throws org.apache.thrift.TException {
0352       struct.validate();
0353 
0354       oprot.writeStructBegin(STRUCT_DESC);
0355       if (struct.sessionHandle != null) {
0356         oprot.writeFieldBegin(SESSION_HANDLE_FIELD_DESC);
0357         struct.sessionHandle.write(oprot);
0358         oprot.writeFieldEnd();
0359       }
0360       oprot.writeFieldStop();
0361       oprot.writeStructEnd();
0362     }
0363 
0364   }
0365 
0366   private static class TGetTypeInfoReqTupleSchemeFactory implements SchemeFactory {
0367     public TGetTypeInfoReqTupleScheme getScheme() {
0368       return new TGetTypeInfoReqTupleScheme();
0369     }
0370   }
0371 
0372   private static class TGetTypeInfoReqTupleScheme extends TupleScheme<TGetTypeInfoReq> {
0373 
0374     @Override
0375     public void write(org.apache.thrift.protocol.TProtocol prot, TGetTypeInfoReq struct) throws org.apache.thrift.TException {
0376       TTupleProtocol oprot = (TTupleProtocol) prot;
0377       struct.sessionHandle.write(oprot);
0378     }
0379 
0380     @Override
0381     public void read(org.apache.thrift.protocol.TProtocol prot, TGetTypeInfoReq struct) throws org.apache.thrift.TException {
0382       TTupleProtocol iprot = (TTupleProtocol) prot;
0383       struct.sessionHandle = new TSessionHandle();
0384       struct.sessionHandle.read(iprot);
0385       struct.setSessionHandleIsSet(true);
0386     }
0387   }
0388 
0389 }
0390