/**
 * Autogenerated by Thrift Compiler (0.11.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.navercorp.pinpoint.thrift.dto;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class TAnnotationValue extends org.apache.thrift.TUnion<TAnnotationValue, TAnnotationValue._Fields> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAnnotationValue");
  private static final org.apache.thrift.protocol.TField STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("stringValue", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField BOOL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("boolValue", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField INT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("intValue", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField LONG_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("longValue", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField SHORT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("shortValue", org.apache.thrift.protocol.TType.I16, (short)5);
  private static final org.apache.thrift.protocol.TField DOUBLE_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleValue", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
  private static final org.apache.thrift.protocol.TField BINARY_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryValue", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField BYTE_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("byteValue", org.apache.thrift.protocol.TType.BYTE, (short)8);
  private static final org.apache.thrift.protocol.TField INT_STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("intStringValue", org.apache.thrift.protocol.TType.STRUCT, (short)9);
  private static final org.apache.thrift.protocol.TField INT_STRING_STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("intStringStringValue", org.apache.thrift.protocol.TType.STRUCT, (short)10);
  private static final org.apache.thrift.protocol.TField LONG_INT_INT_BYTE_BYTE_STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("longIntIntByteByteStringValue", org.apache.thrift.protocol.TType.STRUCT, (short)11);
  private static final org.apache.thrift.protocol.TField INT_BOOLEAN_INT_BOOLEAN_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("intBooleanIntBooleanValue", org.apache.thrift.protocol.TType.STRUCT, (short)12);
  private static final org.apache.thrift.protocol.TField STRING_STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("stringStringValue", org.apache.thrift.protocol.TType.STRUCT, (short)13);

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    STRING_VALUE((short)1, "stringValue"),
    BOOL_VALUE((short)2, "boolValue"),
    INT_VALUE((short)3, "intValue"),
    LONG_VALUE((short)4, "longValue"),
    SHORT_VALUE((short)5, "shortValue"),
    DOUBLE_VALUE((short)6, "doubleValue"),
    BINARY_VALUE((short)7, "binaryValue"),
    BYTE_VALUE((short)8, "byteValue"),
    INT_STRING_VALUE((short)9, "intStringValue"),
    INT_STRING_STRING_VALUE((short)10, "intStringStringValue"),
    LONG_INT_INT_BYTE_BYTE_STRING_VALUE((short)11, "longIntIntByteByteStringValue"),
    INT_BOOLEAN_INT_BOOLEAN_VALUE((short)12, "intBooleanIntBooleanValue"),
    STRING_STRING_VALUE((short)13, "stringStringValue");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // STRING_VALUE
          return STRING_VALUE;
        case 2: // BOOL_VALUE
          return BOOL_VALUE;
        case 3: // INT_VALUE
          return INT_VALUE;
        case 4: // LONG_VALUE
          return LONG_VALUE;
        case 5: // SHORT_VALUE
          return SHORT_VALUE;
        case 6: // DOUBLE_VALUE
          return DOUBLE_VALUE;
        case 7: // BINARY_VALUE
          return BINARY_VALUE;
        case 8: // BYTE_VALUE
          return BYTE_VALUE;
        case 9: // INT_STRING_VALUE
          return INT_STRING_VALUE;
        case 10: // INT_STRING_STRING_VALUE
          return INT_STRING_STRING_VALUE;
        case 11: // LONG_INT_INT_BYTE_BYTE_STRING_VALUE
          return LONG_INT_INT_BYTE_BYTE_STRING_VALUE;
        case 12: // INT_BOOLEAN_INT_BOOLEAN_VALUE
          return INT_BOOLEAN_INT_BOOLEAN_VALUE;
        case 13: // STRING_STRING_VALUE
          return STRING_STRING_VALUE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BOOL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("boolValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.INT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LONG_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SHORT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("shortValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.DOUBLE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("doubleValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.BINARY_VALUE, new org.apache.thrift.meta_data.FieldMetaData("binaryValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.BYTE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("byteValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.INT_STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intStringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TIntStringValue.class)));
    tmpMap.put(_Fields.INT_STRING_STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intStringStringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TIntStringStringValue.class)));
    tmpMap.put(_Fields.LONG_INT_INT_BYTE_BYTE_STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longIntIntByteByteStringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TLongIntIntByteByteStringValue.class)));
    tmpMap.put(_Fields.INT_BOOLEAN_INT_BOOLEAN_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intBooleanIntBooleanValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TIntBooleanIntBooleanValue.class)));
    tmpMap.put(_Fields.STRING_STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringStringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStringStringValue.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAnnotationValue.class, metaDataMap);
  }

  public TAnnotationValue() {
    super();
  }

  public TAnnotationValue(_Fields setField, java.lang.Object value) {
    super(setField, value);
  }

  public TAnnotationValue(TAnnotationValue other) {
    super(other);
  }
  public TAnnotationValue deepCopy() {
    return new TAnnotationValue(this);
  }

  public static TAnnotationValue stringValue(java.lang.String value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setStringValue(value);
    return x;
  }

  public static TAnnotationValue boolValue(boolean value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setBoolValue(value);
    return x;
  }

  public static TAnnotationValue intValue(int value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setIntValue(value);
    return x;
  }

  public static TAnnotationValue longValue(long value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setLongValue(value);
    return x;
  }

  public static TAnnotationValue shortValue(short value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setShortValue(value);
    return x;
  }

  public static TAnnotationValue doubleValue(double value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setDoubleValue(value);
    return x;
  }

  public static TAnnotationValue binaryValue(java.nio.ByteBuffer value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setBinaryValue(value);
    return x;
  }

  public static TAnnotationValue binaryValue(byte[] value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setBinaryValue(java.nio.ByteBuffer.wrap(value.clone()));
    return x;
  }

  public static TAnnotationValue byteValue(byte value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setByteValue(value);
    return x;
  }

  public static TAnnotationValue intStringValue(TIntStringValue value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setIntStringValue(value);
    return x;
  }

  public static TAnnotationValue intStringStringValue(TIntStringStringValue value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setIntStringStringValue(value);
    return x;
  }

  public static TAnnotationValue longIntIntByteByteStringValue(TLongIntIntByteByteStringValue value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setLongIntIntByteByteStringValue(value);
    return x;
  }

  public static TAnnotationValue intBooleanIntBooleanValue(TIntBooleanIntBooleanValue value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setIntBooleanIntBooleanValue(value);
    return x;
  }

  public static TAnnotationValue stringStringValue(TStringStringValue value) {
    TAnnotationValue x = new TAnnotationValue();
    x.setStringStringValue(value);
    return x;
  }


  @Override
  protected void checkType(_Fields setField, java.lang.Object value) throws java.lang.ClassCastException {
    switch (setField) {
      case STRING_VALUE:
        if (value instanceof java.lang.String) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.String for field 'stringValue', but got " + value.getClass().getSimpleName());
      case BOOL_VALUE:
        if (value instanceof java.lang.Boolean) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Boolean for field 'boolValue', but got " + value.getClass().getSimpleName());
      case INT_VALUE:
        if (value instanceof java.lang.Integer) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Integer for field 'intValue', but got " + value.getClass().getSimpleName());
      case LONG_VALUE:
        if (value instanceof java.lang.Long) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Long for field 'longValue', but got " + value.getClass().getSimpleName());
      case SHORT_VALUE:
        if (value instanceof java.lang.Short) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Short for field 'shortValue', but got " + value.getClass().getSimpleName());
      case DOUBLE_VALUE:
        if (value instanceof java.lang.Double) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Double for field 'doubleValue', but got " + value.getClass().getSimpleName());
      case BINARY_VALUE:
        if (value instanceof java.nio.ByteBuffer) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.nio.ByteBuffer for field 'binaryValue', but got " + value.getClass().getSimpleName());
      case BYTE_VALUE:
        if (value instanceof java.lang.Byte) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type java.lang.Byte for field 'byteValue', but got " + value.getClass().getSimpleName());
      case INT_STRING_VALUE:
        if (value instanceof TIntStringValue) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type TIntStringValue for field 'intStringValue', but got " + value.getClass().getSimpleName());
      case INT_STRING_STRING_VALUE:
        if (value instanceof TIntStringStringValue) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type TIntStringStringValue for field 'intStringStringValue', but got " + value.getClass().getSimpleName());
      case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
        if (value instanceof TLongIntIntByteByteStringValue) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type TLongIntIntByteByteStringValue for field 'longIntIntByteByteStringValue', but got " + value.getClass().getSimpleName());
      case INT_BOOLEAN_INT_BOOLEAN_VALUE:
        if (value instanceof TIntBooleanIntBooleanValue) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type TIntBooleanIntBooleanValue for field 'intBooleanIntBooleanValue', but got " + value.getClass().getSimpleName());
      case STRING_STRING_VALUE:
        if (value instanceof TStringStringValue) {
          break;
        }
        throw new java.lang.ClassCastException("Was expecting value of type TStringStringValue for field 'stringStringValue', but got " + value.getClass().getSimpleName());
      default:
        throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  protected java.lang.Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
      switch (setField) {
        case STRING_VALUE:
          if (field.type == STRING_VALUE_FIELD_DESC.type) {
            java.lang.String stringValue;
            stringValue = iprot.readString();
            return stringValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case BOOL_VALUE:
          if (field.type == BOOL_VALUE_FIELD_DESC.type) {
            java.lang.Boolean boolValue;
            boolValue = iprot.readBool();
            return boolValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case INT_VALUE:
          if (field.type == INT_VALUE_FIELD_DESC.type) {
            java.lang.Integer intValue;
            intValue = iprot.readI32();
            return intValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case LONG_VALUE:
          if (field.type == LONG_VALUE_FIELD_DESC.type) {
            java.lang.Long longValue;
            longValue = iprot.readI64();
            return longValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case SHORT_VALUE:
          if (field.type == SHORT_VALUE_FIELD_DESC.type) {
            java.lang.Short shortValue;
            shortValue = iprot.readI16();
            return shortValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case DOUBLE_VALUE:
          if (field.type == DOUBLE_VALUE_FIELD_DESC.type) {
            java.lang.Double doubleValue;
            doubleValue = iprot.readDouble();
            return doubleValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case BINARY_VALUE:
          if (field.type == BINARY_VALUE_FIELD_DESC.type) {
            java.nio.ByteBuffer binaryValue;
            binaryValue = iprot.readBinary();
            return binaryValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case BYTE_VALUE:
          if (field.type == BYTE_VALUE_FIELD_DESC.type) {
            java.lang.Byte byteValue;
            byteValue = iprot.readByte();
            return byteValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case INT_STRING_VALUE:
          if (field.type == INT_STRING_VALUE_FIELD_DESC.type) {
            TIntStringValue intStringValue;
            intStringValue = new TIntStringValue();
            intStringValue.read(iprot);
            return intStringValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case INT_STRING_STRING_VALUE:
          if (field.type == INT_STRING_STRING_VALUE_FIELD_DESC.type) {
            TIntStringStringValue intStringStringValue;
            intStringStringValue = new TIntStringStringValue();
            intStringStringValue.read(iprot);
            return intStringStringValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
          if (field.type == LONG_INT_INT_BYTE_BYTE_STRING_VALUE_FIELD_DESC.type) {
            TLongIntIntByteByteStringValue longIntIntByteByteStringValue;
            longIntIntByteByteStringValue = new TLongIntIntByteByteStringValue();
            longIntIntByteByteStringValue.read(iprot);
            return longIntIntByteByteStringValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case INT_BOOLEAN_INT_BOOLEAN_VALUE:
          if (field.type == INT_BOOLEAN_INT_BOOLEAN_VALUE_FIELD_DESC.type) {
            TIntBooleanIntBooleanValue intBooleanIntBooleanValue;
            intBooleanIntBooleanValue = new TIntBooleanIntBooleanValue();
            intBooleanIntBooleanValue.read(iprot);
            return intBooleanIntBooleanValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case STRING_STRING_VALUE:
          if (field.type == STRING_STRING_VALUE_FIELD_DESC.type) {
            TStringStringValue stringStringValue;
            stringStringValue = new TStringStringValue();
            stringStringValue.read(iprot);
            return stringStringValue;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        default:
          throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
      }
    } else {
      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      return null;
    }
  }

  @Override
  protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    switch (setField_) {
      case STRING_VALUE:
        java.lang.String stringValue = (java.lang.String)value_;
        oprot.writeString(stringValue);
        return;
      case BOOL_VALUE:
        java.lang.Boolean boolValue = (java.lang.Boolean)value_;
        oprot.writeBool(boolValue);
        return;
      case INT_VALUE:
        java.lang.Integer intValue = (java.lang.Integer)value_;
        oprot.writeI32(intValue);
        return;
      case LONG_VALUE:
        java.lang.Long longValue = (java.lang.Long)value_;
        oprot.writeI64(longValue);
        return;
      case SHORT_VALUE:
        java.lang.Short shortValue = (java.lang.Short)value_;
        oprot.writeI16(shortValue);
        return;
      case DOUBLE_VALUE:
        java.lang.Double doubleValue = (java.lang.Double)value_;
        oprot.writeDouble(doubleValue);
        return;
      case BINARY_VALUE:
        java.nio.ByteBuffer binaryValue = (java.nio.ByteBuffer)value_;
        oprot.writeBinary(binaryValue);
        return;
      case BYTE_VALUE:
        java.lang.Byte byteValue = (java.lang.Byte)value_;
        oprot.writeByte(byteValue);
        return;
      case INT_STRING_VALUE:
        TIntStringValue intStringValue = (TIntStringValue)value_;
        intStringValue.write(oprot);
        return;
      case INT_STRING_STRING_VALUE:
        TIntStringStringValue intStringStringValue = (TIntStringStringValue)value_;
        intStringStringValue.write(oprot);
        return;
      case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
        TLongIntIntByteByteStringValue longIntIntByteByteStringValue = (TLongIntIntByteByteStringValue)value_;
        longIntIntByteByteStringValue.write(oprot);
        return;
      case INT_BOOLEAN_INT_BOOLEAN_VALUE:
        TIntBooleanIntBooleanValue intBooleanIntBooleanValue = (TIntBooleanIntBooleanValue)value_;
        intBooleanIntBooleanValue.write(oprot);
        return;
      case STRING_STRING_VALUE:
        TStringStringValue stringStringValue = (TStringStringValue)value_;
        stringStringValue.write(oprot);
        return;
      default:
        throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
    }
  }

  @Override
  protected java.lang.Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(fieldID);
    if (setField != null) {
      switch (setField) {
        case STRING_VALUE:
          java.lang.String stringValue;
          stringValue = iprot.readString();
          return stringValue;
        case BOOL_VALUE:
          java.lang.Boolean boolValue;
          boolValue = iprot.readBool();
          return boolValue;
        case INT_VALUE:
          java.lang.Integer intValue;
          intValue = iprot.readI32();
          return intValue;
        case LONG_VALUE:
          java.lang.Long longValue;
          longValue = iprot.readI64();
          return longValue;
        case SHORT_VALUE:
          java.lang.Short shortValue;
          shortValue = iprot.readI16();
          return shortValue;
        case DOUBLE_VALUE:
          java.lang.Double doubleValue;
          doubleValue = iprot.readDouble();
          return doubleValue;
        case BINARY_VALUE:
          java.nio.ByteBuffer binaryValue;
          binaryValue = iprot.readBinary();
          return binaryValue;
        case BYTE_VALUE:
          java.lang.Byte byteValue;
          byteValue = iprot.readByte();
          return byteValue;
        case INT_STRING_VALUE:
          TIntStringValue intStringValue;
          intStringValue = new TIntStringValue();
          intStringValue.read(iprot);
          return intStringValue;
        case INT_STRING_STRING_VALUE:
          TIntStringStringValue intStringStringValue;
          intStringStringValue = new TIntStringStringValue();
          intStringStringValue.read(iprot);
          return intStringStringValue;
        case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
          TLongIntIntByteByteStringValue longIntIntByteByteStringValue;
          longIntIntByteByteStringValue = new TLongIntIntByteByteStringValue();
          longIntIntByteByteStringValue.read(iprot);
          return longIntIntByteByteStringValue;
        case INT_BOOLEAN_INT_BOOLEAN_VALUE:
          TIntBooleanIntBooleanValue intBooleanIntBooleanValue;
          intBooleanIntBooleanValue = new TIntBooleanIntBooleanValue();
          intBooleanIntBooleanValue.read(iprot);
          return intBooleanIntBooleanValue;
        case STRING_STRING_VALUE:
          TStringStringValue stringStringValue;
          stringStringValue = new TStringStringValue();
          stringStringValue.read(iprot);
          return stringStringValue;
        default:
          throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
      }
    } else {
      throw new org.apache.thrift.protocol.TProtocolException("Couldn't find a field with field id " + fieldID);
    }
  }

  @Override
  protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    switch (setField_) {
      case STRING_VALUE:
        java.lang.String stringValue = (java.lang.String)value_;
        oprot.writeString(stringValue);
        return;
      case BOOL_VALUE:
        java.lang.Boolean boolValue = (java.lang.Boolean)value_;
        oprot.writeBool(boolValue);
        return;
      case INT_VALUE:
        java.lang.Integer intValue = (java.lang.Integer)value_;
        oprot.writeI32(intValue);
        return;
      case LONG_VALUE:
        java.lang.Long longValue = (java.lang.Long)value_;
        oprot.writeI64(longValue);
        return;
      case SHORT_VALUE:
        java.lang.Short shortValue = (java.lang.Short)value_;
        oprot.writeI16(shortValue);
        return;
      case DOUBLE_VALUE:
        java.lang.Double doubleValue = (java.lang.Double)value_;
        oprot.writeDouble(doubleValue);
        return;
      case BINARY_VALUE:
        java.nio.ByteBuffer binaryValue = (java.nio.ByteBuffer)value_;
        oprot.writeBinary(binaryValue);
        return;
      case BYTE_VALUE:
        java.lang.Byte byteValue = (java.lang.Byte)value_;
        oprot.writeByte(byteValue);
        return;
      case INT_STRING_VALUE:
        TIntStringValue intStringValue = (TIntStringValue)value_;
        intStringValue.write(oprot);
        return;
      case INT_STRING_STRING_VALUE:
        TIntStringStringValue intStringStringValue = (TIntStringStringValue)value_;
        intStringStringValue.write(oprot);
        return;
      case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
        TLongIntIntByteByteStringValue longIntIntByteByteStringValue = (TLongIntIntByteByteStringValue)value_;
        longIntIntByteByteStringValue.write(oprot);
        return;
      case INT_BOOLEAN_INT_BOOLEAN_VALUE:
        TIntBooleanIntBooleanValue intBooleanIntBooleanValue = (TIntBooleanIntBooleanValue)value_;
        intBooleanIntBooleanValue.write(oprot);
        return;
      case STRING_STRING_VALUE:
        TStringStringValue stringStringValue = (TStringStringValue)value_;
        stringStringValue.write(oprot);
        return;
      default:
        throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
    }
  }

  @Override
  protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
    switch (setField) {
      case STRING_VALUE:
        return STRING_VALUE_FIELD_DESC;
      case BOOL_VALUE:
        return BOOL_VALUE_FIELD_DESC;
      case INT_VALUE:
        return INT_VALUE_FIELD_DESC;
      case LONG_VALUE:
        return LONG_VALUE_FIELD_DESC;
      case SHORT_VALUE:
        return SHORT_VALUE_FIELD_DESC;
      case DOUBLE_VALUE:
        return DOUBLE_VALUE_FIELD_DESC;
      case BINARY_VALUE:
        return BINARY_VALUE_FIELD_DESC;
      case BYTE_VALUE:
        return BYTE_VALUE_FIELD_DESC;
      case INT_STRING_VALUE:
        return INT_STRING_VALUE_FIELD_DESC;
      case INT_STRING_STRING_VALUE:
        return INT_STRING_STRING_VALUE_FIELD_DESC;
      case LONG_INT_INT_BYTE_BYTE_STRING_VALUE:
        return LONG_INT_INT_BYTE_BYTE_STRING_VALUE_FIELD_DESC;
      case INT_BOOLEAN_INT_BOOLEAN_VALUE:
        return INT_BOOLEAN_INT_BOOLEAN_VALUE_FIELD_DESC;
      case STRING_STRING_VALUE:
        return STRING_STRING_VALUE_FIELD_DESC;
      default:
        throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  protected org.apache.thrift.protocol.TStruct getStructDesc() {
    return STRUCT_DESC;
  }

  @Override
  protected _Fields enumForId(short id) {
    return _Fields.findByThriftIdOrThrow(id);
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }


  public java.lang.String getStringValue() {
    if (getSetField() == _Fields.STRING_VALUE) {
      return (java.lang.String)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'stringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setStringValue(java.lang.String value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.STRING_VALUE;
    value_ = value;
  }

  public boolean getBoolValue() {
    if (getSetField() == _Fields.BOOL_VALUE) {
      return (java.lang.Boolean)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'boolValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setBoolValue(boolean value) {
    setField_ = _Fields.BOOL_VALUE;
    value_ = value;
  }

  public int getIntValue() {
    if (getSetField() == _Fields.INT_VALUE) {
      return (java.lang.Integer)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'intValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setIntValue(int value) {
    setField_ = _Fields.INT_VALUE;
    value_ = value;
  }

  public long getLongValue() {
    if (getSetField() == _Fields.LONG_VALUE) {
      return (java.lang.Long)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'longValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setLongValue(long value) {
    setField_ = _Fields.LONG_VALUE;
    value_ = value;
  }

  public short getShortValue() {
    if (getSetField() == _Fields.SHORT_VALUE) {
      return (java.lang.Short)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'shortValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setShortValue(short value) {
    setField_ = _Fields.SHORT_VALUE;
    value_ = value;
  }

  public double getDoubleValue() {
    if (getSetField() == _Fields.DOUBLE_VALUE) {
      return (java.lang.Double)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'doubleValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setDoubleValue(double value) {
    setField_ = _Fields.DOUBLE_VALUE;
    value_ = value;
  }

  public byte[] getBinaryValue() {
    setBinaryValue(org.apache.thrift.TBaseHelper.rightSize(bufferForBinaryValue()));
    java.nio.ByteBuffer b = bufferForBinaryValue();
    return b == null ? null : b.array();
  }

  public java.nio.ByteBuffer bufferForBinaryValue() {
    if (getSetField() == _Fields.BINARY_VALUE) {
      return org.apache.thrift.TBaseHelper.copyBinary((java.nio.ByteBuffer)getFieldValue());
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'binaryValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setBinaryValue(byte[] value) {
    setBinaryValue(java.nio.ByteBuffer.wrap(value.clone()));
  }

  public void setBinaryValue(java.nio.ByteBuffer value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.BINARY_VALUE;
    value_ = value;
  }

  public byte getByteValue() {
    if (getSetField() == _Fields.BYTE_VALUE) {
      return (java.lang.Byte)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'byteValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setByteValue(byte value) {
    setField_ = _Fields.BYTE_VALUE;
    value_ = value;
  }

  public TIntStringValue getIntStringValue() {
    if (getSetField() == _Fields.INT_STRING_VALUE) {
      return (TIntStringValue)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'intStringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setIntStringValue(TIntStringValue value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.INT_STRING_VALUE;
    value_ = value;
  }

  public TIntStringStringValue getIntStringStringValue() {
    if (getSetField() == _Fields.INT_STRING_STRING_VALUE) {
      return (TIntStringStringValue)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'intStringStringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setIntStringStringValue(TIntStringStringValue value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.INT_STRING_STRING_VALUE;
    value_ = value;
  }

  public TLongIntIntByteByteStringValue getLongIntIntByteByteStringValue() {
    if (getSetField() == _Fields.LONG_INT_INT_BYTE_BYTE_STRING_VALUE) {
      return (TLongIntIntByteByteStringValue)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'longIntIntByteByteStringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setLongIntIntByteByteStringValue(TLongIntIntByteByteStringValue value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.LONG_INT_INT_BYTE_BYTE_STRING_VALUE;
    value_ = value;
  }

  public TIntBooleanIntBooleanValue getIntBooleanIntBooleanValue() {
    if (getSetField() == _Fields.INT_BOOLEAN_INT_BOOLEAN_VALUE) {
      return (TIntBooleanIntBooleanValue)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'intBooleanIntBooleanValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setIntBooleanIntBooleanValue(TIntBooleanIntBooleanValue value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.INT_BOOLEAN_INT_BOOLEAN_VALUE;
    value_ = value;
  }

  public TStringStringValue getStringStringValue() {
    if (getSetField() == _Fields.STRING_STRING_VALUE) {
      return (TStringStringValue)getFieldValue();
    } else {
      throw new java.lang.RuntimeException("Cannot get field 'stringStringValue' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setStringStringValue(TStringStringValue value) {
    if (value == null) throw new java.lang.NullPointerException();
    setField_ = _Fields.STRING_STRING_VALUE;
    value_ = value;
  }

  public boolean isSetStringValue() {
    return setField_ == _Fields.STRING_VALUE;
  }


  public boolean isSetBoolValue() {
    return setField_ == _Fields.BOOL_VALUE;
  }


  public boolean isSetIntValue() {
    return setField_ == _Fields.INT_VALUE;
  }


  public boolean isSetLongValue() {
    return setField_ == _Fields.LONG_VALUE;
  }


  public boolean isSetShortValue() {
    return setField_ == _Fields.SHORT_VALUE;
  }


  public boolean isSetDoubleValue() {
    return setField_ == _Fields.DOUBLE_VALUE;
  }


  public boolean isSetBinaryValue() {
    return setField_ == _Fields.BINARY_VALUE;
  }


  public boolean isSetByteValue() {
    return setField_ == _Fields.BYTE_VALUE;
  }


  public boolean isSetIntStringValue() {
    return setField_ == _Fields.INT_STRING_VALUE;
  }


  public boolean isSetIntStringStringValue() {
    return setField_ == _Fields.INT_STRING_STRING_VALUE;
  }


  public boolean isSetLongIntIntByteByteStringValue() {
    return setField_ == _Fields.LONG_INT_INT_BYTE_BYTE_STRING_VALUE;
  }


  public boolean isSetIntBooleanIntBooleanValue() {
    return setField_ == _Fields.INT_BOOLEAN_INT_BOOLEAN_VALUE;
  }


  public boolean isSetStringStringValue() {
    return setField_ == _Fields.STRING_STRING_VALUE;
  }


  public boolean equals(java.lang.Object other) {
    if (other instanceof TAnnotationValue) {
      return equals((TAnnotationValue)other);
    } else {
      return false;
    }
  }

  public boolean equals(TAnnotationValue other) {
    return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
  }

  @Override
  public int compareTo(TAnnotationValue other) {
    int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
    if (lastComparison == 0) {
      return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
    }
    return lastComparison;
  }


  @Override
  public int hashCode() {
    java.util.List<java.lang.Object> list = new java.util.ArrayList<java.lang.Object>();
    list.add(this.getClass().getName());
    org.apache.thrift.TFieldIdEnum setField = getSetField();
    if (setField != null) {
      list.add(setField.getThriftFieldId());
      java.lang.Object value = getFieldValue();
      if (value instanceof org.apache.thrift.TEnum) {
        list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue());
      } else {
        list.add(value);
      }
    }
    return list.hashCode();
  }
  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }


  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }


}
