0001
0002
0003
0004
0005
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 TGetInfoResp implements org.apache.thrift.TBase<TGetInfoResp, TGetInfoResp._Fields>, java.io.Serializable, Cloneable {
0035 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetInfoResp");
0036
0037 private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
0038 private static final org.apache.thrift.protocol.TField INFO_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("infoValue", org.apache.thrift.protocol.TType.STRUCT, (short)2);
0039
0040 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0041 static {
0042 schemes.put(StandardScheme.class, new TGetInfoRespStandardSchemeFactory());
0043 schemes.put(TupleScheme.class, new TGetInfoRespTupleSchemeFactory());
0044 }
0045
0046 private TStatus status;
0047 private TGetInfoValue infoValue;
0048
0049
0050 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0051 STATUS((short)1, "status"),
0052 INFO_VALUE((short)2, "infoValue");
0053
0054 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0055
0056 static {
0057 for (_Fields field : EnumSet.allOf(_Fields.class)) {
0058 byName.put(field.getFieldName(), field);
0059 }
0060 }
0061
0062
0063
0064
0065 public static _Fields findByThriftId(int fieldId) {
0066 switch(fieldId) {
0067 case 1:
0068 return STATUS;
0069 case 2:
0070 return INFO_VALUE;
0071 default:
0072 return null;
0073 }
0074 }
0075
0076
0077
0078
0079
0080 public static _Fields findByThriftIdOrThrow(int fieldId) {
0081 _Fields fields = findByThriftId(fieldId);
0082 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0083 return fields;
0084 }
0085
0086
0087
0088
0089 public static _Fields findByName(String name) {
0090 return byName.get(name);
0091 }
0092
0093 private final short _thriftId;
0094 private final String _fieldName;
0095
0096 _Fields(short thriftId, String fieldName) {
0097 _thriftId = thriftId;
0098 _fieldName = fieldName;
0099 }
0100
0101 public short getThriftFieldId() {
0102 return _thriftId;
0103 }
0104
0105 public String getFieldName() {
0106 return _fieldName;
0107 }
0108 }
0109
0110
0111 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0112 static {
0113 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0114 tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
0115 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class)));
0116 tmpMap.put(_Fields.INFO_VALUE, new org.apache.thrift.meta_data.FieldMetaData("infoValue", org.apache.thrift.TFieldRequirementType.REQUIRED,
0117 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGetInfoValue.class)));
0118 metaDataMap = Collections.unmodifiableMap(tmpMap);
0119 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetInfoResp.class, metaDataMap);
0120 }
0121
0122 public TGetInfoResp() {
0123 }
0124
0125 public TGetInfoResp(
0126 TStatus status,
0127 TGetInfoValue infoValue)
0128 {
0129 this();
0130 this.status = status;
0131 this.infoValue = infoValue;
0132 }
0133
0134
0135
0136
0137 public TGetInfoResp(TGetInfoResp other) {
0138 if (other.isSetStatus()) {
0139 this.status = new TStatus(other.status);
0140 }
0141 if (other.isSetInfoValue()) {
0142 this.infoValue = new TGetInfoValue(other.infoValue);
0143 }
0144 }
0145
0146 public TGetInfoResp deepCopy() {
0147 return new TGetInfoResp(this);
0148 }
0149
0150 @Override
0151 public void clear() {
0152 this.status = null;
0153 this.infoValue = null;
0154 }
0155
0156 public TStatus getStatus() {
0157 return this.status;
0158 }
0159
0160 public void setStatus(TStatus status) {
0161 this.status = status;
0162 }
0163
0164 public void unsetStatus() {
0165 this.status = null;
0166 }
0167
0168
0169 public boolean isSetStatus() {
0170 return this.status != null;
0171 }
0172
0173 public void setStatusIsSet(boolean value) {
0174 if (!value) {
0175 this.status = null;
0176 }
0177 }
0178
0179 public TGetInfoValue getInfoValue() {
0180 return this.infoValue;
0181 }
0182
0183 public void setInfoValue(TGetInfoValue infoValue) {
0184 this.infoValue = infoValue;
0185 }
0186
0187 public void unsetInfoValue() {
0188 this.infoValue = null;
0189 }
0190
0191
0192 public boolean isSetInfoValue() {
0193 return this.infoValue != null;
0194 }
0195
0196 public void setInfoValueIsSet(boolean value) {
0197 if (!value) {
0198 this.infoValue = null;
0199 }
0200 }
0201
0202 public void setFieldValue(_Fields field, Object value) {
0203 switch (field) {
0204 case STATUS:
0205 if (value == null) {
0206 unsetStatus();
0207 } else {
0208 setStatus((TStatus)value);
0209 }
0210 break;
0211
0212 case INFO_VALUE:
0213 if (value == null) {
0214 unsetInfoValue();
0215 } else {
0216 setInfoValue((TGetInfoValue)value);
0217 }
0218 break;
0219
0220 }
0221 }
0222
0223 public Object getFieldValue(_Fields field) {
0224 switch (field) {
0225 case STATUS:
0226 return getStatus();
0227
0228 case INFO_VALUE:
0229 return getInfoValue();
0230
0231 }
0232 throw new IllegalStateException();
0233 }
0234
0235
0236 public boolean isSet(_Fields field) {
0237 if (field == null) {
0238 throw new IllegalArgumentException();
0239 }
0240
0241 switch (field) {
0242 case STATUS:
0243 return isSetStatus();
0244 case INFO_VALUE:
0245 return isSetInfoValue();
0246 }
0247 throw new IllegalStateException();
0248 }
0249
0250 @Override
0251 public boolean equals(Object that) {
0252 if (that == null)
0253 return false;
0254 if (that instanceof TGetInfoResp)
0255 return this.equals((TGetInfoResp)that);
0256 return false;
0257 }
0258
0259 public boolean equals(TGetInfoResp that) {
0260 if (that == null)
0261 return false;
0262
0263 boolean this_present_status = true && this.isSetStatus();
0264 boolean that_present_status = true && that.isSetStatus();
0265 if (this_present_status || that_present_status) {
0266 if (!(this_present_status && that_present_status))
0267 return false;
0268 if (!this.status.equals(that.status))
0269 return false;
0270 }
0271
0272 boolean this_present_infoValue = true && this.isSetInfoValue();
0273 boolean that_present_infoValue = true && that.isSetInfoValue();
0274 if (this_present_infoValue || that_present_infoValue) {
0275 if (!(this_present_infoValue && that_present_infoValue))
0276 return false;
0277 if (!this.infoValue.equals(that.infoValue))
0278 return false;
0279 }
0280
0281 return true;
0282 }
0283
0284 @Override
0285 public int hashCode() {
0286 HashCodeBuilder builder = new HashCodeBuilder();
0287
0288 boolean present_status = true && (isSetStatus());
0289 builder.append(present_status);
0290 if (present_status)
0291 builder.append(status);
0292
0293 boolean present_infoValue = true && (isSetInfoValue());
0294 builder.append(present_infoValue);
0295 if (present_infoValue)
0296 builder.append(infoValue);
0297
0298 return builder.toHashCode();
0299 }
0300
0301 public int compareTo(TGetInfoResp other) {
0302 if (!getClass().equals(other.getClass())) {
0303 return getClass().getName().compareTo(other.getClass().getName());
0304 }
0305
0306 int lastComparison = 0;
0307 TGetInfoResp typedOther = (TGetInfoResp)other;
0308
0309 lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
0310 if (lastComparison != 0) {
0311 return lastComparison;
0312 }
0313 if (isSetStatus()) {
0314 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
0315 if (lastComparison != 0) {
0316 return lastComparison;
0317 }
0318 }
0319 lastComparison = Boolean.valueOf(isSetInfoValue()).compareTo(typedOther.isSetInfoValue());
0320 if (lastComparison != 0) {
0321 return lastComparison;
0322 }
0323 if (isSetInfoValue()) {
0324 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.infoValue, typedOther.infoValue);
0325 if (lastComparison != 0) {
0326 return lastComparison;
0327 }
0328 }
0329 return 0;
0330 }
0331
0332 public _Fields fieldForId(int fieldId) {
0333 return _Fields.findByThriftId(fieldId);
0334 }
0335
0336 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0337 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0338 }
0339
0340 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0341 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0342 }
0343
0344 @Override
0345 public String toString() {
0346 StringBuilder sb = new StringBuilder("TGetInfoResp(");
0347 boolean first = true;
0348
0349 sb.append("status:");
0350 if (this.status == null) {
0351 sb.append("null");
0352 } else {
0353 sb.append(this.status);
0354 }
0355 first = false;
0356 if (!first) sb.append(", ");
0357 sb.append("infoValue:");
0358 if (this.infoValue == null) {
0359 sb.append("null");
0360 } else {
0361 sb.append(this.infoValue);
0362 }
0363 first = false;
0364 sb.append(")");
0365 return sb.toString();
0366 }
0367
0368 public void validate() throws org.apache.thrift.TException {
0369
0370 if (!isSetStatus()) {
0371 throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
0372 }
0373
0374 if (!isSetInfoValue()) {
0375 throw new org.apache.thrift.protocol.TProtocolException("Required field 'infoValue' is unset! Struct:" + toString());
0376 }
0377
0378
0379 if (status != null) {
0380 status.validate();
0381 }
0382 }
0383
0384 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0385 try {
0386 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0387 } catch (org.apache.thrift.TException te) {
0388 throw new java.io.IOException(te);
0389 }
0390 }
0391
0392 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0393 try {
0394 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0395 } catch (org.apache.thrift.TException te) {
0396 throw new java.io.IOException(te);
0397 }
0398 }
0399
0400 private static class TGetInfoRespStandardSchemeFactory implements SchemeFactory {
0401 public TGetInfoRespStandardScheme getScheme() {
0402 return new TGetInfoRespStandardScheme();
0403 }
0404 }
0405
0406 private static class TGetInfoRespStandardScheme extends StandardScheme<TGetInfoResp> {
0407
0408 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetInfoResp struct) throws org.apache.thrift.TException {
0409 org.apache.thrift.protocol.TField schemeField;
0410 iprot.readStructBegin();
0411 while (true)
0412 {
0413 schemeField = iprot.readFieldBegin();
0414 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0415 break;
0416 }
0417 switch (schemeField.id) {
0418 case 1:
0419 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0420 struct.status = new TStatus();
0421 struct.status.read(iprot);
0422 struct.setStatusIsSet(true);
0423 } else {
0424 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0425 }
0426 break;
0427 case 2:
0428 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0429 struct.infoValue = new TGetInfoValue();
0430 struct.infoValue.read(iprot);
0431 struct.setInfoValueIsSet(true);
0432 } else {
0433 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0434 }
0435 break;
0436 default:
0437 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0438 }
0439 iprot.readFieldEnd();
0440 }
0441 iprot.readStructEnd();
0442 struct.validate();
0443 }
0444
0445 public void write(org.apache.thrift.protocol.TProtocol oprot, TGetInfoResp struct) throws org.apache.thrift.TException {
0446 struct.validate();
0447
0448 oprot.writeStructBegin(STRUCT_DESC);
0449 if (struct.status != null) {
0450 oprot.writeFieldBegin(STATUS_FIELD_DESC);
0451 struct.status.write(oprot);
0452 oprot.writeFieldEnd();
0453 }
0454 if (struct.infoValue != null) {
0455 oprot.writeFieldBegin(INFO_VALUE_FIELD_DESC);
0456 struct.infoValue.write(oprot);
0457 oprot.writeFieldEnd();
0458 }
0459 oprot.writeFieldStop();
0460 oprot.writeStructEnd();
0461 }
0462
0463 }
0464
0465 private static class TGetInfoRespTupleSchemeFactory implements SchemeFactory {
0466 public TGetInfoRespTupleScheme getScheme() {
0467 return new TGetInfoRespTupleScheme();
0468 }
0469 }
0470
0471 private static class TGetInfoRespTupleScheme extends TupleScheme<TGetInfoResp> {
0472
0473 @Override
0474 public void write(org.apache.thrift.protocol.TProtocol prot, TGetInfoResp struct) throws org.apache.thrift.TException {
0475 TTupleProtocol oprot = (TTupleProtocol) prot;
0476 struct.status.write(oprot);
0477 struct.infoValue.write(oprot);
0478 }
0479
0480 @Override
0481 public void read(org.apache.thrift.protocol.TProtocol prot, TGetInfoResp struct) throws org.apache.thrift.TException {
0482 TTupleProtocol iprot = (TTupleProtocol) prot;
0483 struct.status = new TStatus();
0484 struct.status.read(iprot);
0485 struct.setStatusIsSet(true);
0486 struct.infoValue = new TGetInfoValue();
0487 struct.infoValue.read(iprot);
0488 struct.setInfoValueIsSet(true);
0489 }
0490 }
0491
0492 }
0493