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