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 TUnionTypeEntry implements org.apache.thrift.TBase<TUnionTypeEntry, TUnionTypeEntry._Fields>, java.io.Serializable, Cloneable, Comparable<TUnionTypeEntry> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TUnionTypeEntry");
0040
0041 private static final org.apache.thrift.protocol.TField NAME_TO_TYPE_PTR_FIELD_DESC = new org.apache.thrift.protocol.TField("nameToTypePtr", org.apache.thrift.protocol.TType.MAP, (short)1);
0042
0043 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0044 static {
0045 schemes.put(StandardScheme.class, new TUnionTypeEntryStandardSchemeFactory());
0046 schemes.put(TupleScheme.class, new TUnionTypeEntryTupleSchemeFactory());
0047 }
0048
0049 private Map<String,Integer> nameToTypePtr;
0050
0051
0052 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053 NAME_TO_TYPE_PTR((short)1, "nameToTypePtr");
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 NAME_TO_TYPE_PTR;
0070 default:
0071 return null;
0072 }
0073 }
0074
0075
0076
0077
0078
0079 public static _Fields findByThriftIdOrThrow(int fieldId) {
0080 _Fields fields = findByThriftId(fieldId);
0081 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0082 return fields;
0083 }
0084
0085
0086
0087
0088 public static _Fields findByName(String name) {
0089 return byName.get(name);
0090 }
0091
0092 private final short _thriftId;
0093 private final String _fieldName;
0094
0095 _Fields(short thriftId, String fieldName) {
0096 _thriftId = thriftId;
0097 _fieldName = fieldName;
0098 }
0099
0100 public short getThriftFieldId() {
0101 return _thriftId;
0102 }
0103
0104 public String getFieldName() {
0105 return _fieldName;
0106 }
0107 }
0108
0109
0110 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0111 static {
0112 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0113 tmpMap.put(_Fields.NAME_TO_TYPE_PTR, new org.apache.thrift.meta_data.FieldMetaData("nameToTypePtr", org.apache.thrift.TFieldRequirementType.REQUIRED,
0114 new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
0115 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
0116 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "TTypeEntryPtr"))));
0117 metaDataMap = Collections.unmodifiableMap(tmpMap);
0118 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TUnionTypeEntry.class, metaDataMap);
0119 }
0120
0121 public TUnionTypeEntry() {
0122 }
0123
0124 public TUnionTypeEntry(
0125 Map<String,Integer> nameToTypePtr)
0126 {
0127 this();
0128 this.nameToTypePtr = nameToTypePtr;
0129 }
0130
0131
0132
0133
0134 public TUnionTypeEntry(TUnionTypeEntry other) {
0135 if (other.isSetNameToTypePtr()) {
0136 Map<String,Integer> __this__nameToTypePtr = new HashMap<String,Integer>(other.nameToTypePtr.size());
0137 for (Map.Entry<String, Integer> other_element : other.nameToTypePtr.entrySet()) {
0138
0139 String other_element_key = other_element.getKey();
0140 Integer other_element_value = other_element.getValue();
0141
0142 String __this__nameToTypePtr_copy_key = other_element_key;
0143
0144 Integer __this__nameToTypePtr_copy_value = other_element_value;
0145
0146 __this__nameToTypePtr.put(__this__nameToTypePtr_copy_key, __this__nameToTypePtr_copy_value);
0147 }
0148 this.nameToTypePtr = __this__nameToTypePtr;
0149 }
0150 }
0151
0152 public TUnionTypeEntry deepCopy() {
0153 return new TUnionTypeEntry(this);
0154 }
0155
0156 @Override
0157 public void clear() {
0158 this.nameToTypePtr = null;
0159 }
0160
0161 public int getNameToTypePtrSize() {
0162 return (this.nameToTypePtr == null) ? 0 : this.nameToTypePtr.size();
0163 }
0164
0165 public void putToNameToTypePtr(String key, int val) {
0166 if (this.nameToTypePtr == null) {
0167 this.nameToTypePtr = new HashMap<String,Integer>();
0168 }
0169 this.nameToTypePtr.put(key, val);
0170 }
0171
0172 public Map<String,Integer> getNameToTypePtr() {
0173 return this.nameToTypePtr;
0174 }
0175
0176 public void setNameToTypePtr(Map<String,Integer> nameToTypePtr) {
0177 this.nameToTypePtr = nameToTypePtr;
0178 }
0179
0180 public void unsetNameToTypePtr() {
0181 this.nameToTypePtr = null;
0182 }
0183
0184
0185 public boolean isSetNameToTypePtr() {
0186 return this.nameToTypePtr != null;
0187 }
0188
0189 public void setNameToTypePtrIsSet(boolean value) {
0190 if (!value) {
0191 this.nameToTypePtr = null;
0192 }
0193 }
0194
0195 public void setFieldValue(_Fields field, Object value) {
0196 switch (field) {
0197 case NAME_TO_TYPE_PTR:
0198 if (value == null) {
0199 unsetNameToTypePtr();
0200 } else {
0201 setNameToTypePtr((Map<String,Integer>)value);
0202 }
0203 break;
0204
0205 }
0206 }
0207
0208 public Object getFieldValue(_Fields field) {
0209 switch (field) {
0210 case NAME_TO_TYPE_PTR:
0211 return getNameToTypePtr();
0212
0213 }
0214 throw new IllegalStateException();
0215 }
0216
0217
0218 public boolean isSet(_Fields field) {
0219 if (field == null) {
0220 throw new IllegalArgumentException();
0221 }
0222
0223 switch (field) {
0224 case NAME_TO_TYPE_PTR:
0225 return isSetNameToTypePtr();
0226 }
0227 throw new IllegalStateException();
0228 }
0229
0230 @Override
0231 public boolean equals(Object that) {
0232 if (that == null)
0233 return false;
0234 if (that instanceof TUnionTypeEntry)
0235 return this.equals((TUnionTypeEntry)that);
0236 return false;
0237 }
0238
0239 public boolean equals(TUnionTypeEntry that) {
0240 if (that == null)
0241 return false;
0242
0243 boolean this_present_nameToTypePtr = true && this.isSetNameToTypePtr();
0244 boolean that_present_nameToTypePtr = true && that.isSetNameToTypePtr();
0245 if (this_present_nameToTypePtr || that_present_nameToTypePtr) {
0246 if (!(this_present_nameToTypePtr && that_present_nameToTypePtr))
0247 return false;
0248 if (!this.nameToTypePtr.equals(that.nameToTypePtr))
0249 return false;
0250 }
0251
0252 return true;
0253 }
0254
0255 @Override
0256 public int hashCode() {
0257 List<Object> list = new ArrayList<Object>();
0258
0259 boolean present_nameToTypePtr = true && (isSetNameToTypePtr());
0260 list.add(present_nameToTypePtr);
0261 if (present_nameToTypePtr)
0262 list.add(nameToTypePtr);
0263
0264 return list.hashCode();
0265 }
0266
0267 @Override
0268 public int compareTo(TUnionTypeEntry other) {
0269 if (!getClass().equals(other.getClass())) {
0270 return getClass().getName().compareTo(other.getClass().getName());
0271 }
0272
0273 int lastComparison = 0;
0274
0275 lastComparison = Boolean.valueOf(isSetNameToTypePtr()).compareTo(other.isSetNameToTypePtr());
0276 if (lastComparison != 0) {
0277 return lastComparison;
0278 }
0279 if (isSetNameToTypePtr()) {
0280 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nameToTypePtr, other.nameToTypePtr);
0281 if (lastComparison != 0) {
0282 return lastComparison;
0283 }
0284 }
0285 return 0;
0286 }
0287
0288 public _Fields fieldForId(int fieldId) {
0289 return _Fields.findByThriftId(fieldId);
0290 }
0291
0292 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0293 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0294 }
0295
0296 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0297 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0298 }
0299
0300 @Override
0301 public String toString() {
0302 StringBuilder sb = new StringBuilder("TUnionTypeEntry(");
0303 boolean first = true;
0304
0305 sb.append("nameToTypePtr:");
0306 if (this.nameToTypePtr == null) {
0307 sb.append("null");
0308 } else {
0309 sb.append(this.nameToTypePtr);
0310 }
0311 first = false;
0312 sb.append(")");
0313 return sb.toString();
0314 }
0315
0316 public void validate() throws org.apache.thrift.TException {
0317
0318 if (!isSetNameToTypePtr()) {
0319 throw new org.apache.thrift.protocol.TProtocolException("Required field 'nameToTypePtr' is unset! Struct:" + toString());
0320 }
0321
0322
0323 }
0324
0325 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0326 try {
0327 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0328 } catch (org.apache.thrift.TException te) {
0329 throw new java.io.IOException(te);
0330 }
0331 }
0332
0333 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0334 try {
0335 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0336 } catch (org.apache.thrift.TException te) {
0337 throw new java.io.IOException(te);
0338 }
0339 }
0340
0341 private static class TUnionTypeEntryStandardSchemeFactory implements SchemeFactory {
0342 public TUnionTypeEntryStandardScheme getScheme() {
0343 return new TUnionTypeEntryStandardScheme();
0344 }
0345 }
0346
0347 private static class TUnionTypeEntryStandardScheme extends StandardScheme<TUnionTypeEntry> {
0348
0349 public void read(org.apache.thrift.protocol.TProtocol iprot, TUnionTypeEntry struct) throws org.apache.thrift.TException {
0350 org.apache.thrift.protocol.TField schemeField;
0351 iprot.readStructBegin();
0352 while (true)
0353 {
0354 schemeField = iprot.readFieldBegin();
0355 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0356 break;
0357 }
0358 switch (schemeField.id) {
0359 case 1:
0360 if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
0361 {
0362 org.apache.thrift.protocol.TMap _map20 = iprot.readMapBegin();
0363 struct.nameToTypePtr = new HashMap<String,Integer>(2*_map20.size);
0364 String _key21;
0365 int _val22;
0366 for (int _i23 = 0; _i23 < _map20.size; ++_i23)
0367 {
0368 _key21 = iprot.readString();
0369 _val22 = iprot.readI32();
0370 struct.nameToTypePtr.put(_key21, _val22);
0371 }
0372 iprot.readMapEnd();
0373 }
0374 struct.setNameToTypePtrIsSet(true);
0375 } else {
0376 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0377 }
0378 break;
0379 default:
0380 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0381 }
0382 iprot.readFieldEnd();
0383 }
0384 iprot.readStructEnd();
0385 struct.validate();
0386 }
0387
0388 public void write(org.apache.thrift.protocol.TProtocol oprot, TUnionTypeEntry struct) throws org.apache.thrift.TException {
0389 struct.validate();
0390
0391 oprot.writeStructBegin(STRUCT_DESC);
0392 if (struct.nameToTypePtr != null) {
0393 oprot.writeFieldBegin(NAME_TO_TYPE_PTR_FIELD_DESC);
0394 {
0395 oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, struct.nameToTypePtr.size()));
0396 for (Map.Entry<String, Integer> _iter24 : struct.nameToTypePtr.entrySet())
0397 {
0398 oprot.writeString(_iter24.getKey());
0399 oprot.writeI32(_iter24.getValue());
0400 }
0401 oprot.writeMapEnd();
0402 }
0403 oprot.writeFieldEnd();
0404 }
0405 oprot.writeFieldStop();
0406 oprot.writeStructEnd();
0407 }
0408
0409 }
0410
0411 private static class TUnionTypeEntryTupleSchemeFactory implements SchemeFactory {
0412 public TUnionTypeEntryTupleScheme getScheme() {
0413 return new TUnionTypeEntryTupleScheme();
0414 }
0415 }
0416
0417 private static class TUnionTypeEntryTupleScheme extends TupleScheme<TUnionTypeEntry> {
0418
0419 @Override
0420 public void write(org.apache.thrift.protocol.TProtocol prot, TUnionTypeEntry struct) throws org.apache.thrift.TException {
0421 TTupleProtocol oprot = (TTupleProtocol) prot;
0422 {
0423 oprot.writeI32(struct.nameToTypePtr.size());
0424 for (Map.Entry<String, Integer> _iter25 : struct.nameToTypePtr.entrySet())
0425 {
0426 oprot.writeString(_iter25.getKey());
0427 oprot.writeI32(_iter25.getValue());
0428 }
0429 }
0430 }
0431
0432 @Override
0433 public void read(org.apache.thrift.protocol.TProtocol prot, TUnionTypeEntry struct) throws org.apache.thrift.TException {
0434 TTupleProtocol iprot = (TTupleProtocol) prot;
0435 {
0436 org.apache.thrift.protocol.TMap _map26 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32());
0437 struct.nameToTypePtr = new HashMap<String,Integer>(2*_map26.size);
0438 String _key27;
0439 int _val28;
0440 for (int _i29 = 0; _i29 < _map26.size; ++_i29)
0441 {
0442 _key27 = iprot.readString();
0443 _val28 = iprot.readI32();
0444 struct.nameToTypePtr.put(_key27, _val28);
0445 }
0446 }
0447 struct.setNameToTypePtrIsSet(true);
0448 }
0449 }
0450
0451 }
0452