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 TGetResultSetMetadataReq implements org.apache.thrift.TBase<TGetResultSetMetadataReq, TGetResultSetMetadataReq._Fields>, java.io.Serializable, Cloneable {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetResultSetMetadataReq");
0036 
0037   private static final org.apache.thrift.protocol.TField OPERATION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationHandle", 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 TGetResultSetMetadataReqStandardSchemeFactory());
0042     schemes.put(TupleScheme.class, new TGetResultSetMetadataReqTupleSchemeFactory());
0043   }
0044 
0045   private TOperationHandle operationHandle; // 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     OPERATION_HANDLE((short)1, "operationHandle");
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: // OPERATION_HANDLE
0065           return OPERATION_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.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0110         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class)));
0111     metaDataMap = Collections.unmodifiableMap(tmpMap);
0112     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetResultSetMetadataReq.class, metaDataMap);
0113   }
0114 
0115   public TGetResultSetMetadataReq() {
0116   }
0117 
0118   public TGetResultSetMetadataReq(
0119     TOperationHandle operationHandle)
0120   {
0121     this();
0122     this.operationHandle = operationHandle;
0123   }
0124 
0125   /**
0126    * Performs a deep copy on <i>other</i>.
0127    */
0128   public TGetResultSetMetadataReq(TGetResultSetMetadataReq other) {
0129     if (other.isSetOperationHandle()) {
0130       this.operationHandle = new TOperationHandle(other.operationHandle);
0131     }
0132   }
0133 
0134   public TGetResultSetMetadataReq deepCopy() {
0135     return new TGetResultSetMetadataReq(this);
0136   }
0137 
0138   @Override
0139   public void clear() {
0140     this.operationHandle = null;
0141   }
0142 
0143   public TOperationHandle getOperationHandle() {
0144     return this.operationHandle;
0145   }
0146 
0147   public void setOperationHandle(TOperationHandle operationHandle) {
0148     this.operationHandle = operationHandle;
0149   }
0150 
0151   public void unsetOperationHandle() {
0152     this.operationHandle = null;
0153   }
0154 
0155   /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */
0156   public boolean isSetOperationHandle() {
0157     return this.operationHandle != null;
0158   }
0159 
0160   public void setOperationHandleIsSet(boolean value) {
0161     if (!value) {
0162       this.operationHandle = null;
0163     }
0164   }
0165 
0166   public void setFieldValue(_Fields field, Object value) {
0167     switch (field) {
0168     case OPERATION_HANDLE:
0169       if (value == null) {
0170         unsetOperationHandle();
0171       } else {
0172         setOperationHandle((TOperationHandle)value);
0173       }
0174       break;
0175 
0176     }
0177   }
0178 
0179   public Object getFieldValue(_Fields field) {
0180     switch (field) {
0181     case OPERATION_HANDLE:
0182       return getOperationHandle();
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 OPERATION_HANDLE:
0196       return isSetOperationHandle();
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 TGetResultSetMetadataReq)
0206       return this.equals((TGetResultSetMetadataReq)that);
0207     return false;
0208   }
0209 
0210   public boolean equals(TGetResultSetMetadataReq that) {
0211     if (that == null)
0212       return false;
0213 
0214     boolean this_present_operationHandle = true && this.isSetOperationHandle();
0215     boolean that_present_operationHandle = true && that.isSetOperationHandle();
0216     if (this_present_operationHandle || that_present_operationHandle) {
0217       if (!(this_present_operationHandle && that_present_operationHandle))
0218         return false;
0219       if (!this.operationHandle.equals(that.operationHandle))
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_operationHandle = true && (isSetOperationHandle());
0231     builder.append(present_operationHandle);
0232     if (present_operationHandle)
0233       builder.append(operationHandle);
0234 
0235     return builder.toHashCode();
0236   }
0237 
0238   public int compareTo(TGetResultSetMetadataReq other) {
0239     if (!getClass().equals(other.getClass())) {
0240       return getClass().getName().compareTo(other.getClass().getName());
0241     }
0242 
0243     int lastComparison = 0;
0244     TGetResultSetMetadataReq typedOther = (TGetResultSetMetadataReq)other;
0245 
0246     lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(typedOther.isSetOperationHandle());
0247     if (lastComparison != 0) {
0248       return lastComparison;
0249     }
0250     if (isSetOperationHandle()) {
0251       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, typedOther.operationHandle);
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("TGetResultSetMetadataReq(");
0274     boolean first = true;
0275 
0276     sb.append("operationHandle:");
0277     if (this.operationHandle == null) {
0278       sb.append("null");
0279     } else {
0280       sb.append(this.operationHandle);
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 (!isSetOperationHandle()) {
0290       throw new org.apache.thrift.protocol.TProtocolException("Required field 'operationHandle' is unset! Struct:" + toString());
0291     }
0292 
0293     // check for sub-struct validity
0294     if (operationHandle != null) {
0295       operationHandle.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 TGetResultSetMetadataReqStandardSchemeFactory implements SchemeFactory {
0316     public TGetResultSetMetadataReqStandardScheme getScheme() {
0317       return new TGetResultSetMetadataReqStandardScheme();
0318     }
0319   }
0320 
0321   private static class TGetResultSetMetadataReqStandardScheme extends StandardScheme<TGetResultSetMetadataReq> {
0322 
0323     public void read(org.apache.thrift.protocol.TProtocol iprot, TGetResultSetMetadataReq 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: // OPERATION_HANDLE
0334             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0335               struct.operationHandle = new TOperationHandle();
0336               struct.operationHandle.read(iprot);
0337               struct.setOperationHandleIsSet(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, TGetResultSetMetadataReq struct) throws org.apache.thrift.TException {
0352       struct.validate();
0353 
0354       oprot.writeStructBegin(STRUCT_DESC);
0355       if (struct.operationHandle != null) {
0356         oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
0357         struct.operationHandle.write(oprot);
0358         oprot.writeFieldEnd();
0359       }
0360       oprot.writeFieldStop();
0361       oprot.writeStructEnd();
0362     }
0363 
0364   }
0365 
0366   private static class TGetResultSetMetadataReqTupleSchemeFactory implements SchemeFactory {
0367     public TGetResultSetMetadataReqTupleScheme getScheme() {
0368       return new TGetResultSetMetadataReqTupleScheme();
0369     }
0370   }
0371 
0372   private static class TGetResultSetMetadataReqTupleScheme extends TupleScheme<TGetResultSetMetadataReq> {
0373 
0374     @Override
0375     public void write(org.apache.thrift.protocol.TProtocol prot, TGetResultSetMetadataReq struct) throws org.apache.thrift.TException {
0376       TTupleProtocol oprot = (TTupleProtocol) prot;
0377       struct.operationHandle.write(oprot);
0378     }
0379 
0380     @Override
0381     public void read(org.apache.thrift.protocol.TProtocol prot, TGetResultSetMetadataReq struct) throws org.apache.thrift.TException {
0382       TTupleProtocol iprot = (TTupleProtocol) prot;
0383       struct.operationHandle = new TOperationHandle();
0384       struct.operationHandle.read(iprot);
0385       struct.setOperationHandleIsSet(true);
0386     }
0387   }
0388 
0389 }
0390