Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.3)
0003  *
0004  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
0005  *  @generated
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 TTypeQualifiers implements org.apache.thrift.TBase<TTypeQualifiers, TTypeQualifiers._Fields>, java.io.Serializable, Cloneable, Comparable<TTypeQualifiers> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTypeQualifiers");
0040 
0041   private static final org.apache.thrift.protocol.TField QUALIFIERS_FIELD_DESC = new org.apache.thrift.protocol.TField("qualifiers", 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 TTypeQualifiersStandardSchemeFactory());
0046     schemes.put(TupleScheme.class, new TTypeQualifiersTupleSchemeFactory());
0047   }
0048 
0049   private Map<String,TTypeQualifierValue> qualifiers; // required
0050 
0051   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0052   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053     QUALIFIERS((short)1, "qualifiers");
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      * Find the _Fields constant that matches fieldId, or null if its not found.
0065      */
0066     public static _Fields findByThriftId(int fieldId) {
0067       switch(fieldId) {
0068         case 1: // QUALIFIERS
0069           return QUALIFIERS;
0070         default:
0071           return null;
0072       }
0073     }
0074 
0075     /**
0076      * Find the _Fields constant that matches fieldId, throwing an exception
0077      * if it is not found.
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      * Find the _Fields constant that matches name, or null if its not found.
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   // isset id assignments
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.QUALIFIERS, new org.apache.thrift.meta_data.FieldMetaData("qualifiers", 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TTypeQualifierValue.class))));
0117     metaDataMap = Collections.unmodifiableMap(tmpMap);
0118     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTypeQualifiers.class, metaDataMap);
0119   }
0120 
0121   public TTypeQualifiers() {
0122   }
0123 
0124   public TTypeQualifiers(
0125     Map<String,TTypeQualifierValue> qualifiers)
0126   {
0127     this();
0128     this.qualifiers = qualifiers;
0129   }
0130 
0131   /**
0132    * Performs a deep copy on <i>other</i>.
0133    */
0134   public TTypeQualifiers(TTypeQualifiers other) {
0135     if (other.isSetQualifiers()) {
0136       Map<String,TTypeQualifierValue> __this__qualifiers = new HashMap<String,TTypeQualifierValue>(other.qualifiers.size());
0137       for (Map.Entry<String, TTypeQualifierValue> other_element : other.qualifiers.entrySet()) {
0138 
0139         String other_element_key = other_element.getKey();
0140         TTypeQualifierValue other_element_value = other_element.getValue();
0141 
0142         String __this__qualifiers_copy_key = other_element_key;
0143 
0144         TTypeQualifierValue __this__qualifiers_copy_value = new TTypeQualifierValue(other_element_value);
0145 
0146         __this__qualifiers.put(__this__qualifiers_copy_key, __this__qualifiers_copy_value);
0147       }
0148       this.qualifiers = __this__qualifiers;
0149     }
0150   }
0151 
0152   public TTypeQualifiers deepCopy() {
0153     return new TTypeQualifiers(this);
0154   }
0155 
0156   @Override
0157   public void clear() {
0158     this.qualifiers = null;
0159   }
0160 
0161   public int getQualifiersSize() {
0162     return (this.qualifiers == null) ? 0 : this.qualifiers.size();
0163   }
0164 
0165   public void putToQualifiers(String key, TTypeQualifierValue val) {
0166     if (this.qualifiers == null) {
0167       this.qualifiers = new HashMap<String,TTypeQualifierValue>();
0168     }
0169     this.qualifiers.put(key, val);
0170   }
0171 
0172   public Map<String,TTypeQualifierValue> getQualifiers() {
0173     return this.qualifiers;
0174   }
0175 
0176   public void setQualifiers(Map<String,TTypeQualifierValue> qualifiers) {
0177     this.qualifiers = qualifiers;
0178   }
0179 
0180   public void unsetQualifiers() {
0181     this.qualifiers = null;
0182   }
0183 
0184   /** Returns true if field qualifiers is set (has been assigned a value) and false otherwise */
0185   public boolean isSetQualifiers() {
0186     return this.qualifiers != null;
0187   }
0188 
0189   public void setQualifiersIsSet(boolean value) {
0190     if (!value) {
0191       this.qualifiers = null;
0192     }
0193   }
0194 
0195   public void setFieldValue(_Fields field, Object value) {
0196     switch (field) {
0197     case QUALIFIERS:
0198       if (value == null) {
0199         unsetQualifiers();
0200       } else {
0201         setQualifiers((Map<String,TTypeQualifierValue>)value);
0202       }
0203       break;
0204 
0205     }
0206   }
0207 
0208   public Object getFieldValue(_Fields field) {
0209     switch (field) {
0210     case QUALIFIERS:
0211       return getQualifiers();
0212 
0213     }
0214     throw new IllegalStateException();
0215   }
0216 
0217   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0218   public boolean isSet(_Fields field) {
0219     if (field == null) {
0220       throw new IllegalArgumentException();
0221     }
0222 
0223     switch (field) {
0224     case QUALIFIERS:
0225       return isSetQualifiers();
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 TTypeQualifiers)
0235       return this.equals((TTypeQualifiers)that);
0236     return false;
0237   }
0238 
0239   public boolean equals(TTypeQualifiers that) {
0240     if (that == null)
0241       return false;
0242 
0243     boolean this_present_qualifiers = true && this.isSetQualifiers();
0244     boolean that_present_qualifiers = true && that.isSetQualifiers();
0245     if (this_present_qualifiers || that_present_qualifiers) {
0246       if (!(this_present_qualifiers && that_present_qualifiers))
0247         return false;
0248       if (!this.qualifiers.equals(that.qualifiers))
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_qualifiers = true && (isSetQualifiers());
0260     list.add(present_qualifiers);
0261     if (present_qualifiers)
0262       list.add(qualifiers);
0263 
0264     return list.hashCode();
0265   }
0266 
0267   @Override
0268   public int compareTo(TTypeQualifiers 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(isSetQualifiers()).compareTo(other.isSetQualifiers());
0276     if (lastComparison != 0) {
0277       return lastComparison;
0278     }
0279     if (isSetQualifiers()) {
0280       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.qualifiers, other.qualifiers);
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("TTypeQualifiers(");
0303     boolean first = true;
0304 
0305     sb.append("qualifiers:");
0306     if (this.qualifiers == null) {
0307       sb.append("null");
0308     } else {
0309       sb.append(this.qualifiers);
0310     }
0311     first = false;
0312     sb.append(")");
0313     return sb.toString();
0314   }
0315 
0316   public void validate() throws org.apache.thrift.TException {
0317     // check for required fields
0318     if (!isSetQualifiers()) {
0319       throw new org.apache.thrift.protocol.TProtocolException("Required field 'qualifiers' is unset! Struct:" + toString());
0320     }
0321 
0322     // check for sub-struct validity
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 TTypeQualifiersStandardSchemeFactory implements SchemeFactory {
0342     public TTypeQualifiersStandardScheme getScheme() {
0343       return new TTypeQualifiersStandardScheme();
0344     }
0345   }
0346 
0347   private static class TTypeQualifiersStandardScheme extends StandardScheme<TTypeQualifiers> {
0348 
0349     public void read(org.apache.thrift.protocol.TProtocol iprot, TTypeQualifiers 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: // QUALIFIERS
0360             if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
0361               {
0362                 org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
0363                 struct.qualifiers = new HashMap<String,TTypeQualifierValue>(2*_map0.size);
0364                 String _key1;
0365                 TTypeQualifierValue _val2;
0366                 for (int _i3 = 0; _i3 < _map0.size; ++_i3)
0367                 {
0368                   _key1 = iprot.readString();
0369                   _val2 = new TTypeQualifierValue();
0370                   _val2.read(iprot);
0371                   struct.qualifiers.put(_key1, _val2);
0372                 }
0373                 iprot.readMapEnd();
0374               }
0375               struct.setQualifiersIsSet(true);
0376             } else { 
0377               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0378             }
0379             break;
0380           default:
0381             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0382         }
0383         iprot.readFieldEnd();
0384       }
0385       iprot.readStructEnd();
0386       struct.validate();
0387     }
0388 
0389     public void write(org.apache.thrift.protocol.TProtocol oprot, TTypeQualifiers struct) throws org.apache.thrift.TException {
0390       struct.validate();
0391 
0392       oprot.writeStructBegin(STRUCT_DESC);
0393       if (struct.qualifiers != null) {
0394         oprot.writeFieldBegin(QUALIFIERS_FIELD_DESC);
0395         {
0396           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.qualifiers.size()));
0397           for (Map.Entry<String, TTypeQualifierValue> _iter4 : struct.qualifiers.entrySet())
0398           {
0399             oprot.writeString(_iter4.getKey());
0400             _iter4.getValue().write(oprot);
0401           }
0402           oprot.writeMapEnd();
0403         }
0404         oprot.writeFieldEnd();
0405       }
0406       oprot.writeFieldStop();
0407       oprot.writeStructEnd();
0408     }
0409 
0410   }
0411 
0412   private static class TTypeQualifiersTupleSchemeFactory implements SchemeFactory {
0413     public TTypeQualifiersTupleScheme getScheme() {
0414       return new TTypeQualifiersTupleScheme();
0415     }
0416   }
0417 
0418   private static class TTypeQualifiersTupleScheme extends TupleScheme<TTypeQualifiers> {
0419 
0420     @Override
0421     public void write(org.apache.thrift.protocol.TProtocol prot, TTypeQualifiers struct) throws org.apache.thrift.TException {
0422       TTupleProtocol oprot = (TTupleProtocol) prot;
0423       {
0424         oprot.writeI32(struct.qualifiers.size());
0425         for (Map.Entry<String, TTypeQualifierValue> _iter5 : struct.qualifiers.entrySet())
0426         {
0427           oprot.writeString(_iter5.getKey());
0428           _iter5.getValue().write(oprot);
0429         }
0430       }
0431     }
0432 
0433     @Override
0434     public void read(org.apache.thrift.protocol.TProtocol prot, TTypeQualifiers struct) throws org.apache.thrift.TException {
0435       TTupleProtocol iprot = (TTupleProtocol) prot;
0436       {
0437         org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
0438         struct.qualifiers = new HashMap<String,TTypeQualifierValue>(2*_map6.size);
0439         String _key7;
0440         TTypeQualifierValue _val8;
0441         for (int _i9 = 0; _i9 < _map6.size; ++_i9)
0442         {
0443           _key7 = iprot.readString();
0444           _val8 = new TTypeQualifierValue();
0445           _val8.read(iprot);
0446           struct.qualifiers.put(_key7, _val8);
0447         }
0448       }
0449       struct.setQualifiersIsSet(true);
0450     }
0451   }
0452 
0453 }
0454