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 TGetInfoValue extends org.apache.thrift.TUnion<TGetInfoValue, TGetInfoValue._Fields> {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetInfoValue");
0036   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)1);
0037   private static final org.apache.thrift.protocol.TField SMALL_INT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("smallIntValue", org.apache.thrift.protocol.TType.I16, (short)2);
0038   private static final org.apache.thrift.protocol.TField INTEGER_BITMASK_FIELD_DESC = new org.apache.thrift.protocol.TField("integerBitmask", org.apache.thrift.protocol.TType.I32, (short)3);
0039   private static final org.apache.thrift.protocol.TField INTEGER_FLAG_FIELD_DESC = new org.apache.thrift.protocol.TField("integerFlag", org.apache.thrift.protocol.TType.I32, (short)4);
0040   private static final org.apache.thrift.protocol.TField BINARY_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryValue", org.apache.thrift.protocol.TType.I32, (short)5);
0041   private static final org.apache.thrift.protocol.TField LEN_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("lenValue", org.apache.thrift.protocol.TType.I64, (short)6);
0042 
0043   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0044   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0045     STRING_VALUE((short)1, "stringValue"),
0046     SMALL_INT_VALUE((short)2, "smallIntValue"),
0047     INTEGER_BITMASK((short)3, "integerBitmask"),
0048     INTEGER_FLAG((short)4, "integerFlag"),
0049     BINARY_VALUE((short)5, "binaryValue"),
0050     LEN_VALUE((short)6, "lenValue");
0051 
0052     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0053 
0054     static {
0055       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0056         byName.put(field.getFieldName(), field);
0057       }
0058     }
0059 
0060     /**
0061      * Find the _Fields constant that matches fieldId, or null if its not found.
0062      */
0063     public static _Fields findByThriftId(int fieldId) {
0064       switch(fieldId) {
0065         case 1: // STRING_VALUE
0066           return STRING_VALUE;
0067         case 2: // SMALL_INT_VALUE
0068           return SMALL_INT_VALUE;
0069         case 3: // INTEGER_BITMASK
0070           return INTEGER_BITMASK;
0071         case 4: // INTEGER_FLAG
0072           return INTEGER_FLAG;
0073         case 5: // BINARY_VALUE
0074           return BINARY_VALUE;
0075         case 6: // LEN_VALUE
0076           return LEN_VALUE;
0077         default:
0078           return null;
0079       }
0080     }
0081 
0082     /**
0083      * Find the _Fields constant that matches fieldId, throwing an exception
0084      * if it is not found.
0085      */
0086     public static _Fields findByThriftIdOrThrow(int fieldId) {
0087       _Fields fields = findByThriftId(fieldId);
0088       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0089       return fields;
0090     }
0091 
0092     /**
0093      * Find the _Fields constant that matches name, or null if its not found.
0094      */
0095     public static _Fields findByName(String name) {
0096       return byName.get(name);
0097     }
0098 
0099     private final short _thriftId;
0100     private final String _fieldName;
0101 
0102     _Fields(short thriftId, String fieldName) {
0103       _thriftId = thriftId;
0104       _fieldName = fieldName;
0105     }
0106 
0107     public short getThriftFieldId() {
0108       return _thriftId;
0109     }
0110 
0111     public String getFieldName() {
0112       return _fieldName;
0113     }
0114   }
0115 
0116   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0117   static {
0118     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0119     tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0120         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0121     tmpMap.put(_Fields.SMALL_INT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("smallIntValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0122         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
0123     tmpMap.put(_Fields.INTEGER_BITMASK, new org.apache.thrift.meta_data.FieldMetaData("integerBitmask", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0124         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0125     tmpMap.put(_Fields.INTEGER_FLAG, new org.apache.thrift.meta_data.FieldMetaData("integerFlag", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0126         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0127     tmpMap.put(_Fields.BINARY_VALUE, new org.apache.thrift.meta_data.FieldMetaData("binaryValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0128         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
0129     tmpMap.put(_Fields.LEN_VALUE, new org.apache.thrift.meta_data.FieldMetaData("lenValue", org.apache.thrift.TFieldRequirementType.DEFAULT, 
0130         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
0131     metaDataMap = Collections.unmodifiableMap(tmpMap);
0132     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetInfoValue.class, metaDataMap);
0133   }
0134 
0135   public TGetInfoValue() {
0136     super();
0137   }
0138 
0139   public TGetInfoValue(TGetInfoValue._Fields setField, Object value) {
0140     super(setField, value);
0141   }
0142 
0143   public TGetInfoValue(TGetInfoValue other) {
0144     super(other);
0145   }
0146   public TGetInfoValue deepCopy() {
0147     return new TGetInfoValue(this);
0148   }
0149 
0150   public static TGetInfoValue stringValue(String value) {
0151     TGetInfoValue x = new TGetInfoValue();
0152     x.setStringValue(value);
0153     return x;
0154   }
0155 
0156   public static TGetInfoValue smallIntValue(short value) {
0157     TGetInfoValue x = new TGetInfoValue();
0158     x.setSmallIntValue(value);
0159     return x;
0160   }
0161 
0162   public static TGetInfoValue integerBitmask(int value) {
0163     TGetInfoValue x = new TGetInfoValue();
0164     x.setIntegerBitmask(value);
0165     return x;
0166   }
0167 
0168   public static TGetInfoValue integerFlag(int value) {
0169     TGetInfoValue x = new TGetInfoValue();
0170     x.setIntegerFlag(value);
0171     return x;
0172   }
0173 
0174   public static TGetInfoValue binaryValue(int value) {
0175     TGetInfoValue x = new TGetInfoValue();
0176     x.setBinaryValue(value);
0177     return x;
0178   }
0179 
0180   public static TGetInfoValue lenValue(long value) {
0181     TGetInfoValue x = new TGetInfoValue();
0182     x.setLenValue(value);
0183     return x;
0184   }
0185 
0186 
0187   @Override
0188   protected void checkType(_Fields setField, Object value) throws ClassCastException {
0189     switch (setField) {
0190       case STRING_VALUE:
0191         if (value instanceof String) {
0192           break;
0193         }
0194         throw new ClassCastException("Was expecting value of type String for field 'stringValue', but got " + value.getClass().getSimpleName());
0195       case SMALL_INT_VALUE:
0196         if (value instanceof Short) {
0197           break;
0198         }
0199         throw new ClassCastException("Was expecting value of type Short for field 'smallIntValue', but got " + value.getClass().getSimpleName());
0200       case INTEGER_BITMASK:
0201         if (value instanceof Integer) {
0202           break;
0203         }
0204         throw new ClassCastException("Was expecting value of type Integer for field 'integerBitmask', but got " + value.getClass().getSimpleName());
0205       case INTEGER_FLAG:
0206         if (value instanceof Integer) {
0207           break;
0208         }
0209         throw new ClassCastException("Was expecting value of type Integer for field 'integerFlag', but got " + value.getClass().getSimpleName());
0210       case BINARY_VALUE:
0211         if (value instanceof Integer) {
0212           break;
0213         }
0214         throw new ClassCastException("Was expecting value of type Integer for field 'binaryValue', but got " + value.getClass().getSimpleName());
0215       case LEN_VALUE:
0216         if (value instanceof Long) {
0217           break;
0218         }
0219         throw new ClassCastException("Was expecting value of type Long for field 'lenValue', but got " + value.getClass().getSimpleName());
0220       default:
0221         throw new IllegalArgumentException("Unknown field id " + setField);
0222     }
0223   }
0224 
0225   @Override
0226   protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
0227     _Fields setField = _Fields.findByThriftId(field.id);
0228     if (setField != null) {
0229       switch (setField) {
0230         case STRING_VALUE:
0231           if (field.type == STRING_VALUE_FIELD_DESC.type) {
0232             String stringValue;
0233             stringValue = iprot.readString();
0234             return stringValue;
0235           } else {
0236             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0237             return null;
0238           }
0239         case SMALL_INT_VALUE:
0240           if (field.type == SMALL_INT_VALUE_FIELD_DESC.type) {
0241             Short smallIntValue;
0242             smallIntValue = iprot.readI16();
0243             return smallIntValue;
0244           } else {
0245             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0246             return null;
0247           }
0248         case INTEGER_BITMASK:
0249           if (field.type == INTEGER_BITMASK_FIELD_DESC.type) {
0250             Integer integerBitmask;
0251             integerBitmask = iprot.readI32();
0252             return integerBitmask;
0253           } else {
0254             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0255             return null;
0256           }
0257         case INTEGER_FLAG:
0258           if (field.type == INTEGER_FLAG_FIELD_DESC.type) {
0259             Integer integerFlag;
0260             integerFlag = iprot.readI32();
0261             return integerFlag;
0262           } else {
0263             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0264             return null;
0265           }
0266         case BINARY_VALUE:
0267           if (field.type == BINARY_VALUE_FIELD_DESC.type) {
0268             Integer binaryValue;
0269             binaryValue = iprot.readI32();
0270             return binaryValue;
0271           } else {
0272             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0273             return null;
0274           }
0275         case LEN_VALUE:
0276           if (field.type == LEN_VALUE_FIELD_DESC.type) {
0277             Long lenValue;
0278             lenValue = iprot.readI64();
0279             return lenValue;
0280           } else {
0281             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
0282             return null;
0283           }
0284         default:
0285           throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
0286       }
0287     } else {
0288       return null;
0289     }
0290   }
0291 
0292   @Override
0293   protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0294     switch (setField_) {
0295       case STRING_VALUE:
0296         String stringValue = (String)value_;
0297         oprot.writeString(stringValue);
0298         return;
0299       case SMALL_INT_VALUE:
0300         Short smallIntValue = (Short)value_;
0301         oprot.writeI16(smallIntValue);
0302         return;
0303       case INTEGER_BITMASK:
0304         Integer integerBitmask = (Integer)value_;
0305         oprot.writeI32(integerBitmask);
0306         return;
0307       case INTEGER_FLAG:
0308         Integer integerFlag = (Integer)value_;
0309         oprot.writeI32(integerFlag);
0310         return;
0311       case BINARY_VALUE:
0312         Integer binaryValue = (Integer)value_;
0313         oprot.writeI32(binaryValue);
0314         return;
0315       case LEN_VALUE:
0316         Long lenValue = (Long)value_;
0317         oprot.writeI64(lenValue);
0318         return;
0319       default:
0320         throw new IllegalStateException("Cannot write union with unknown field " + setField_);
0321     }
0322   }
0323 
0324   @Override
0325   protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
0326     _Fields setField = _Fields.findByThriftId(fieldID);
0327     if (setField != null) {
0328       switch (setField) {
0329         case STRING_VALUE:
0330           String stringValue;
0331           stringValue = iprot.readString();
0332           return stringValue;
0333         case SMALL_INT_VALUE:
0334           Short smallIntValue;
0335           smallIntValue = iprot.readI16();
0336           return smallIntValue;
0337         case INTEGER_BITMASK:
0338           Integer integerBitmask;
0339           integerBitmask = iprot.readI32();
0340           return integerBitmask;
0341         case INTEGER_FLAG:
0342           Integer integerFlag;
0343           integerFlag = iprot.readI32();
0344           return integerFlag;
0345         case BINARY_VALUE:
0346           Integer binaryValue;
0347           binaryValue = iprot.readI32();
0348           return binaryValue;
0349         case LEN_VALUE:
0350           Long lenValue;
0351           lenValue = iprot.readI64();
0352           return lenValue;
0353         default:
0354           throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
0355       }
0356     } else {
0357       throw new TProtocolException("Couldn't find a field with field id " + fieldID);
0358     }
0359   }
0360 
0361   @Override
0362   protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0363     switch (setField_) {
0364       case STRING_VALUE:
0365         String stringValue = (String)value_;
0366         oprot.writeString(stringValue);
0367         return;
0368       case SMALL_INT_VALUE:
0369         Short smallIntValue = (Short)value_;
0370         oprot.writeI16(smallIntValue);
0371         return;
0372       case INTEGER_BITMASK:
0373         Integer integerBitmask = (Integer)value_;
0374         oprot.writeI32(integerBitmask);
0375         return;
0376       case INTEGER_FLAG:
0377         Integer integerFlag = (Integer)value_;
0378         oprot.writeI32(integerFlag);
0379         return;
0380       case BINARY_VALUE:
0381         Integer binaryValue = (Integer)value_;
0382         oprot.writeI32(binaryValue);
0383         return;
0384       case LEN_VALUE:
0385         Long lenValue = (Long)value_;
0386         oprot.writeI64(lenValue);
0387         return;
0388       default:
0389         throw new IllegalStateException("Cannot write union with unknown field " + setField_);
0390     }
0391   }
0392 
0393   @Override
0394   protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
0395     switch (setField) {
0396       case STRING_VALUE:
0397         return STRING_VALUE_FIELD_DESC;
0398       case SMALL_INT_VALUE:
0399         return SMALL_INT_VALUE_FIELD_DESC;
0400       case INTEGER_BITMASK:
0401         return INTEGER_BITMASK_FIELD_DESC;
0402       case INTEGER_FLAG:
0403         return INTEGER_FLAG_FIELD_DESC;
0404       case BINARY_VALUE:
0405         return BINARY_VALUE_FIELD_DESC;
0406       case LEN_VALUE:
0407         return LEN_VALUE_FIELD_DESC;
0408       default:
0409         throw new IllegalArgumentException("Unknown field id " + setField);
0410     }
0411   }
0412 
0413   @Override
0414   protected org.apache.thrift.protocol.TStruct getStructDesc() {
0415     return STRUCT_DESC;
0416   }
0417 
0418   @Override
0419   protected _Fields enumForId(short id) {
0420     return _Fields.findByThriftIdOrThrow(id);
0421   }
0422 
0423   public _Fields fieldForId(int fieldId) {
0424     return _Fields.findByThriftId(fieldId);
0425   }
0426 
0427 
0428   public String getStringValue() {
0429     if (getSetField() == _Fields.STRING_VALUE) {
0430       return (String)getFieldValue();
0431     } else {
0432       throw new RuntimeException("Cannot get field 'stringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
0433     }
0434   }
0435 
0436   public void setStringValue(String value) {
0437     if (value == null) throw new NullPointerException();
0438     setField_ = _Fields.STRING_VALUE;
0439     value_ = value;
0440   }
0441 
0442   public short getSmallIntValue() {
0443     if (getSetField() == _Fields.SMALL_INT_VALUE) {
0444       return (Short)getFieldValue();
0445     } else {
0446       throw new RuntimeException("Cannot get field 'smallIntValue' because union is currently set to " + getFieldDesc(getSetField()).name);
0447     }
0448   }
0449 
0450   public void setSmallIntValue(short value) {
0451     setField_ = _Fields.SMALL_INT_VALUE;
0452     value_ = value;
0453   }
0454 
0455   public int getIntegerBitmask() {
0456     if (getSetField() == _Fields.INTEGER_BITMASK) {
0457       return (Integer)getFieldValue();
0458     } else {
0459       throw new RuntimeException("Cannot get field 'integerBitmask' because union is currently set to " + getFieldDesc(getSetField()).name);
0460     }
0461   }
0462 
0463   public void setIntegerBitmask(int value) {
0464     setField_ = _Fields.INTEGER_BITMASK;
0465     value_ = value;
0466   }
0467 
0468   public int getIntegerFlag() {
0469     if (getSetField() == _Fields.INTEGER_FLAG) {
0470       return (Integer)getFieldValue();
0471     } else {
0472       throw new RuntimeException("Cannot get field 'integerFlag' because union is currently set to " + getFieldDesc(getSetField()).name);
0473     }
0474   }
0475 
0476   public void setIntegerFlag(int value) {
0477     setField_ = _Fields.INTEGER_FLAG;
0478     value_ = value;
0479   }
0480 
0481   public int getBinaryValue() {
0482     if (getSetField() == _Fields.BINARY_VALUE) {
0483       return (Integer)getFieldValue();
0484     } else {
0485       throw new RuntimeException("Cannot get field 'binaryValue' because union is currently set to " + getFieldDesc(getSetField()).name);
0486     }
0487   }
0488 
0489   public void setBinaryValue(int value) {
0490     setField_ = _Fields.BINARY_VALUE;
0491     value_ = value;
0492   }
0493 
0494   public long getLenValue() {
0495     if (getSetField() == _Fields.LEN_VALUE) {
0496       return (Long)getFieldValue();
0497     } else {
0498       throw new RuntimeException("Cannot get field 'lenValue' because union is currently set to " + getFieldDesc(getSetField()).name);
0499     }
0500   }
0501 
0502   public void setLenValue(long value) {
0503     setField_ = _Fields.LEN_VALUE;
0504     value_ = value;
0505   }
0506 
0507   public boolean isSetStringValue() {
0508     return setField_ == _Fields.STRING_VALUE;
0509   }
0510 
0511 
0512   public boolean isSetSmallIntValue() {
0513     return setField_ == _Fields.SMALL_INT_VALUE;
0514   }
0515 
0516 
0517   public boolean isSetIntegerBitmask() {
0518     return setField_ == _Fields.INTEGER_BITMASK;
0519   }
0520 
0521 
0522   public boolean isSetIntegerFlag() {
0523     return setField_ == _Fields.INTEGER_FLAG;
0524   }
0525 
0526 
0527   public boolean isSetBinaryValue() {
0528     return setField_ == _Fields.BINARY_VALUE;
0529   }
0530 
0531 
0532   public boolean isSetLenValue() {
0533     return setField_ == _Fields.LEN_VALUE;
0534   }
0535 
0536 
0537   public boolean equals(Object other) {
0538     if (other instanceof TGetInfoValue) {
0539       return equals((TGetInfoValue)other);
0540     } else {
0541       return false;
0542     }
0543   }
0544 
0545   public boolean equals(TGetInfoValue other) {
0546     return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
0547   }
0548 
0549   @Override
0550   public int compareTo(TGetInfoValue other) {
0551     int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
0552     if (lastComparison == 0) {
0553       return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
0554     }
0555     return lastComparison;
0556   }
0557 
0558 
0559   @Override
0560   public int hashCode() {
0561     HashCodeBuilder hcb = new HashCodeBuilder();
0562     hcb.append(this.getClass().getName());
0563     org.apache.thrift.TFieldIdEnum setField = getSetField();
0564     if (setField != null) {
0565       hcb.append(setField.getThriftFieldId());
0566       Object value = getFieldValue();
0567       if (value instanceof org.apache.thrift.TEnum) {
0568         hcb.append(((org.apache.thrift.TEnum)getFieldValue()).getValue());
0569       } else {
0570         hcb.append(value);
0571       }
0572     }
0573     return hcb.toHashCode();
0574   }
0575   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0576     try {
0577       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0578     } catch (org.apache.thrift.TException te) {
0579       throw new java.io.IOException(te);
0580     }
0581   }
0582 
0583 
0584   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0585     try {
0586       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0587     } catch (org.apache.thrift.TException te) {
0588       throw new java.io.IOException(te);
0589     }
0590   }
0591 
0592 
0593 }