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