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 public class TTypeQualifierValue extends org.apache.thrift.TUnion<TTypeQualifierValue, TTypeQualifierValue._Fields> {
0038   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTypeQualifierValue");
0039   private static final org.apache.thrift.protocol.TField I32_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("i32Value", org.apache.thrift.protocol.TType.I32, (short)1);
0040   private static final org.apache.thrift.protocol.TField STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("stringValue", org.apache.thrift.protocol.TType.STRING, (short)2);
0041 
0042   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0043   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0044     I32_VALUE((short)1, "i32Value"),
0045     STRING_VALUE((short)2, "stringValue");
0046 
0047     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0048 
0049     static {
0050       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0051         byName.put(field.getFieldName(), field);
0052       }
0053     }
0054 
0055     /**
0056      * Find the _Fields constant that matches fieldId, or null if its not found.
0057      */
0058     public static _Fields findByThriftId(int fieldId) {
0059       switch(fieldId) {
0060         case 1: // I32_VALUE
0061           return I32_VALUE;
0062         case 2: // STRING_VALUE
0063           return STRING_VALUE;
0064         default:
0065           return null;
0066       }
0067     }
0068 
0069     /**
0070      * Find the _Fields constant that matches fieldId, throwing an exception
0071      * if it is not found.
0072      */
0073     public static _Fields findByThriftIdOrThrow(int fieldId) {
0074       _Fields fields = findByThriftId(fieldId);
0075       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0076       return fields;
0077     }
0078 
0079     /**
0080      * Find the _Fields constant that matches name, or null if its not found.
0081      */
0082     public static _Fields findByName(String name) {
0083       return byName.get(name);
0084     }
0085 
0086     private final short _thriftId;
0087     private final String _fieldName;
0088 
0089     _Fields(short thriftId, String fieldName) {
0090       _thriftId = thriftId;
0091       _fieldName = fieldName;
0092     }
0093 
0094     public short getThriftFieldId() {
0095       return _thriftId;
0096     }
0097 
0098     public String getFieldName() {
0099       return _fieldName;
0100     }
0101   }
0102 
0103   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0104   static {
0105     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0106     tmpMap.put(_Fields.I32_VALUE, new org.apache.thrift.meta_data.FieldMetaData("i32Value", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
0107         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0108     tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
0109         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0110     metaDataMap = Collections.unmodifiableMap(tmpMap);
0111     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTypeQualifierValue.class, metaDataMap);
0112   }
0113 
0114   public TTypeQualifierValue() {
0115     super();
0116   }
0117 
0118   public TTypeQualifierValue(TTypeQualifierValue._Fields setField, Object value) {
0119     super(setField, value);
0120   }
0121 
0122   public TTypeQualifierValue(TTypeQualifierValue other) {
0123     super(other);
0124   }
0125   public TTypeQualifierValue deepCopy() {
0126     return new TTypeQualifierValue(this);
0127   }
0128 
0129   public static TTypeQualifierValue i32Value(int value) {
0130     TTypeQualifierValue x = new TTypeQualifierValue();
0131     x.setI32Value(value);
0132     return x;
0133   }
0134 
0135   public static TTypeQualifierValue stringValue(String value) {
0136     TTypeQualifierValue x = new TTypeQualifierValue();
0137     x.setStringValue(value);
0138     return x;
0139   }
0140 
0141 
0142   @Override
0143   protected void checkType(_Fields setField, Object value) throws ClassCastException {
0144     switch (setField) {
0145       case I32_VALUE:
0146         if (value instanceof Integer) {
0147           break;
0148         }
0149         throw new ClassCastException("Was expecting value of type Integer for field 'i32Value', but got " + value.getClass().getSimpleName());
0150       case STRING_VALUE:
0151         if (value instanceof String) {
0152           break;
0153         }
0154         throw new ClassCastException("Was expecting value of type String for field 'stringValue', but got " + value.getClass().getSimpleName());
0155       default:
0156         throw new IllegalArgumentException("Unknown field id " + setField);
0157     }
0158   }
0159 
0160   @Override
0161   protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
0162     _Fields setField = _Fields.findByThriftId(field.id);
0163     if (setField != null) {
0164       switch (setField) {
0165         case I32_VALUE:
0166           if (field.type == I32_VALUE_FIELD_DESC.type) {
0167             Integer i32Value;
0168             i32Value = iprot.readI32();
0169             return i32Value;
0170           } else {
0171             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0172             return null;
0173           }
0174         case STRING_VALUE:
0175           if (field.type == STRING_VALUE_FIELD_DESC.type) {
0176             String stringValue;
0177             stringValue = iprot.readString();
0178             return stringValue;
0179           } else {
0180             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0181             return null;
0182           }
0183         default:
0184           throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
0185       }
0186     } else {
0187       org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0188       return null;
0189     }
0190   }
0191 
0192   @Override
0193   protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0194     switch (setField_) {
0195       case I32_VALUE:
0196         Integer i32Value = (Integer)value_;
0197         oprot.writeI32(i32Value);
0198         return;
0199       case STRING_VALUE:
0200         String stringValue = (String)value_;
0201         oprot.writeString(stringValue);
0202         return;
0203       default:
0204         throw new IllegalStateException("Cannot write union with unknown field " + setField_);
0205     }
0206   }
0207 
0208   @Override
0209   protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
0210     _Fields setField = _Fields.findByThriftId(fieldID);
0211     if (setField != null) {
0212       switch (setField) {
0213         case I32_VALUE:
0214           Integer i32Value;
0215           i32Value = iprot.readI32();
0216           return i32Value;
0217         case STRING_VALUE:
0218           String stringValue;
0219           stringValue = iprot.readString();
0220           return stringValue;
0221         default:
0222           throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
0223       }
0224     } else {
0225       throw new TProtocolException("Couldn't find a field with field id " + fieldID);
0226     }
0227   }
0228 
0229   @Override
0230   protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0231     switch (setField_) {
0232       case I32_VALUE:
0233         Integer i32Value = (Integer)value_;
0234         oprot.writeI32(i32Value);
0235         return;
0236       case STRING_VALUE:
0237         String stringValue = (String)value_;
0238         oprot.writeString(stringValue);
0239         return;
0240       default:
0241         throw new IllegalStateException("Cannot write union with unknown field " + setField_);
0242     }
0243   }
0244 
0245   @Override
0246   protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
0247     switch (setField) {
0248       case I32_VALUE:
0249         return I32_VALUE_FIELD_DESC;
0250       case STRING_VALUE:
0251         return STRING_VALUE_FIELD_DESC;
0252       default:
0253         throw new IllegalArgumentException("Unknown field id " + setField);
0254     }
0255   }
0256 
0257   @Override
0258   protected org.apache.thrift.protocol.TStruct getStructDesc() {
0259     return STRUCT_DESC;
0260   }
0261 
0262   @Override
0263   protected _Fields enumForId(short id) {
0264     return _Fields.findByThriftIdOrThrow(id);
0265   }
0266 
0267   public _Fields fieldForId(int fieldId) {
0268     return _Fields.findByThriftId(fieldId);
0269   }
0270 
0271 
0272   public int getI32Value() {
0273     if (getSetField() == _Fields.I32_VALUE) {
0274       return (Integer)getFieldValue();
0275     } else {
0276       throw new RuntimeException("Cannot get field 'i32Value' because union is currently set to " + getFieldDesc(getSetField()).name);
0277     }
0278   }
0279 
0280   public void setI32Value(int value) {
0281     setField_ = _Fields.I32_VALUE;
0282     value_ = value;
0283   }
0284 
0285   public String getStringValue() {
0286     if (getSetField() == _Fields.STRING_VALUE) {
0287       return (String)getFieldValue();
0288     } else {
0289       throw new RuntimeException("Cannot get field 'stringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
0290     }
0291   }
0292 
0293   public void setStringValue(String value) {
0294     if (value == null) throw new NullPointerException();
0295     setField_ = _Fields.STRING_VALUE;
0296     value_ = value;
0297   }
0298 
0299   public boolean isSetI32Value() {
0300     return setField_ == _Fields.I32_VALUE;
0301   }
0302 
0303 
0304   public boolean isSetStringValue() {
0305     return setField_ == _Fields.STRING_VALUE;
0306   }
0307 
0308 
0309   public boolean equals(Object other) {
0310     if (other instanceof TTypeQualifierValue) {
0311       return equals((TTypeQualifierValue)other);
0312     } else {
0313       return false;
0314     }
0315   }
0316 
0317   public boolean equals(TTypeQualifierValue other) {
0318     return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
0319   }
0320 
0321   @Override
0322   public int compareTo(TTypeQualifierValue other) {
0323     int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
0324     if (lastComparison == 0) {
0325       return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
0326     }
0327     return lastComparison;
0328   }
0329 
0330 
0331   @Override
0332   public int hashCode() {
0333     List<Object> list = new ArrayList<Object>();
0334     list.add(this.getClass().getName());
0335     org.apache.thrift.TFieldIdEnum setField = getSetField();
0336     if (setField != null) {
0337       list.add(setField.getThriftFieldId());
0338       Object value = getFieldValue();
0339       if (value instanceof org.apache.thrift.TEnum) {
0340         list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue());
0341       } else {
0342         list.add(value);
0343       }
0344     }
0345     return list.hashCode();
0346   }
0347   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0348     try {
0349       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0350     } catch (org.apache.thrift.TException te) {
0351       throw new java.io.IOException(te);
0352     }
0353   }
0354 
0355 
0356   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0357     try {
0358       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0359     } catch (org.apache.thrift.TException te) {
0360       throw new java.io.IOException(te);
0361     }
0362   }
0363 
0364 
0365 }