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 TStringValue implements org.apache.thrift.TBase<TStringValue, TStringValue._Fields>, java.io.Serializable, Cloneable, Comparable<TStringValue> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TStringValue");
0040
0041 private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (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 TStringValueStandardSchemeFactory());
0046 schemes.put(TupleScheme.class, new TStringValueTupleSchemeFactory());
0047 }
0048
0049 private String value;
0050
0051
0052 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053 VALUE((short)1, "value");
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 VALUE;
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 private static final _Fields optionals[] = {_Fields.VALUE};
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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0115 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0116 metaDataMap = Collections.unmodifiableMap(tmpMap);
0117 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TStringValue.class, metaDataMap);
0118 }
0119
0120 public TStringValue() {
0121 }
0122
0123
0124
0125
0126 public TStringValue(TStringValue other) {
0127 if (other.isSetValue()) {
0128 this.value = other.value;
0129 }
0130 }
0131
0132 public TStringValue deepCopy() {
0133 return new TStringValue(this);
0134 }
0135
0136 @Override
0137 public void clear() {
0138 this.value = null;
0139 }
0140
0141 public String getValue() {
0142 return this.value;
0143 }
0144
0145 public void setValue(String value) {
0146 this.value = value;
0147 }
0148
0149 public void unsetValue() {
0150 this.value = null;
0151 }
0152
0153
0154 public boolean isSetValue() {
0155 return this.value != null;
0156 }
0157
0158 public void setValueIsSet(boolean value) {
0159 if (!value) {
0160 this.value = null;
0161 }
0162 }
0163
0164 public void setFieldValue(_Fields field, Object value) {
0165 switch (field) {
0166 case VALUE:
0167 if (value == null) {
0168 unsetValue();
0169 } else {
0170 setValue((String)value);
0171 }
0172 break;
0173
0174 }
0175 }
0176
0177 public Object getFieldValue(_Fields field) {
0178 switch (field) {
0179 case VALUE:
0180 return getValue();
0181
0182 }
0183 throw new IllegalStateException();
0184 }
0185
0186
0187 public boolean isSet(_Fields field) {
0188 if (field == null) {
0189 throw new IllegalArgumentException();
0190 }
0191
0192 switch (field) {
0193 case VALUE:
0194 return isSetValue();
0195 }
0196 throw new IllegalStateException();
0197 }
0198
0199 @Override
0200 public boolean equals(Object that) {
0201 if (that == null)
0202 return false;
0203 if (that instanceof TStringValue)
0204 return this.equals((TStringValue)that);
0205 return false;
0206 }
0207
0208 public boolean equals(TStringValue that) {
0209 if (that == null)
0210 return false;
0211
0212 boolean this_present_value = true && this.isSetValue();
0213 boolean that_present_value = true && that.isSetValue();
0214 if (this_present_value || that_present_value) {
0215 if (!(this_present_value && that_present_value))
0216 return false;
0217 if (!this.value.equals(that.value))
0218 return false;
0219 }
0220
0221 return true;
0222 }
0223
0224 @Override
0225 public int hashCode() {
0226 List<Object> list = new ArrayList<Object>();
0227
0228 boolean present_value = true && (isSetValue());
0229 list.add(present_value);
0230 if (present_value)
0231 list.add(value);
0232
0233 return list.hashCode();
0234 }
0235
0236 @Override
0237 public int compareTo(TStringValue other) {
0238 if (!getClass().equals(other.getClass())) {
0239 return getClass().getName().compareTo(other.getClass().getName());
0240 }
0241
0242 int lastComparison = 0;
0243
0244 lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
0245 if (lastComparison != 0) {
0246 return lastComparison;
0247 }
0248 if (isSetValue()) {
0249 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
0250 if (lastComparison != 0) {
0251 return lastComparison;
0252 }
0253 }
0254 return 0;
0255 }
0256
0257 public _Fields fieldForId(int fieldId) {
0258 return _Fields.findByThriftId(fieldId);
0259 }
0260
0261 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0262 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0263 }
0264
0265 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0266 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0267 }
0268
0269 @Override
0270 public String toString() {
0271 StringBuilder sb = new StringBuilder("TStringValue(");
0272 boolean first = true;
0273
0274 if (isSetValue()) {
0275 sb.append("value:");
0276 if (this.value == null) {
0277 sb.append("null");
0278 } else {
0279 sb.append(this.value);
0280 }
0281 first = false;
0282 }
0283 sb.append(")");
0284 return sb.toString();
0285 }
0286
0287 public void validate() throws org.apache.thrift.TException {
0288
0289
0290 }
0291
0292 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0293 try {
0294 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0295 } catch (org.apache.thrift.TException te) {
0296 throw new java.io.IOException(te);
0297 }
0298 }
0299
0300 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0301 try {
0302 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0303 } catch (org.apache.thrift.TException te) {
0304 throw new java.io.IOException(te);
0305 }
0306 }
0307
0308 private static class TStringValueStandardSchemeFactory implements SchemeFactory {
0309 public TStringValueStandardScheme getScheme() {
0310 return new TStringValueStandardScheme();
0311 }
0312 }
0313
0314 private static class TStringValueStandardScheme extends StandardScheme<TStringValue> {
0315
0316 public void read(org.apache.thrift.protocol.TProtocol iprot, TStringValue struct) throws org.apache.thrift.TException {
0317 org.apache.thrift.protocol.TField schemeField;
0318 iprot.readStructBegin();
0319 while (true)
0320 {
0321 schemeField = iprot.readFieldBegin();
0322 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0323 break;
0324 }
0325 switch (schemeField.id) {
0326 case 1:
0327 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0328 struct.value = iprot.readString();
0329 struct.setValueIsSet(true);
0330 } else {
0331 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0332 }
0333 break;
0334 default:
0335 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0336 }
0337 iprot.readFieldEnd();
0338 }
0339 iprot.readStructEnd();
0340 struct.validate();
0341 }
0342
0343 public void write(org.apache.thrift.protocol.TProtocol oprot, TStringValue struct) throws org.apache.thrift.TException {
0344 struct.validate();
0345
0346 oprot.writeStructBegin(STRUCT_DESC);
0347 if (struct.value != null) {
0348 if (struct.isSetValue()) {
0349 oprot.writeFieldBegin(VALUE_FIELD_DESC);
0350 oprot.writeString(struct.value);
0351 oprot.writeFieldEnd();
0352 }
0353 }
0354 oprot.writeFieldStop();
0355 oprot.writeStructEnd();
0356 }
0357
0358 }
0359
0360 private static class TStringValueTupleSchemeFactory implements SchemeFactory {
0361 public TStringValueTupleScheme getScheme() {
0362 return new TStringValueTupleScheme();
0363 }
0364 }
0365
0366 private static class TStringValueTupleScheme extends TupleScheme<TStringValue> {
0367
0368 @Override
0369 public void write(org.apache.thrift.protocol.TProtocol prot, TStringValue struct) throws org.apache.thrift.TException {
0370 TTupleProtocol oprot = (TTupleProtocol) prot;
0371 BitSet optionals = new BitSet();
0372 if (struct.isSetValue()) {
0373 optionals.set(0);
0374 }
0375 oprot.writeBitSet(optionals, 1);
0376 if (struct.isSetValue()) {
0377 oprot.writeString(struct.value);
0378 }
0379 }
0380
0381 @Override
0382 public void read(org.apache.thrift.protocol.TProtocol prot, TStringValue struct) throws org.apache.thrift.TException {
0383 TTupleProtocol iprot = (TTupleProtocol) prot;
0384 BitSet incoming = iprot.readBitSet(1);
0385 if (incoming.get(0)) {
0386 struct.value = iprot.readString();
0387 struct.setValueIsSet(true);
0388 }
0389 }
0390 }
0391
0392 }
0393