/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

package com.pivotal.gemfirexd.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FieldValue implements org.apache.thrift.TBase<FieldValue, FieldValue._Fields>, java.io.Serializable, Comparable<FieldValue> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FieldValue");

  private static final org.apache.thrift.protocol.TField BOOL_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("bool_val", org.apache.thrift.protocol.TType.BOOL, (short)1);
  private static final org.apache.thrift.protocol.TField BYTE_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("byte_val", org.apache.thrift.protocol.TType.BYTE, (short)2);
  private static final org.apache.thrift.protocol.TField CHAR_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("char_val", org.apache.thrift.protocol.TType.I16, (short)3);
  private static final org.apache.thrift.protocol.TField SHORT_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("short_val", org.apache.thrift.protocol.TType.I16, (short)4);
  private static final org.apache.thrift.protocol.TField INT_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("int_val", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField LONG_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("long_val", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField FLOAT_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("float_val", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField DOUBLE_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("double_val", org.apache.thrift.protocol.TType.DOUBLE, (short)8);
  private static final org.apache.thrift.protocol.TField STRING_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("string_val", org.apache.thrift.protocol.TType.STRING, (short)9);
  private static final org.apache.thrift.protocol.TField DECIMAL_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("decimal_val", org.apache.thrift.protocol.TType.STRUCT, (short)10);
  private static final org.apache.thrift.protocol.TField TIMESTAMP_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp_val", org.apache.thrift.protocol.TType.STRUCT, (short)11);
  private static final org.apache.thrift.protocol.TField BOOL_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("bool_array", org.apache.thrift.protocol.TType.LIST, (short)12);
  private static final org.apache.thrift.protocol.TField BYTE_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("byte_array", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField CHAR_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("char_array", org.apache.thrift.protocol.TType.STRING, (short)14);
  private static final org.apache.thrift.protocol.TField SHORT_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("short_array", org.apache.thrift.protocol.TType.LIST, (short)15);
  private static final org.apache.thrift.protocol.TField INT_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("int_array", org.apache.thrift.protocol.TType.LIST, (short)16);
  private static final org.apache.thrift.protocol.TField LONG_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("long_array", org.apache.thrift.protocol.TType.LIST, (short)17);
  private static final org.apache.thrift.protocol.TField FLOAT_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("float_array", org.apache.thrift.protocol.TType.LIST, (short)18);
  private static final org.apache.thrift.protocol.TField DOUBLE_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("double_array", org.apache.thrift.protocol.TType.LIST, (short)19);
  private static final org.apache.thrift.protocol.TField STRING_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("string_array", org.apache.thrift.protocol.TType.LIST, (short)20);
  private static final org.apache.thrift.protocol.TField BYTE_ARRAY_ARRAY_FIELD_DESC = new org.apache.thrift.protocol.TField("byte_array_array", org.apache.thrift.protocol.TType.LIST, (short)21);
  private static final org.apache.thrift.protocol.TField REF_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("ref_val", org.apache.thrift.protocol.TType.I32, (short)22);
  private static final org.apache.thrift.protocol.TField LIST_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("list_val", org.apache.thrift.protocol.TType.LIST, (short)23);
  private static final org.apache.thrift.protocol.TField NATIVE_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("native_val", org.apache.thrift.protocol.TType.STRING, (short)24);
  private static final org.apache.thrift.protocol.TField NULL_VAL_FIELD_DESC = new org.apache.thrift.protocol.TField("null_val", org.apache.thrift.protocol.TType.BOOL, (short)25);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new FieldValueStandardSchemeFactory());
    schemes.put(TupleScheme.class, new FieldValueTupleSchemeFactory());
  }

  public boolean bool_val; // optional
  public byte byte_val; // optional
  public short char_val; // optional
  public short short_val; // optional
  public int int_val; // optional
  public long long_val; // optional
  public int float_val; // optional
  public double double_val; // optional
  public String string_val; // optional
  public Decimal decimal_val; // optional
  public Timestamp timestamp_val; // optional
  public List<Boolean> bool_array; // optional
  public ByteBuffer byte_array; // optional
  public String char_array; // optional
  public List<Short> short_array; // optional
  public List<Integer> int_array; // optional
  public List<Long> long_array; // optional
  public List<Integer> float_array; // optional
  public List<Double> double_array; // optional
  public List<String> string_array; // optional
  public List<ByteBuffer> byte_array_array; // optional
  public int ref_val; // optional
  public List<Integer> list_val; // optional
  public ByteBuffer native_val; // optional
  public boolean null_val; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    BOOL_VAL((short)1, "bool_val"),
    BYTE_VAL((short)2, "byte_val"),
    CHAR_VAL((short)3, "char_val"),
    SHORT_VAL((short)4, "short_val"),
    INT_VAL((short)5, "int_val"),
    LONG_VAL((short)6, "long_val"),
    FLOAT_VAL((short)7, "float_val"),
    DOUBLE_VAL((short)8, "double_val"),
    STRING_VAL((short)9, "string_val"),
    DECIMAL_VAL((short)10, "decimal_val"),
    TIMESTAMP_VAL((short)11, "timestamp_val"),
    BOOL_ARRAY((short)12, "bool_array"),
    BYTE_ARRAY((short)13, "byte_array"),
    CHAR_ARRAY((short)14, "char_array"),
    SHORT_ARRAY((short)15, "short_array"),
    INT_ARRAY((short)16, "int_array"),
    LONG_ARRAY((short)17, "long_array"),
    FLOAT_ARRAY((short)18, "float_array"),
    DOUBLE_ARRAY((short)19, "double_array"),
    STRING_ARRAY((short)20, "string_array"),
    BYTE_ARRAY_ARRAY((short)21, "byte_array_array"),
    REF_VAL((short)22, "ref_val"),
    LIST_VAL((short)23, "list_val"),
    NATIVE_VAL((short)24, "native_val"),
    NULL_VAL((short)25, "null_val");

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

    static {
      for (_Fields field : 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: // BOOL_VAL
          return BOOL_VAL;
        case 2: // BYTE_VAL
          return BYTE_VAL;
        case 3: // CHAR_VAL
          return CHAR_VAL;
        case 4: // SHORT_VAL
          return SHORT_VAL;
        case 5: // INT_VAL
          return INT_VAL;
        case 6: // LONG_VAL
          return LONG_VAL;
        case 7: // FLOAT_VAL
          return FLOAT_VAL;
        case 8: // DOUBLE_VAL
          return DOUBLE_VAL;
        case 9: // STRING_VAL
          return STRING_VAL;
        case 10: // DECIMAL_VAL
          return DECIMAL_VAL;
        case 11: // TIMESTAMP_VAL
          return TIMESTAMP_VAL;
        case 12: // BOOL_ARRAY
          return BOOL_ARRAY;
        case 13: // BYTE_ARRAY
          return BYTE_ARRAY;
        case 14: // CHAR_ARRAY
          return CHAR_ARRAY;
        case 15: // SHORT_ARRAY
          return SHORT_ARRAY;
        case 16: // INT_ARRAY
          return INT_ARRAY;
        case 17: // LONG_ARRAY
          return LONG_ARRAY;
        case 18: // FLOAT_ARRAY
          return FLOAT_ARRAY;
        case 19: // DOUBLE_ARRAY
          return DOUBLE_ARRAY;
        case 20: // STRING_ARRAY
          return STRING_ARRAY;
        case 21: // BYTE_ARRAY_ARRAY
          return BYTE_ARRAY_ARRAY;
        case 22: // REF_VAL
          return REF_VAL;
        case 23: // LIST_VAL
          return LIST_VAL;
        case 24: // NATIVE_VAL
          return NATIVE_VAL;
        case 25: // NULL_VAL
          return NULL_VAL;
        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 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(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final int __BOOL_VAL_ISSET_ID = 0;
  public static final int __BYTE_VAL_ISSET_ID = 1;
  public static final int __CHAR_VAL_ISSET_ID = 2;
  public static final int __SHORT_VAL_ISSET_ID = 3;
  public static final int __INT_VAL_ISSET_ID = 4;
  public static final int __LONG_VAL_ISSET_ID = 5;
  public static final int __FLOAT_VAL_ISSET_ID = 6;
  public static final int __DOUBLE_VAL_ISSET_ID = 7;
  public static final int __REF_VAL_ISSET_ID = 8;
  public static final int __NULL_VAL_ISSET_ID = 9;
  public short __isset_bitfield = 0;
  private _Fields optionals[] = {_Fields.BOOL_VAL,_Fields.BYTE_VAL,_Fields.CHAR_VAL,_Fields.SHORT_VAL,_Fields.INT_VAL,_Fields.LONG_VAL,_Fields.FLOAT_VAL,_Fields.DOUBLE_VAL,_Fields.STRING_VAL,_Fields.DECIMAL_VAL,_Fields.TIMESTAMP_VAL,_Fields.BOOL_ARRAY,_Fields.BYTE_ARRAY,_Fields.CHAR_ARRAY,_Fields.SHORT_ARRAY,_Fields.INT_ARRAY,_Fields.LONG_ARRAY,_Fields.FLOAT_ARRAY,_Fields.DOUBLE_ARRAY,_Fields.STRING_ARRAY,_Fields.BYTE_ARRAY_ARRAY,_Fields.REF_VAL,_Fields.LIST_VAL,_Fields.NATIVE_VAL,_Fields.NULL_VAL};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.BOOL_VAL, new org.apache.thrift.meta_data.FieldMetaData("bool_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.BYTE_VAL, new org.apache.thrift.meta_data.FieldMetaData("byte_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.CHAR_VAL, new org.apache.thrift.meta_data.FieldMetaData("char_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.SHORT_VAL, new org.apache.thrift.meta_data.FieldMetaData("short_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.INT_VAL, new org.apache.thrift.meta_data.FieldMetaData("int_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LONG_VAL, new org.apache.thrift.meta_data.FieldMetaData("long_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FLOAT_VAL, new org.apache.thrift.meta_data.FieldMetaData("float_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.DOUBLE_VAL, new org.apache.thrift.meta_data.FieldMetaData("double_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.STRING_VAL, new org.apache.thrift.meta_data.FieldMetaData("string_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DECIMAL_VAL, new org.apache.thrift.meta_data.FieldMetaData("decimal_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Decimal.class)));
    tmpMap.put(_Fields.TIMESTAMP_VAL, new org.apache.thrift.meta_data.FieldMetaData("timestamp_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Timestamp.class)));
    tmpMap.put(_Fields.BOOL_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("bool_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))));
    tmpMap.put(_Fields.BYTE_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("byte_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.CHAR_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("char_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SHORT_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("short_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16))));
    tmpMap.put(_Fields.INT_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("int_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.LONG_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("long_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.FLOAT_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("float_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.DOUBLE_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("double_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))));
    tmpMap.put(_Fields.STRING_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("string_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.BYTE_ARRAY_ARRAY, new org.apache.thrift.meta_data.FieldMetaData("byte_array_array", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , true))));
    tmpMap.put(_Fields.REF_VAL, new org.apache.thrift.meta_data.FieldMetaData("ref_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LIST_VAL, new org.apache.thrift.meta_data.FieldMetaData("list_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.NATIVE_VAL, new org.apache.thrift.meta_data.FieldMetaData("native_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.NULL_VAL, new org.apache.thrift.meta_data.FieldMetaData("null_val", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FieldValue.class, metaDataMap);
  }

  public FieldValue() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public FieldValue(FieldValue other) {
    __isset_bitfield = other.__isset_bitfield;
    this.bool_val = other.bool_val;
    this.byte_val = other.byte_val;
    this.char_val = other.char_val;
    this.short_val = other.short_val;
    this.int_val = other.int_val;
    this.long_val = other.long_val;
    this.float_val = other.float_val;
    this.double_val = other.double_val;
    if (other.isSetString_val()) {
      this.string_val = other.string_val;
    }
    if (other.isSetDecimal_val()) {
      this.decimal_val = new Decimal(other.decimal_val);
    }
    if (other.isSetTimestamp_val()) {
      this.timestamp_val = new Timestamp(other.timestamp_val);
    }
    if (other.isSetBool_array()) {
      List<Boolean> __this__bool_array = new ArrayList<Boolean>(other.bool_array);
      this.bool_array = __this__bool_array;
    }
    if (other.isSetByte_array()) {
      this.byte_array = org.apache.thrift.TBaseHelper.copyBinary(other.byte_array);
;
    }
    if (other.isSetChar_array()) {
      this.char_array = other.char_array;
    }
    if (other.isSetShort_array()) {
      List<Short> __this__short_array = new ArrayList<Short>(other.short_array);
      this.short_array = __this__short_array;
    }
    if (other.isSetInt_array()) {
      List<Integer> __this__int_array = new ArrayList<Integer>(other.int_array);
      this.int_array = __this__int_array;
    }
    if (other.isSetLong_array()) {
      List<Long> __this__long_array = new ArrayList<Long>(other.long_array);
      this.long_array = __this__long_array;
    }
    if (other.isSetFloat_array()) {
      List<Integer> __this__float_array = new ArrayList<Integer>(other.float_array);
      this.float_array = __this__float_array;
    }
    if (other.isSetDouble_array()) {
      List<Double> __this__double_array = new ArrayList<Double>(other.double_array);
      this.double_array = __this__double_array;
    }
    if (other.isSetString_array()) {
      List<String> __this__string_array = new ArrayList<String>(other.string_array);
      this.string_array = __this__string_array;
    }
    if (other.isSetByte_array_array()) {
      List<ByteBuffer> __this__byte_array_array = new ArrayList<ByteBuffer>(other.byte_array_array);
      this.byte_array_array = __this__byte_array_array;
    }
    this.ref_val = other.ref_val;
    if (other.isSetList_val()) {
      List<Integer> __this__list_val = new ArrayList<Integer>(other.list_val);
      this.list_val = __this__list_val;
    }
    if (other.isSetNative_val()) {
      this.native_val = org.apache.thrift.TBaseHelper.copyBinary(other.native_val);
;
    }
    this.null_val = other.null_val;
  }

  public FieldValue deepCopy() {
    return new FieldValue(this);
  }

  @Override
  public void clear() {
    setBool_valIsSet(false);
    this.bool_val = false;
    setByte_valIsSet(false);
    this.byte_val = 0;
    setChar_valIsSet(false);
    this.char_val = 0;
    setShort_valIsSet(false);
    this.short_val = 0;
    setInt_valIsSet(false);
    this.int_val = 0;
    setLong_valIsSet(false);
    this.long_val = 0;
    setFloat_valIsSet(false);
    this.float_val = 0;
    setDouble_valIsSet(false);
    this.double_val = 0.0;
    this.string_val = null;
    this.decimal_val = null;
    this.timestamp_val = null;
    this.bool_array = null;
    this.byte_array = null;
    this.char_array = null;
    this.short_array = null;
    this.int_array = null;
    this.long_array = null;
    this.float_array = null;
    this.double_array = null;
    this.string_array = null;
    this.byte_array_array = null;
    setRef_valIsSet(false);
    this.ref_val = 0;
    this.list_val = null;
    this.native_val = null;
    setNull_valIsSet(false);
    this.null_val = false;
  }

  public boolean isBool_val() {
    return this.bool_val;
  }

  public FieldValue setBool_val(boolean bool_val) {
    this.bool_val = bool_val;
    setBool_valIsSet(true);
    return this;
  }

  public void unsetBool_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BOOL_VAL_ISSET_ID);
  }

  /** Returns true if field bool_val is set (has been assigned a value) and false otherwise */
  public boolean isSetBool_val() {
    return EncodingUtils.testBit(__isset_bitfield, __BOOL_VAL_ISSET_ID);
  }

  public void setBool_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BOOL_VAL_ISSET_ID, value);
  }

  public byte getByte_val() {
    return this.byte_val;
  }

  public FieldValue setByte_val(byte byte_val) {
    this.byte_val = byte_val;
    setByte_valIsSet(true);
    return this;
  }

  public void unsetByte_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BYTE_VAL_ISSET_ID);
  }

  /** Returns true if field byte_val is set (has been assigned a value) and false otherwise */
  public boolean isSetByte_val() {
    return EncodingUtils.testBit(__isset_bitfield, __BYTE_VAL_ISSET_ID);
  }

  public void setByte_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BYTE_VAL_ISSET_ID, value);
  }

  public short getChar_val() {
    return this.char_val;
  }

  public FieldValue setChar_val(short char_val) {
    this.char_val = char_val;
    setChar_valIsSet(true);
    return this;
  }

  public void unsetChar_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CHAR_VAL_ISSET_ID);
  }

  /** Returns true if field char_val is set (has been assigned a value) and false otherwise */
  public boolean isSetChar_val() {
    return EncodingUtils.testBit(__isset_bitfield, __CHAR_VAL_ISSET_ID);
  }

  public void setChar_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CHAR_VAL_ISSET_ID, value);
  }

  public short getShort_val() {
    return this.short_val;
  }

  public FieldValue setShort_val(short short_val) {
    this.short_val = short_val;
    setShort_valIsSet(true);
    return this;
  }

  public void unsetShort_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SHORT_VAL_ISSET_ID);
  }

  /** Returns true if field short_val is set (has been assigned a value) and false otherwise */
  public boolean isSetShort_val() {
    return EncodingUtils.testBit(__isset_bitfield, __SHORT_VAL_ISSET_ID);
  }

  public void setShort_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SHORT_VAL_ISSET_ID, value);
  }

  public int getInt_val() {
    return this.int_val;
  }

  public FieldValue setInt_val(int int_val) {
    this.int_val = int_val;
    setInt_valIsSet(true);
    return this;
  }

  public void unsetInt_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INT_VAL_ISSET_ID);
  }

  /** Returns true if field int_val is set (has been assigned a value) and false otherwise */
  public boolean isSetInt_val() {
    return EncodingUtils.testBit(__isset_bitfield, __INT_VAL_ISSET_ID);
  }

  public void setInt_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INT_VAL_ISSET_ID, value);
  }

  public long getLong_val() {
    return this.long_val;
  }

  public FieldValue setLong_val(long long_val) {
    this.long_val = long_val;
    setLong_valIsSet(true);
    return this;
  }

  public void unsetLong_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LONG_VAL_ISSET_ID);
  }

  /** Returns true if field long_val is set (has been assigned a value) and false otherwise */
  public boolean isSetLong_val() {
    return EncodingUtils.testBit(__isset_bitfield, __LONG_VAL_ISSET_ID);
  }

  public void setLong_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LONG_VAL_ISSET_ID, value);
  }

  public int getFloat_val() {
    return this.float_val;
  }

  public FieldValue setFloat_val(int float_val) {
    this.float_val = float_val;
    setFloat_valIsSet(true);
    return this;
  }

  public void unsetFloat_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FLOAT_VAL_ISSET_ID);
  }

  /** Returns true if field float_val is set (has been assigned a value) and false otherwise */
  public boolean isSetFloat_val() {
    return EncodingUtils.testBit(__isset_bitfield, __FLOAT_VAL_ISSET_ID);
  }

  public void setFloat_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FLOAT_VAL_ISSET_ID, value);
  }

  public double getDouble_val() {
    return this.double_val;
  }

  public FieldValue setDouble_val(double double_val) {
    this.double_val = double_val;
    setDouble_valIsSet(true);
    return this;
  }

  public void unsetDouble_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOUBLE_VAL_ISSET_ID);
  }

  /** Returns true if field double_val is set (has been assigned a value) and false otherwise */
  public boolean isSetDouble_val() {
    return EncodingUtils.testBit(__isset_bitfield, __DOUBLE_VAL_ISSET_ID);
  }

  public void setDouble_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOUBLE_VAL_ISSET_ID, value);
  }

  public String getString_val() {
    return this.string_val;
  }

  public FieldValue setString_val(String string_val) {
    this.string_val = string_val;
    return this;
  }

  public void unsetString_val() {
    this.string_val = null;
  }

  /** Returns true if field string_val is set (has been assigned a value) and false otherwise */
  public boolean isSetString_val() {
    return this.string_val != null;
  }

  public void setString_valIsSet(boolean value) {
    if (!value) {
      this.string_val = null;
    }
  }

  public Decimal getDecimal_val() {
    return this.decimal_val;
  }

  public FieldValue setDecimal_val(Decimal decimal_val) {
    this.decimal_val = decimal_val;
    return this;
  }

  public void unsetDecimal_val() {
    this.decimal_val = null;
  }

  /** Returns true if field decimal_val is set (has been assigned a value) and false otherwise */
  public boolean isSetDecimal_val() {
    return this.decimal_val != null;
  }

  public void setDecimal_valIsSet(boolean value) {
    if (!value) {
      this.decimal_val = null;
    }
  }

  public Timestamp getTimestamp_val() {
    return this.timestamp_val;
  }

  public FieldValue setTimestamp_val(Timestamp timestamp_val) {
    this.timestamp_val = timestamp_val;
    return this;
  }

  public void unsetTimestamp_val() {
    this.timestamp_val = null;
  }

  /** Returns true if field timestamp_val is set (has been assigned a value) and false otherwise */
  public boolean isSetTimestamp_val() {
    return this.timestamp_val != null;
  }

  public void setTimestamp_valIsSet(boolean value) {
    if (!value) {
      this.timestamp_val = null;
    }
  }

  public int getBool_arraySize() {
    return (this.bool_array == null) ? 0 : this.bool_array.size();
  }

  public java.util.Iterator<Boolean> getBool_arrayIterator() {
    return (this.bool_array == null) ? null : this.bool_array.iterator();
  }

  public void addToBool_array(boolean elem) {
    if (this.bool_array == null) {
      this.bool_array = new ArrayList<Boolean>();
    }
    this.bool_array.add(elem);
  }

  public List<Boolean> getBool_array() {
    return this.bool_array;
  }

  public FieldValue setBool_array(List<Boolean> bool_array) {
    this.bool_array = bool_array;
    return this;
  }

  public void unsetBool_array() {
    this.bool_array = null;
  }

  /** Returns true if field bool_array is set (has been assigned a value) and false otherwise */
  public boolean isSetBool_array() {
    return this.bool_array != null;
  }

  public void setBool_arrayIsSet(boolean value) {
    if (!value) {
      this.bool_array = null;
    }
  }

  public byte[] getByte_array() {
    setByte_array(org.apache.thrift.TBaseHelper.rightSize(byte_array));
    return byte_array == null ? null : byte_array.array();
  }

  public ByteBuffer bufferForByte_array() {
    return byte_array;
  }

  public FieldValue setByte_array(byte[] byte_array) {
    setByte_array(byte_array == null ? (ByteBuffer)null : ByteBuffer.wrap(byte_array));
    return this;
  }

  public FieldValue setByte_array(ByteBuffer byte_array) {
    this.byte_array = byte_array;
    return this;
  }

  public void unsetByte_array() {
    this.byte_array = null;
  }

  /** Returns true if field byte_array is set (has been assigned a value) and false otherwise */
  public boolean isSetByte_array() {
    return this.byte_array != null;
  }

  public void setByte_arrayIsSet(boolean value) {
    if (!value) {
      this.byte_array = null;
    }
  }

  public String getChar_array() {
    return this.char_array;
  }

  public FieldValue setChar_array(String char_array) {
    this.char_array = char_array;
    return this;
  }

  public void unsetChar_array() {
    this.char_array = null;
  }

  /** Returns true if field char_array is set (has been assigned a value) and false otherwise */
  public boolean isSetChar_array() {
    return this.char_array != null;
  }

  public void setChar_arrayIsSet(boolean value) {
    if (!value) {
      this.char_array = null;
    }
  }

  public int getShort_arraySize() {
    return (this.short_array == null) ? 0 : this.short_array.size();
  }

  public java.util.Iterator<Short> getShort_arrayIterator() {
    return (this.short_array == null) ? null : this.short_array.iterator();
  }

  public void addToShort_array(short elem) {
    if (this.short_array == null) {
      this.short_array = new ArrayList<Short>();
    }
    this.short_array.add(elem);
  }

  public List<Short> getShort_array() {
    return this.short_array;
  }

  public FieldValue setShort_array(List<Short> short_array) {
    this.short_array = short_array;
    return this;
  }

  public void unsetShort_array() {
    this.short_array = null;
  }

  /** Returns true if field short_array is set (has been assigned a value) and false otherwise */
  public boolean isSetShort_array() {
    return this.short_array != null;
  }

  public void setShort_arrayIsSet(boolean value) {
    if (!value) {
      this.short_array = null;
    }
  }

  public int getInt_arraySize() {
    return (this.int_array == null) ? 0 : this.int_array.size();
  }

  public java.util.Iterator<Integer> getInt_arrayIterator() {
    return (this.int_array == null) ? null : this.int_array.iterator();
  }

  public void addToInt_array(int elem) {
    if (this.int_array == null) {
      this.int_array = new ArrayList<Integer>();
    }
    this.int_array.add(elem);
  }

  public List<Integer> getInt_array() {
    return this.int_array;
  }

  public FieldValue setInt_array(List<Integer> int_array) {
    this.int_array = int_array;
    return this;
  }

  public void unsetInt_array() {
    this.int_array = null;
  }

  /** Returns true if field int_array is set (has been assigned a value) and false otherwise */
  public boolean isSetInt_array() {
    return this.int_array != null;
  }

  public void setInt_arrayIsSet(boolean value) {
    if (!value) {
      this.int_array = null;
    }
  }

  public int getLong_arraySize() {
    return (this.long_array == null) ? 0 : this.long_array.size();
  }

  public java.util.Iterator<Long> getLong_arrayIterator() {
    return (this.long_array == null) ? null : this.long_array.iterator();
  }

  public void addToLong_array(long elem) {
    if (this.long_array == null) {
      this.long_array = new ArrayList<Long>();
    }
    this.long_array.add(elem);
  }

  public List<Long> getLong_array() {
    return this.long_array;
  }

  public FieldValue setLong_array(List<Long> long_array) {
    this.long_array = long_array;
    return this;
  }

  public void unsetLong_array() {
    this.long_array = null;
  }

  /** Returns true if field long_array is set (has been assigned a value) and false otherwise */
  public boolean isSetLong_array() {
    return this.long_array != null;
  }

  public void setLong_arrayIsSet(boolean value) {
    if (!value) {
      this.long_array = null;
    }
  }

  public int getFloat_arraySize() {
    return (this.float_array == null) ? 0 : this.float_array.size();
  }

  public java.util.Iterator<Integer> getFloat_arrayIterator() {
    return (this.float_array == null) ? null : this.float_array.iterator();
  }

  public void addToFloat_array(int elem) {
    if (this.float_array == null) {
      this.float_array = new ArrayList<Integer>();
    }
    this.float_array.add(elem);
  }

  public List<Integer> getFloat_array() {
    return this.float_array;
  }

  public FieldValue setFloat_array(List<Integer> float_array) {
    this.float_array = float_array;
    return this;
  }

  public void unsetFloat_array() {
    this.float_array = null;
  }

  /** Returns true if field float_array is set (has been assigned a value) and false otherwise */
  public boolean isSetFloat_array() {
    return this.float_array != null;
  }

  public void setFloat_arrayIsSet(boolean value) {
    if (!value) {
      this.float_array = null;
    }
  }

  public int getDouble_arraySize() {
    return (this.double_array == null) ? 0 : this.double_array.size();
  }

  public java.util.Iterator<Double> getDouble_arrayIterator() {
    return (this.double_array == null) ? null : this.double_array.iterator();
  }

  public void addToDouble_array(double elem) {
    if (this.double_array == null) {
      this.double_array = new ArrayList<Double>();
    }
    this.double_array.add(elem);
  }

  public List<Double> getDouble_array() {
    return this.double_array;
  }

  public FieldValue setDouble_array(List<Double> double_array) {
    this.double_array = double_array;
    return this;
  }

  public void unsetDouble_array() {
    this.double_array = null;
  }

  /** Returns true if field double_array is set (has been assigned a value) and false otherwise */
  public boolean isSetDouble_array() {
    return this.double_array != null;
  }

  public void setDouble_arrayIsSet(boolean value) {
    if (!value) {
      this.double_array = null;
    }
  }

  public int getString_arraySize() {
    return (this.string_array == null) ? 0 : this.string_array.size();
  }

  public java.util.Iterator<String> getString_arrayIterator() {
    return (this.string_array == null) ? null : this.string_array.iterator();
  }

  public void addToString_array(String elem) {
    if (this.string_array == null) {
      this.string_array = new ArrayList<String>();
    }
    this.string_array.add(elem);
  }

  public List<String> getString_array() {
    return this.string_array;
  }

  public FieldValue setString_array(List<String> string_array) {
    this.string_array = string_array;
    return this;
  }

  public void unsetString_array() {
    this.string_array = null;
  }

  /** Returns true if field string_array is set (has been assigned a value) and false otherwise */
  public boolean isSetString_array() {
    return this.string_array != null;
  }

  public void setString_arrayIsSet(boolean value) {
    if (!value) {
      this.string_array = null;
    }
  }

  public int getByte_array_arraySize() {
    return (this.byte_array_array == null) ? 0 : this.byte_array_array.size();
  }

  public java.util.Iterator<ByteBuffer> getByte_array_arrayIterator() {
    return (this.byte_array_array == null) ? null : this.byte_array_array.iterator();
  }

  public void addToByte_array_array(ByteBuffer elem) {
    if (this.byte_array_array == null) {
      this.byte_array_array = new ArrayList<ByteBuffer>();
    }
    this.byte_array_array.add(elem);
  }

  public List<ByteBuffer> getByte_array_array() {
    return this.byte_array_array;
  }

  public FieldValue setByte_array_array(List<ByteBuffer> byte_array_array) {
    this.byte_array_array = byte_array_array;
    return this;
  }

  public void unsetByte_array_array() {
    this.byte_array_array = null;
  }

  /** Returns true if field byte_array_array is set (has been assigned a value) and false otherwise */
  public boolean isSetByte_array_array() {
    return this.byte_array_array != null;
  }

  public void setByte_array_arrayIsSet(boolean value) {
    if (!value) {
      this.byte_array_array = null;
    }
  }

  public int getRef_val() {
    return this.ref_val;
  }

  public FieldValue setRef_val(int ref_val) {
    this.ref_val = ref_val;
    setRef_valIsSet(true);
    return this;
  }

  public void unsetRef_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __REF_VAL_ISSET_ID);
  }

  /** Returns true if field ref_val is set (has been assigned a value) and false otherwise */
  public boolean isSetRef_val() {
    return EncodingUtils.testBit(__isset_bitfield, __REF_VAL_ISSET_ID);
  }

  public void setRef_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __REF_VAL_ISSET_ID, value);
  }

  public int getList_valSize() {
    return (this.list_val == null) ? 0 : this.list_val.size();
  }

  public java.util.Iterator<Integer> getList_valIterator() {
    return (this.list_val == null) ? null : this.list_val.iterator();
  }

  public void addToList_val(int elem) {
    if (this.list_val == null) {
      this.list_val = new ArrayList<Integer>();
    }
    this.list_val.add(elem);
  }

  public List<Integer> getList_val() {
    return this.list_val;
  }

  public FieldValue setList_val(List<Integer> list_val) {
    this.list_val = list_val;
    return this;
  }

  public void unsetList_val() {
    this.list_val = null;
  }

  /** Returns true if field list_val is set (has been assigned a value) and false otherwise */
  public boolean isSetList_val() {
    return this.list_val != null;
  }

  public void setList_valIsSet(boolean value) {
    if (!value) {
      this.list_val = null;
    }
  }

  public byte[] getNative_val() {
    setNative_val(org.apache.thrift.TBaseHelper.rightSize(native_val));
    return native_val == null ? null : native_val.array();
  }

  public ByteBuffer bufferForNative_val() {
    return native_val;
  }

  public FieldValue setNative_val(byte[] native_val) {
    setNative_val(native_val == null ? (ByteBuffer)null : ByteBuffer.wrap(native_val));
    return this;
  }

  public FieldValue setNative_val(ByteBuffer native_val) {
    this.native_val = native_val;
    return this;
  }

  public void unsetNative_val() {
    this.native_val = null;
  }

  /** Returns true if field native_val is set (has been assigned a value) and false otherwise */
  public boolean isSetNative_val() {
    return this.native_val != null;
  }

  public void setNative_valIsSet(boolean value) {
    if (!value) {
      this.native_val = null;
    }
  }

  public boolean isNull_val() {
    return this.null_val;
  }

  public FieldValue setNull_val(boolean null_val) {
    this.null_val = null_val;
    setNull_valIsSet(true);
    return this;
  }

  public void unsetNull_val() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NULL_VAL_ISSET_ID);
  }

  /** Returns true if field null_val is set (has been assigned a value) and false otherwise */
  public boolean isSetNull_val() {
    return EncodingUtils.testBit(__isset_bitfield, __NULL_VAL_ISSET_ID);
  }

  public void setNull_valIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NULL_VAL_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case BOOL_VAL:
      if (value == null) {
        unsetBool_val();
      } else {
        setBool_val((Boolean)value);
      }
      break;

    case BYTE_VAL:
      if (value == null) {
        unsetByte_val();
      } else {
        setByte_val((Byte)value);
      }
      break;

    case CHAR_VAL:
      if (value == null) {
        unsetChar_val();
      } else {
        setChar_val((Short)value);
      }
      break;

    case SHORT_VAL:
      if (value == null) {
        unsetShort_val();
      } else {
        setShort_val((Short)value);
      }
      break;

    case INT_VAL:
      if (value == null) {
        unsetInt_val();
      } else {
        setInt_val((Integer)value);
      }
      break;

    case LONG_VAL:
      if (value == null) {
        unsetLong_val();
      } else {
        setLong_val((Long)value);
      }
      break;

    case FLOAT_VAL:
      if (value == null) {
        unsetFloat_val();
      } else {
        setFloat_val((Integer)value);
      }
      break;

    case DOUBLE_VAL:
      if (value == null) {
        unsetDouble_val();
      } else {
        setDouble_val((Double)value);
      }
      break;

    case STRING_VAL:
      if (value == null) {
        unsetString_val();
      } else {
        setString_val((String)value);
      }
      break;

    case DECIMAL_VAL:
      if (value == null) {
        unsetDecimal_val();
      } else {
        setDecimal_val((Decimal)value);
      }
      break;

    case TIMESTAMP_VAL:
      if (value == null) {
        unsetTimestamp_val();
      } else {
        setTimestamp_val((Timestamp)value);
      }
      break;

    case BOOL_ARRAY:
      if (value == null) {
        unsetBool_array();
      } else {
        setBool_array((List<Boolean>)value);
      }
      break;

    case BYTE_ARRAY:
      if (value == null) {
        unsetByte_array();
      } else {
        setByte_array((ByteBuffer)value);
      }
      break;

    case CHAR_ARRAY:
      if (value == null) {
        unsetChar_array();
      } else {
        setChar_array((String)value);
      }
      break;

    case SHORT_ARRAY:
      if (value == null) {
        unsetShort_array();
      } else {
        setShort_array((List<Short>)value);
      }
      break;

    case INT_ARRAY:
      if (value == null) {
        unsetInt_array();
      } else {
        setInt_array((List<Integer>)value);
      }
      break;

    case LONG_ARRAY:
      if (value == null) {
        unsetLong_array();
      } else {
        setLong_array((List<Long>)value);
      }
      break;

    case FLOAT_ARRAY:
      if (value == null) {
        unsetFloat_array();
      } else {
        setFloat_array((List<Integer>)value);
      }
      break;

    case DOUBLE_ARRAY:
      if (value == null) {
        unsetDouble_array();
      } else {
        setDouble_array((List<Double>)value);
      }
      break;

    case STRING_ARRAY:
      if (value == null) {
        unsetString_array();
      } else {
        setString_array((List<String>)value);
      }
      break;

    case BYTE_ARRAY_ARRAY:
      if (value == null) {
        unsetByte_array_array();
      } else {
        setByte_array_array((List<ByteBuffer>)value);
      }
      break;

    case REF_VAL:
      if (value == null) {
        unsetRef_val();
      } else {
        setRef_val((Integer)value);
      }
      break;

    case LIST_VAL:
      if (value == null) {
        unsetList_val();
      } else {
        setList_val((List<Integer>)value);
      }
      break;

    case NATIVE_VAL:
      if (value == null) {
        unsetNative_val();
      } else {
        setNative_val((ByteBuffer)value);
      }
      break;

    case NULL_VAL:
      if (value == null) {
        unsetNull_val();
      } else {
        setNull_val((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case BOOL_VAL:
      return Boolean.valueOf(isBool_val());

    case BYTE_VAL:
      return Byte.valueOf(getByte_val());

    case CHAR_VAL:
      return Short.valueOf(getChar_val());

    case SHORT_VAL:
      return Short.valueOf(getShort_val());

    case INT_VAL:
      return Integer.valueOf(getInt_val());

    case LONG_VAL:
      return Long.valueOf(getLong_val());

    case FLOAT_VAL:
      return Integer.valueOf(getFloat_val());

    case DOUBLE_VAL:
      return Double.valueOf(getDouble_val());

    case STRING_VAL:
      return getString_val();

    case DECIMAL_VAL:
      return getDecimal_val();

    case TIMESTAMP_VAL:
      return getTimestamp_val();

    case BOOL_ARRAY:
      return getBool_array();

    case BYTE_ARRAY:
      return getByte_array();

    case CHAR_ARRAY:
      return getChar_array();

    case SHORT_ARRAY:
      return getShort_array();

    case INT_ARRAY:
      return getInt_array();

    case LONG_ARRAY:
      return getLong_array();

    case FLOAT_ARRAY:
      return getFloat_array();

    case DOUBLE_ARRAY:
      return getDouble_array();

    case STRING_ARRAY:
      return getString_array();

    case BYTE_ARRAY_ARRAY:
      return getByte_array_array();

    case REF_VAL:
      return Integer.valueOf(getRef_val());

    case LIST_VAL:
      return getList_val();

    case NATIVE_VAL:
      return getNative_val();

    case NULL_VAL:
      return Boolean.valueOf(isNull_val());

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case BOOL_VAL:
      return isSetBool_val();
    case BYTE_VAL:
      return isSetByte_val();
    case CHAR_VAL:
      return isSetChar_val();
    case SHORT_VAL:
      return isSetShort_val();
    case INT_VAL:
      return isSetInt_val();
    case LONG_VAL:
      return isSetLong_val();
    case FLOAT_VAL:
      return isSetFloat_val();
    case DOUBLE_VAL:
      return isSetDouble_val();
    case STRING_VAL:
      return isSetString_val();
    case DECIMAL_VAL:
      return isSetDecimal_val();
    case TIMESTAMP_VAL:
      return isSetTimestamp_val();
    case BOOL_ARRAY:
      return isSetBool_array();
    case BYTE_ARRAY:
      return isSetByte_array();
    case CHAR_ARRAY:
      return isSetChar_array();
    case SHORT_ARRAY:
      return isSetShort_array();
    case INT_ARRAY:
      return isSetInt_array();
    case LONG_ARRAY:
      return isSetLong_array();
    case FLOAT_ARRAY:
      return isSetFloat_array();
    case DOUBLE_ARRAY:
      return isSetDouble_array();
    case STRING_ARRAY:
      return isSetString_array();
    case BYTE_ARRAY_ARRAY:
      return isSetByte_array_array();
    case REF_VAL:
      return isSetRef_val();
    case LIST_VAL:
      return isSetList_val();
    case NATIVE_VAL:
      return isSetNative_val();
    case NULL_VAL:
      return isSetNull_val();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof FieldValue)
      return this.equals((FieldValue)that);
    return false;
  }

  public boolean equals(FieldValue that) {
    if (that == null)
      return false;

    boolean this_present_bool_val = true && this.isSetBool_val();
    boolean that_present_bool_val = true && that.isSetBool_val();
    if (this_present_bool_val || that_present_bool_val) {
      if (!(this_present_bool_val && that_present_bool_val))
        return false;
      if (this.bool_val != that.bool_val)
        return false;
    }

    boolean this_present_byte_val = true && this.isSetByte_val();
    boolean that_present_byte_val = true && that.isSetByte_val();
    if (this_present_byte_val || that_present_byte_val) {
      if (!(this_present_byte_val && that_present_byte_val))
        return false;
      if (this.byte_val != that.byte_val)
        return false;
    }

    boolean this_present_char_val = true && this.isSetChar_val();
    boolean that_present_char_val = true && that.isSetChar_val();
    if (this_present_char_val || that_present_char_val) {
      if (!(this_present_char_val && that_present_char_val))
        return false;
      if (this.char_val != that.char_val)
        return false;
    }

    boolean this_present_short_val = true && this.isSetShort_val();
    boolean that_present_short_val = true && that.isSetShort_val();
    if (this_present_short_val || that_present_short_val) {
      if (!(this_present_short_val && that_present_short_val))
        return false;
      if (this.short_val != that.short_val)
        return false;
    }

    boolean this_present_int_val = true && this.isSetInt_val();
    boolean that_present_int_val = true && that.isSetInt_val();
    if (this_present_int_val || that_present_int_val) {
      if (!(this_present_int_val && that_present_int_val))
        return false;
      if (this.int_val != that.int_val)
        return false;
    }

    boolean this_present_long_val = true && this.isSetLong_val();
    boolean that_present_long_val = true && that.isSetLong_val();
    if (this_present_long_val || that_present_long_val) {
      if (!(this_present_long_val && that_present_long_val))
        return false;
      if (this.long_val != that.long_val)
        return false;
    }

    boolean this_present_float_val = true && this.isSetFloat_val();
    boolean that_present_float_val = true && that.isSetFloat_val();
    if (this_present_float_val || that_present_float_val) {
      if (!(this_present_float_val && that_present_float_val))
        return false;
      if (this.float_val != that.float_val)
        return false;
    }

    boolean this_present_double_val = true && this.isSetDouble_val();
    boolean that_present_double_val = true && that.isSetDouble_val();
    if (this_present_double_val || that_present_double_val) {
      if (!(this_present_double_val && that_present_double_val))
        return false;
      if (this.double_val != that.double_val)
        return false;
    }

    boolean this_present_string_val = true && this.isSetString_val();
    boolean that_present_string_val = true && that.isSetString_val();
    if (this_present_string_val || that_present_string_val) {
      if (!(this_present_string_val && that_present_string_val))
        return false;
      if (!this.string_val.equals(that.string_val))
        return false;
    }

    boolean this_present_decimal_val = true && this.isSetDecimal_val();
    boolean that_present_decimal_val = true && that.isSetDecimal_val();
    if (this_present_decimal_val || that_present_decimal_val) {
      if (!(this_present_decimal_val && that_present_decimal_val))
        return false;
      if (!this.decimal_val.equals(that.decimal_val))
        return false;
    }

    boolean this_present_timestamp_val = true && this.isSetTimestamp_val();
    boolean that_present_timestamp_val = true && that.isSetTimestamp_val();
    if (this_present_timestamp_val || that_present_timestamp_val) {
      if (!(this_present_timestamp_val && that_present_timestamp_val))
        return false;
      if (!this.timestamp_val.equals(that.timestamp_val))
        return false;
    }

    boolean this_present_bool_array = true && this.isSetBool_array();
    boolean that_present_bool_array = true && that.isSetBool_array();
    if (this_present_bool_array || that_present_bool_array) {
      if (!(this_present_bool_array && that_present_bool_array))
        return false;
      if (!this.bool_array.equals(that.bool_array))
        return false;
    }

    boolean this_present_byte_array = true && this.isSetByte_array();
    boolean that_present_byte_array = true && that.isSetByte_array();
    if (this_present_byte_array || that_present_byte_array) {
      if (!(this_present_byte_array && that_present_byte_array))
        return false;
      if (!this.byte_array.equals(that.byte_array))
        return false;
    }

    boolean this_present_char_array = true && this.isSetChar_array();
    boolean that_present_char_array = true && that.isSetChar_array();
    if (this_present_char_array || that_present_char_array) {
      if (!(this_present_char_array && that_present_char_array))
        return false;
      if (!this.char_array.equals(that.char_array))
        return false;
    }

    boolean this_present_short_array = true && this.isSetShort_array();
    boolean that_present_short_array = true && that.isSetShort_array();
    if (this_present_short_array || that_present_short_array) {
      if (!(this_present_short_array && that_present_short_array))
        return false;
      if (!this.short_array.equals(that.short_array))
        return false;
    }

    boolean this_present_int_array = true && this.isSetInt_array();
    boolean that_present_int_array = true && that.isSetInt_array();
    if (this_present_int_array || that_present_int_array) {
      if (!(this_present_int_array && that_present_int_array))
        return false;
      if (!this.int_array.equals(that.int_array))
        return false;
    }

    boolean this_present_long_array = true && this.isSetLong_array();
    boolean that_present_long_array = true && that.isSetLong_array();
    if (this_present_long_array || that_present_long_array) {
      if (!(this_present_long_array && that_present_long_array))
        return false;
      if (!this.long_array.equals(that.long_array))
        return false;
    }

    boolean this_present_float_array = true && this.isSetFloat_array();
    boolean that_present_float_array = true && that.isSetFloat_array();
    if (this_present_float_array || that_present_float_array) {
      if (!(this_present_float_array && that_present_float_array))
        return false;
      if (!this.float_array.equals(that.float_array))
        return false;
    }

    boolean this_present_double_array = true && this.isSetDouble_array();
    boolean that_present_double_array = true && that.isSetDouble_array();
    if (this_present_double_array || that_present_double_array) {
      if (!(this_present_double_array && that_present_double_array))
        return false;
      if (!this.double_array.equals(that.double_array))
        return false;
    }

    boolean this_present_string_array = true && this.isSetString_array();
    boolean that_present_string_array = true && that.isSetString_array();
    if (this_present_string_array || that_present_string_array) {
      if (!(this_present_string_array && that_present_string_array))
        return false;
      if (!this.string_array.equals(that.string_array))
        return false;
    }

    boolean this_present_byte_array_array = true && this.isSetByte_array_array();
    boolean that_present_byte_array_array = true && that.isSetByte_array_array();
    if (this_present_byte_array_array || that_present_byte_array_array) {
      if (!(this_present_byte_array_array && that_present_byte_array_array))
        return false;
      if (!this.byte_array_array.equals(that.byte_array_array))
        return false;
    }

    boolean this_present_ref_val = true && this.isSetRef_val();
    boolean that_present_ref_val = true && that.isSetRef_val();
    if (this_present_ref_val || that_present_ref_val) {
      if (!(this_present_ref_val && that_present_ref_val))
        return false;
      if (this.ref_val != that.ref_val)
        return false;
    }

    boolean this_present_list_val = true && this.isSetList_val();
    boolean that_present_list_val = true && that.isSetList_val();
    if (this_present_list_val || that_present_list_val) {
      if (!(this_present_list_val && that_present_list_val))
        return false;
      if (!this.list_val.equals(that.list_val))
        return false;
    }

    boolean this_present_native_val = true && this.isSetNative_val();
    boolean that_present_native_val = true && that.isSetNative_val();
    if (this_present_native_val || that_present_native_val) {
      if (!(this_present_native_val && that_present_native_val))
        return false;
      if (!this.native_val.equals(that.native_val))
        return false;
    }

    boolean this_present_null_val = true && this.isSetNull_val();
    boolean that_present_null_val = true && that.isSetNull_val();
    if (this_present_null_val || that_present_null_val) {
      if (!(this_present_null_val && that_present_null_val))
        return false;
      if (this.null_val != that.null_val)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  @Override
  public int compareTo(FieldValue other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetBool_val()).compareTo(other.isSetBool_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBool_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bool_val, other.bool_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetByte_val()).compareTo(other.isSetByte_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetByte_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.byte_val, other.byte_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetChar_val()).compareTo(other.isSetChar_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChar_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.char_val, other.char_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShort_val()).compareTo(other.isSetShort_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShort_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.short_val, other.short_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInt_val()).compareTo(other.isSetInt_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInt_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.int_val, other.int_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLong_val()).compareTo(other.isSetLong_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLong_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.long_val, other.long_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFloat_val()).compareTo(other.isSetFloat_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFloat_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.float_val, other.float_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDouble_val()).compareTo(other.isSetDouble_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDouble_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.double_val, other.double_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetString_val()).compareTo(other.isSetString_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_val, other.string_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDecimal_val()).compareTo(other.isSetDecimal_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDecimal_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.decimal_val, other.decimal_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimestamp_val()).compareTo(other.isSetTimestamp_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimestamp_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp_val, other.timestamp_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBool_array()).compareTo(other.isSetBool_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBool_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bool_array, other.bool_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetByte_array()).compareTo(other.isSetByte_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetByte_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.byte_array, other.byte_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetChar_array()).compareTo(other.isSetChar_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetChar_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.char_array, other.char_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetShort_array()).compareTo(other.isSetShort_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShort_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.short_array, other.short_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInt_array()).compareTo(other.isSetInt_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInt_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.int_array, other.int_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLong_array()).compareTo(other.isSetLong_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLong_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.long_array, other.long_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFloat_array()).compareTo(other.isSetFloat_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFloat_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.float_array, other.float_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDouble_array()).compareTo(other.isSetDouble_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDouble_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.double_array, other.double_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetString_array()).compareTo(other.isSetString_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_array, other.string_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetByte_array_array()).compareTo(other.isSetByte_array_array());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetByte_array_array()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.byte_array_array, other.byte_array_array);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRef_val()).compareTo(other.isSetRef_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRef_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref_val, other.ref_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetList_val()).compareTo(other.isSetList_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetList_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.list_val, other.list_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNative_val()).compareTo(other.isSetNative_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNative_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.native_val, other.native_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNull_val()).compareTo(other.isSetNull_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNull_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_val, other.null_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("FieldValue(");
    boolean first = true;

    if (isSetBool_val()) {
      sb.append("bool_val:");
      sb.append(this.bool_val);
      first = false;
    }
    if (isSetByte_val()) {
      if (!first) sb.append(", ");
      sb.append("byte_val:");
      sb.append(this.byte_val);
      first = false;
    }
    if (isSetChar_val()) {
      if (!first) sb.append(", ");
      sb.append("char_val:");
      sb.append(this.char_val);
      first = false;
    }
    if (isSetShort_val()) {
      if (!first) sb.append(", ");
      sb.append("short_val:");
      sb.append(this.short_val);
      first = false;
    }
    if (isSetInt_val()) {
      if (!first) sb.append(", ");
      sb.append("int_val:");
      sb.append(this.int_val);
      first = false;
    }
    if (isSetLong_val()) {
      if (!first) sb.append(", ");
      sb.append("long_val:");
      sb.append(this.long_val);
      first = false;
    }
    if (isSetFloat_val()) {
      if (!first) sb.append(", ");
      sb.append("float_val:");
      sb.append(this.float_val);
      first = false;
    }
    if (isSetDouble_val()) {
      if (!first) sb.append(", ");
      sb.append("double_val:");
      sb.append(this.double_val);
      first = false;
    }
    if (isSetString_val()) {
      if (!first) sb.append(", ");
      sb.append("string_val:");
      if (this.string_val == null) {
        sb.append("null");
      } else {
        sb.append(this.string_val);
      }
      first = false;
    }
    if (isSetDecimal_val()) {
      if (!first) sb.append(", ");
      sb.append("decimal_val:");
      if (this.decimal_val == null) {
        sb.append("null");
      } else {
        sb.append(this.decimal_val);
      }
      first = false;
    }
    if (isSetTimestamp_val()) {
      if (!first) sb.append(", ");
      sb.append("timestamp_val:");
      if (this.timestamp_val == null) {
        sb.append("null");
      } else {
        sb.append(this.timestamp_val);
      }
      first = false;
    }
    if (isSetBool_array()) {
      if (!first) sb.append(", ");
      sb.append("bool_array:");
      if (this.bool_array == null) {
        sb.append("null");
      } else {
        sb.append(this.bool_array);
      }
      first = false;
    }
    if (isSetByte_array()) {
      if (!first) sb.append(", ");
      sb.append("byte_array:");
      if (this.byte_array == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.byte_array, sb);
      }
      first = false;
    }
    if (isSetChar_array()) {
      if (!first) sb.append(", ");
      sb.append("char_array:");
      if (this.char_array == null) {
        sb.append("null");
      } else {
        sb.append(this.char_array);
      }
      first = false;
    }
    if (isSetShort_array()) {
      if (!first) sb.append(", ");
      sb.append("short_array:");
      if (this.short_array == null) {
        sb.append("null");
      } else {
        sb.append(this.short_array);
      }
      first = false;
    }
    if (isSetInt_array()) {
      if (!first) sb.append(", ");
      sb.append("int_array:");
      if (this.int_array == null) {
        sb.append("null");
      } else {
        sb.append(this.int_array);
      }
      first = false;
    }
    if (isSetLong_array()) {
      if (!first) sb.append(", ");
      sb.append("long_array:");
      if (this.long_array == null) {
        sb.append("null");
      } else {
        sb.append(this.long_array);
      }
      first = false;
    }
    if (isSetFloat_array()) {
      if (!first) sb.append(", ");
      sb.append("float_array:");
      if (this.float_array == null) {
        sb.append("null");
      } else {
        sb.append(this.float_array);
      }
      first = false;
    }
    if (isSetDouble_array()) {
      if (!first) sb.append(", ");
      sb.append("double_array:");
      if (this.double_array == null) {
        sb.append("null");
      } else {
        sb.append(this.double_array);
      }
      first = false;
    }
    if (isSetString_array()) {
      if (!first) sb.append(", ");
      sb.append("string_array:");
      if (this.string_array == null) {
        sb.append("null");
      } else {
        sb.append(this.string_array);
      }
      first = false;
    }
    if (isSetByte_array_array()) {
      if (!first) sb.append(", ");
      sb.append("byte_array_array:");
      if (this.byte_array_array == null) {
        sb.append("null");
      } else {
        sb.append(this.byte_array_array);
      }
      first = false;
    }
    if (isSetRef_val()) {
      if (!first) sb.append(", ");
      sb.append("ref_val:");
      sb.append(this.ref_val);
      first = false;
    }
    if (isSetList_val()) {
      if (!first) sb.append(", ");
      sb.append("list_val:");
      if (this.list_val == null) {
        sb.append("null");
      } else {
        sb.append(this.list_val);
      }
      first = false;
    }
    if (isSetNative_val()) {
      if (!first) sb.append(", ");
      sb.append("native_val:");
      if (this.native_val == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.native_val, sb);
      }
      first = false;
    }
    if (isSetNull_val()) {
      if (!first) sb.append(", ");
      sb.append("null_val:");
      sb.append(this.null_val);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (decimal_val != null) {
      decimal_val.validate();
    }
    if (timestamp_val != null) {
      timestamp_val.validate();
    }
  }

  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, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      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);
    }
  }

  private static class FieldValueStandardSchemeFactory implements SchemeFactory {
    public FieldValueStandardScheme getScheme() {
      return new FieldValueStandardScheme();
    }
  }

  private static class FieldValueStandardScheme extends StandardScheme<FieldValue> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FieldValue struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // BOOL_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.bool_val = iprot.readBool();
              struct.setBool_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BYTE_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
              struct.byte_val = iprot.readByte();
              struct.setByte_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CHAR_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.char_val = iprot.readI16();
              struct.setChar_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SHORT_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.short_val = iprot.readI16();
              struct.setShort_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // INT_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.int_val = iprot.readI32();
              struct.setInt_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // LONG_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.long_val = iprot.readI64();
              struct.setLong_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // FLOAT_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.float_val = iprot.readI32();
              struct.setFloat_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // DOUBLE_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.double_val = iprot.readDouble();
              struct.setDouble_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // STRING_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.string_val = iprot.readString();
              struct.setString_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // DECIMAL_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.decimal_val = new Decimal();
              struct.decimal_val.read(iprot);
              struct.setDecimal_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // TIMESTAMP_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.timestamp_val = new Timestamp();
              struct.timestamp_val.read(iprot);
              struct.setTimestamp_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // BOOL_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.bool_array = new ArrayList<Boolean>(_list0.size);
                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
                {
                  boolean _elem2;
                  _elem2 = iprot.readBool();
                  struct.bool_array.add(_elem2);
                }
                iprot.readListEnd();
              }
              struct.setBool_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // BYTE_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.byte_array = iprot.readBinary();
              struct.setByte_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // CHAR_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.char_array = iprot.readString();
              struct.setChar_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // SHORT_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.short_array = new ArrayList<Short>(_list3.size);
                for (int _i4 = 0; _i4 < _list3.size; ++_i4)
                {
                  short _elem5;
                  _elem5 = iprot.readI16();
                  struct.short_array.add(_elem5);
                }
                iprot.readListEnd();
              }
              struct.setShort_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // INT_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list6 = iprot.readListBegin();
                struct.int_array = new ArrayList<Integer>(_list6.size);
                for (int _i7 = 0; _i7 < _list6.size; ++_i7)
                {
                  int _elem8;
                  _elem8 = iprot.readI32();
                  struct.int_array.add(_elem8);
                }
                iprot.readListEnd();
              }
              struct.setInt_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 17: // LONG_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list9 = iprot.readListBegin();
                struct.long_array = new ArrayList<Long>(_list9.size);
                for (int _i10 = 0; _i10 < _list9.size; ++_i10)
                {
                  long _elem11;
                  _elem11 = iprot.readI64();
                  struct.long_array.add(_elem11);
                }
                iprot.readListEnd();
              }
              struct.setLong_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 18: // FLOAT_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list12 = iprot.readListBegin();
                struct.float_array = new ArrayList<Integer>(_list12.size);
                for (int _i13 = 0; _i13 < _list12.size; ++_i13)
                {
                  int _elem14;
                  _elem14 = iprot.readI32();
                  struct.float_array.add(_elem14);
                }
                iprot.readListEnd();
              }
              struct.setFloat_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 19: // DOUBLE_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list15 = iprot.readListBegin();
                struct.double_array = new ArrayList<Double>(_list15.size);
                for (int _i16 = 0; _i16 < _list15.size; ++_i16)
                {
                  double _elem17;
                  _elem17 = iprot.readDouble();
                  struct.double_array.add(_elem17);
                }
                iprot.readListEnd();
              }
              struct.setDouble_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // STRING_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list18 = iprot.readListBegin();
                struct.string_array = new ArrayList<String>(_list18.size);
                for (int _i19 = 0; _i19 < _list18.size; ++_i19)
                {
                  String _elem20;
                  _elem20 = iprot.readString();
                  struct.string_array.add(_elem20);
                }
                iprot.readListEnd();
              }
              struct.setString_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 21: // BYTE_ARRAY_ARRAY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list21 = iprot.readListBegin();
                struct.byte_array_array = new ArrayList<ByteBuffer>(_list21.size);
                for (int _i22 = 0; _i22 < _list21.size; ++_i22)
                {
                  ByteBuffer _elem23;
                  _elem23 = iprot.readBinary();
                  struct.byte_array_array.add(_elem23);
                }
                iprot.readListEnd();
              }
              struct.setByte_array_arrayIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 22: // REF_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.ref_val = iprot.readI32();
              struct.setRef_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 23: // LIST_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                struct.list_val = new ArrayList<Integer>(_list24.size);
                for (int _i25 = 0; _i25 < _list24.size; ++_i25)
                {
                  int _elem26;
                  _elem26 = iprot.readI32();
                  struct.list_val.add(_elem26);
                }
                iprot.readListEnd();
              }
              struct.setList_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 24: // NATIVE_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.native_val = iprot.readBinary();
              struct.setNative_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 25: // NULL_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.null_val = iprot.readBool();
              struct.setNull_valIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, FieldValue struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetBool_val()) {
        oprot.writeFieldBegin(BOOL_VAL_FIELD_DESC);
        oprot.writeBool(struct.bool_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetByte_val()) {
        oprot.writeFieldBegin(BYTE_VAL_FIELD_DESC);
        oprot.writeByte(struct.byte_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetChar_val()) {
        oprot.writeFieldBegin(CHAR_VAL_FIELD_DESC);
        oprot.writeI16(struct.char_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetShort_val()) {
        oprot.writeFieldBegin(SHORT_VAL_FIELD_DESC);
        oprot.writeI16(struct.short_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetInt_val()) {
        oprot.writeFieldBegin(INT_VAL_FIELD_DESC);
        oprot.writeI32(struct.int_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLong_val()) {
        oprot.writeFieldBegin(LONG_VAL_FIELD_DESC);
        oprot.writeI64(struct.long_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetFloat_val()) {
        oprot.writeFieldBegin(FLOAT_VAL_FIELD_DESC);
        oprot.writeI32(struct.float_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDouble_val()) {
        oprot.writeFieldBegin(DOUBLE_VAL_FIELD_DESC);
        oprot.writeDouble(struct.double_val);
        oprot.writeFieldEnd();
      }
      if (struct.string_val != null) {
        if (struct.isSetString_val()) {
          oprot.writeFieldBegin(STRING_VAL_FIELD_DESC);
          oprot.writeString(struct.string_val);
          oprot.writeFieldEnd();
        }
      }
      if (struct.decimal_val != null) {
        if (struct.isSetDecimal_val()) {
          oprot.writeFieldBegin(DECIMAL_VAL_FIELD_DESC);
          struct.decimal_val.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.timestamp_val != null) {
        if (struct.isSetTimestamp_val()) {
          oprot.writeFieldBegin(TIMESTAMP_VAL_FIELD_DESC);
          struct.timestamp_val.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.bool_array != null) {
        if (struct.isSetBool_array()) {
          oprot.writeFieldBegin(BOOL_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.bool_array.size()));
            for (boolean _iter27 : struct.bool_array)
            {
              oprot.writeBool(_iter27);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.byte_array != null) {
        if (struct.isSetByte_array()) {
          oprot.writeFieldBegin(BYTE_ARRAY_FIELD_DESC);
          oprot.writeBinary(struct.byte_array);
          oprot.writeFieldEnd();
        }
      }
      if (struct.char_array != null) {
        if (struct.isSetChar_array()) {
          oprot.writeFieldBegin(CHAR_ARRAY_FIELD_DESC);
          oprot.writeString(struct.char_array);
          oprot.writeFieldEnd();
        }
      }
      if (struct.short_array != null) {
        if (struct.isSetShort_array()) {
          oprot.writeFieldBegin(SHORT_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I16, struct.short_array.size()));
            for (short _iter28 : struct.short_array)
            {
              oprot.writeI16(_iter28);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.int_array != null) {
        if (struct.isSetInt_array()) {
          oprot.writeFieldBegin(INT_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.int_array.size()));
            for (int _iter29 : struct.int_array)
            {
              oprot.writeI32(_iter29);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.long_array != null) {
        if (struct.isSetLong_array()) {
          oprot.writeFieldBegin(LONG_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.long_array.size()));
            for (long _iter30 : struct.long_array)
            {
              oprot.writeI64(_iter30);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.float_array != null) {
        if (struct.isSetFloat_array()) {
          oprot.writeFieldBegin(FLOAT_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.float_array.size()));
            for (int _iter31 : struct.float_array)
            {
              oprot.writeI32(_iter31);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.double_array != null) {
        if (struct.isSetDouble_array()) {
          oprot.writeFieldBegin(DOUBLE_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, struct.double_array.size()));
            for (double _iter32 : struct.double_array)
            {
              oprot.writeDouble(_iter32);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.string_array != null) {
        if (struct.isSetString_array()) {
          oprot.writeFieldBegin(STRING_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.string_array.size()));
            for (String _iter33 : struct.string_array)
            {
              oprot.writeString(_iter33);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.byte_array_array != null) {
        if (struct.isSetByte_array_array()) {
          oprot.writeFieldBegin(BYTE_ARRAY_ARRAY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.byte_array_array.size()));
            for (ByteBuffer _iter34 : struct.byte_array_array)
            {
              oprot.writeBinary(_iter34);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetRef_val()) {
        oprot.writeFieldBegin(REF_VAL_FIELD_DESC);
        oprot.writeI32(struct.ref_val);
        oprot.writeFieldEnd();
      }
      if (struct.list_val != null) {
        if (struct.isSetList_val()) {
          oprot.writeFieldBegin(LIST_VAL_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.list_val.size()));
            for (int _iter35 : struct.list_val)
            {
              oprot.writeI32(_iter35);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.native_val != null) {
        if (struct.isSetNative_val()) {
          oprot.writeFieldBegin(NATIVE_VAL_FIELD_DESC);
          oprot.writeBinary(struct.native_val);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetNull_val()) {
        oprot.writeFieldBegin(NULL_VAL_FIELD_DESC);
        oprot.writeBool(struct.null_val);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FieldValueTupleSchemeFactory implements SchemeFactory {
    public FieldValueTupleScheme getScheme() {
      return new FieldValueTupleScheme();
    }
  }

  private static class FieldValueTupleScheme extends TupleScheme<FieldValue> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FieldValue struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetBool_val()) {
        optionals.set(0);
      }
      if (struct.isSetByte_val()) {
        optionals.set(1);
      }
      if (struct.isSetChar_val()) {
        optionals.set(2);
      }
      if (struct.isSetShort_val()) {
        optionals.set(3);
      }
      if (struct.isSetInt_val()) {
        optionals.set(4);
      }
      if (struct.isSetLong_val()) {
        optionals.set(5);
      }
      if (struct.isSetFloat_val()) {
        optionals.set(6);
      }
      if (struct.isSetDouble_val()) {
        optionals.set(7);
      }
      if (struct.isSetString_val()) {
        optionals.set(8);
      }
      if (struct.isSetDecimal_val()) {
        optionals.set(9);
      }
      if (struct.isSetTimestamp_val()) {
        optionals.set(10);
      }
      if (struct.isSetBool_array()) {
        optionals.set(11);
      }
      if (struct.isSetByte_array()) {
        optionals.set(12);
      }
      if (struct.isSetChar_array()) {
        optionals.set(13);
      }
      if (struct.isSetShort_array()) {
        optionals.set(14);
      }
      if (struct.isSetInt_array()) {
        optionals.set(15);
      }
      if (struct.isSetLong_array()) {
        optionals.set(16);
      }
      if (struct.isSetFloat_array()) {
        optionals.set(17);
      }
      if (struct.isSetDouble_array()) {
        optionals.set(18);
      }
      if (struct.isSetString_array()) {
        optionals.set(19);
      }
      if (struct.isSetByte_array_array()) {
        optionals.set(20);
      }
      if (struct.isSetRef_val()) {
        optionals.set(21);
      }
      if (struct.isSetList_val()) {
        optionals.set(22);
      }
      if (struct.isSetNative_val()) {
        optionals.set(23);
      }
      if (struct.isSetNull_val()) {
        optionals.set(24);
      }
      oprot.writeBitSet(optionals, 25);
      if (struct.isSetBool_val()) {
        oprot.writeBool(struct.bool_val);
      }
      if (struct.isSetByte_val()) {
        oprot.writeByte(struct.byte_val);
      }
      if (struct.isSetChar_val()) {
        oprot.writeI16(struct.char_val);
      }
      if (struct.isSetShort_val()) {
        oprot.writeI16(struct.short_val);
      }
      if (struct.isSetInt_val()) {
        oprot.writeI32(struct.int_val);
      }
      if (struct.isSetLong_val()) {
        oprot.writeI64(struct.long_val);
      }
      if (struct.isSetFloat_val()) {
        oprot.writeI32(struct.float_val);
      }
      if (struct.isSetDouble_val()) {
        oprot.writeDouble(struct.double_val);
      }
      if (struct.isSetString_val()) {
        oprot.writeString(struct.string_val);
      }
      if (struct.isSetDecimal_val()) {
        struct.decimal_val.write(oprot);
      }
      if (struct.isSetTimestamp_val()) {
        struct.timestamp_val.write(oprot);
      }
      if (struct.isSetBool_array()) {
        {
          oprot.writeI32(struct.bool_array.size());
          for (boolean _iter36 : struct.bool_array)
          {
            oprot.writeBool(_iter36);
          }
        }
      }
      if (struct.isSetByte_array()) {
        oprot.writeBinary(struct.byte_array);
      }
      if (struct.isSetChar_array()) {
        oprot.writeString(struct.char_array);
      }
      if (struct.isSetShort_array()) {
        {
          oprot.writeI32(struct.short_array.size());
          for (short _iter37 : struct.short_array)
          {
            oprot.writeI16(_iter37);
          }
        }
      }
      if (struct.isSetInt_array()) {
        {
          oprot.writeI32(struct.int_array.size());
          for (int _iter38 : struct.int_array)
          {
            oprot.writeI32(_iter38);
          }
        }
      }
      if (struct.isSetLong_array()) {
        {
          oprot.writeI32(struct.long_array.size());
          for (long _iter39 : struct.long_array)
          {
            oprot.writeI64(_iter39);
          }
        }
      }
      if (struct.isSetFloat_array()) {
        {
          oprot.writeI32(struct.float_array.size());
          for (int _iter40 : struct.float_array)
          {
            oprot.writeI32(_iter40);
          }
        }
      }
      if (struct.isSetDouble_array()) {
        {
          oprot.writeI32(struct.double_array.size());
          for (double _iter41 : struct.double_array)
          {
            oprot.writeDouble(_iter41);
          }
        }
      }
      if (struct.isSetString_array()) {
        {
          oprot.writeI32(struct.string_array.size());
          for (String _iter42 : struct.string_array)
          {
            oprot.writeString(_iter42);
          }
        }
      }
      if (struct.isSetByte_array_array()) {
        {
          oprot.writeI32(struct.byte_array_array.size());
          for (ByteBuffer _iter43 : struct.byte_array_array)
          {
            oprot.writeBinary(_iter43);
          }
        }
      }
      if (struct.isSetRef_val()) {
        oprot.writeI32(struct.ref_val);
      }
      if (struct.isSetList_val()) {
        {
          oprot.writeI32(struct.list_val.size());
          for (int _iter44 : struct.list_val)
          {
            oprot.writeI32(_iter44);
          }
        }
      }
      if (struct.isSetNative_val()) {
        oprot.writeBinary(struct.native_val);
      }
      if (struct.isSetNull_val()) {
        oprot.writeBool(struct.null_val);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FieldValue struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(25);
      if (incoming.get(0)) {
        struct.bool_val = iprot.readBool();
        struct.setBool_valIsSet(true);
      }
      if (incoming.get(1)) {
        struct.byte_val = iprot.readByte();
        struct.setByte_valIsSet(true);
      }
      if (incoming.get(2)) {
        struct.char_val = iprot.readI16();
        struct.setChar_valIsSet(true);
      }
      if (incoming.get(3)) {
        struct.short_val = iprot.readI16();
        struct.setShort_valIsSet(true);
      }
      if (incoming.get(4)) {
        struct.int_val = iprot.readI32();
        struct.setInt_valIsSet(true);
      }
      if (incoming.get(5)) {
        struct.long_val = iprot.readI64();
        struct.setLong_valIsSet(true);
      }
      if (incoming.get(6)) {
        struct.float_val = iprot.readI32();
        struct.setFloat_valIsSet(true);
      }
      if (incoming.get(7)) {
        struct.double_val = iprot.readDouble();
        struct.setDouble_valIsSet(true);
      }
      if (incoming.get(8)) {
        struct.string_val = iprot.readString();
        struct.setString_valIsSet(true);
      }
      if (incoming.get(9)) {
        struct.decimal_val = new Decimal();
        struct.decimal_val.read(iprot);
        struct.setDecimal_valIsSet(true);
      }
      if (incoming.get(10)) {
        struct.timestamp_val = new Timestamp();
        struct.timestamp_val.read(iprot);
        struct.setTimestamp_valIsSet(true);
      }
      if (incoming.get(11)) {
        {
          org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32());
          struct.bool_array = new ArrayList<Boolean>(_list45.size);
          for (int _i46 = 0; _i46 < _list45.size; ++_i46)
          {
            boolean _elem47;
            _elem47 = iprot.readBool();
            struct.bool_array.add(_elem47);
          }
        }
        struct.setBool_arrayIsSet(true);
      }
      if (incoming.get(12)) {
        struct.byte_array = iprot.readBinary();
        struct.setByte_arrayIsSet(true);
      }
      if (incoming.get(13)) {
        struct.char_array = iprot.readString();
        struct.setChar_arrayIsSet(true);
      }
      if (incoming.get(14)) {
        {
          org.apache.thrift.protocol.TList _list48 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I16, iprot.readI32());
          struct.short_array = new ArrayList<Short>(_list48.size);
          for (int _i49 = 0; _i49 < _list48.size; ++_i49)
          {
            short _elem50;
            _elem50 = iprot.readI16();
            struct.short_array.add(_elem50);
          }
        }
        struct.setShort_arrayIsSet(true);
      }
      if (incoming.get(15)) {
        {
          org.apache.thrift.protocol.TList _list51 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.int_array = new ArrayList<Integer>(_list51.size);
          for (int _i52 = 0; _i52 < _list51.size; ++_i52)
          {
            int _elem53;
            _elem53 = iprot.readI32();
            struct.int_array.add(_elem53);
          }
        }
        struct.setInt_arrayIsSet(true);
      }
      if (incoming.get(16)) {
        {
          org.apache.thrift.protocol.TList _list54 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32());
          struct.long_array = new ArrayList<Long>(_list54.size);
          for (int _i55 = 0; _i55 < _list54.size; ++_i55)
          {
            long _elem56;
            _elem56 = iprot.readI64();
            struct.long_array.add(_elem56);
          }
        }
        struct.setLong_arrayIsSet(true);
      }
      if (incoming.get(17)) {
        {
          org.apache.thrift.protocol.TList _list57 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.float_array = new ArrayList<Integer>(_list57.size);
          for (int _i58 = 0; _i58 < _list57.size; ++_i58)
          {
            int _elem59;
            _elem59 = iprot.readI32();
            struct.float_array.add(_elem59);
          }
        }
        struct.setFloat_arrayIsSet(true);
      }
      if (incoming.get(18)) {
        {
          org.apache.thrift.protocol.TList _list60 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.DOUBLE, iprot.readI32());
          struct.double_array = new ArrayList<Double>(_list60.size);
          for (int _i61 = 0; _i61 < _list60.size; ++_i61)
          {
            double _elem62;
            _elem62 = iprot.readDouble();
            struct.double_array.add(_elem62);
          }
        }
        struct.setDouble_arrayIsSet(true);
      }
      if (incoming.get(19)) {
        {
          org.apache.thrift.protocol.TList _list63 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.string_array = new ArrayList<String>(_list63.size);
          for (int _i64 = 0; _i64 < _list63.size; ++_i64)
          {
            String _elem65;
            _elem65 = iprot.readString();
            struct.string_array.add(_elem65);
          }
        }
        struct.setString_arrayIsSet(true);
      }
      if (incoming.get(20)) {
        {
          org.apache.thrift.protocol.TList _list66 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.byte_array_array = new ArrayList<ByteBuffer>(_list66.size);
          for (int _i67 = 0; _i67 < _list66.size; ++_i67)
          {
            ByteBuffer _elem68;
            _elem68 = iprot.readBinary();
            struct.byte_array_array.add(_elem68);
          }
        }
        struct.setByte_array_arrayIsSet(true);
      }
      if (incoming.get(21)) {
        struct.ref_val = iprot.readI32();
        struct.setRef_valIsSet(true);
      }
      if (incoming.get(22)) {
        {
          org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.list_val = new ArrayList<Integer>(_list69.size);
          for (int _i70 = 0; _i70 < _list69.size; ++_i70)
          {
            int _elem71;
            _elem71 = iprot.readI32();
            struct.list_val.add(_elem71);
          }
        }
        struct.setList_valIsSet(true);
      }
      if (incoming.get(23)) {
        struct.native_val = iprot.readBinary();
        struct.setNative_valIsSet(true);
      }
      if (incoming.get(24)) {
        struct.null_val = iprot.readBool();
        struct.setNull_valIsSet(true);
      }
    }
  }

}