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