/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.avro.thrift.test;

@SuppressWarnings({ "cast", "rawtypes", "serial", "unchecked", "unused" })
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2021-03-18")
public class Test
    implements org.apache.thrift.TBase<Test, Test._Fields>, java.io.Serializable, Cloneable, Comparable<Test> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Test");

  private static final org.apache.thrift.protocol.TField BOOL_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "boolField", org.apache.thrift.protocol.TType.BOOL, (short) 1);
  private static final org.apache.thrift.protocol.TField BYTE_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "byteField", org.apache.thrift.protocol.TType.BYTE, (short) 2);
  private static final org.apache.thrift.protocol.TField BYTE_OPTIONAL_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "byteOptionalField", org.apache.thrift.protocol.TType.BYTE, (short) 16);
  private static final org.apache.thrift.protocol.TField I16_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "i16Field", org.apache.thrift.protocol.TType.I16, (short) 3);
  private static final org.apache.thrift.protocol.TField I16_OPTIONAL_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "i16OptionalField", org.apache.thrift.protocol.TType.I16, (short) 15);
  private static final org.apache.thrift.protocol.TField I32_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "i32Field", org.apache.thrift.protocol.TType.I32, (short) 4);
  private static final org.apache.thrift.protocol.TField I64_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "i64Field", org.apache.thrift.protocol.TType.I64, (short) 5);
  private static final org.apache.thrift.protocol.TField DOUBLE_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "doubleField", org.apache.thrift.protocol.TType.DOUBLE, (short) 6);
  private static final org.apache.thrift.protocol.TField STRING_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "stringField", org.apache.thrift.protocol.TType.STRING, (short) 7);
  private static final org.apache.thrift.protocol.TField BINARY_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "binaryField", org.apache.thrift.protocol.TType.STRING, (short) 8);
  private static final org.apache.thrift.protocol.TField MAP_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "mapField", org.apache.thrift.protocol.TType.MAP, (short) 9);
  private static final org.apache.thrift.protocol.TField LIST_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "listField", org.apache.thrift.protocol.TType.LIST, (short) 10);
  private static final org.apache.thrift.protocol.TField SET_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "setField", org.apache.thrift.protocol.TType.SET, (short) 11);
  private static final org.apache.thrift.protocol.TField ENUM_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "enumField", org.apache.thrift.protocol.TType.I32, (short) 12);
  private static final org.apache.thrift.protocol.TField STRUCT_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "structField", org.apache.thrift.protocol.TType.STRUCT, (short) 13);
  private static final org.apache.thrift.protocol.TField FOO_OR_BAR_FIELD_DESC = new org.apache.thrift.protocol.TField(
      "fooOrBar", org.apache.thrift.protocol.TType.STRUCT, (short) 14);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TestStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TestTupleSchemeFactory();

  private boolean boolField; // required
  private byte byteField; // required
  private byte byteOptionalField; // optional
  private short i16Field; // required
  private short i16OptionalField; // optional
  private int i32Field; // optional
  private long i64Field; // required
  private double doubleField; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String stringField; // required
  private @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer binaryField; // optional
  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String, java.lang.Integer> mapField; // required
  private @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Integer> listField; // required
  private @org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> setField; // required
  private @org.apache.thrift.annotation.Nullable E enumField; // required
  private @org.apache.thrift.annotation.Nullable Nested structField; // required
  private @org.apache.thrift.annotation.Nullable FooOrBar fooOrBar; // required

  /**
   * 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_FIELD((short) 1, "boolField"), BYTE_FIELD((short) 2, "byteField"),
    BYTE_OPTIONAL_FIELD((short) 16, "byteOptionalField"), I16_FIELD((short) 3, "i16Field"),
    I16_OPTIONAL_FIELD((short) 15, "i16OptionalField"), I32_FIELD((short) 4, "i32Field"),
    I64_FIELD((short) 5, "i64Field"), DOUBLE_FIELD((short) 6, "doubleField"), STRING_FIELD((short) 7, "stringField"),
    BINARY_FIELD((short) 8, "binaryField"), MAP_FIELD((short) 9, "mapField"), LIST_FIELD((short) 10, "listField"),
    SET_FIELD((short) 11, "setField"),
    /**
     * 
     * @see E
     */
    ENUM_FIELD((short) 12, "enumField"), STRUCT_FIELD((short) 13, "structField"), FOO_OR_BAR((short) 14, "fooOrBar");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch (fieldId) {
      case 1: // BOOL_FIELD
        return BOOL_FIELD;
      case 2: // BYTE_FIELD
        return BYTE_FIELD;
      case 16: // BYTE_OPTIONAL_FIELD
        return BYTE_OPTIONAL_FIELD;
      case 3: // I16_FIELD
        return I16_FIELD;
      case 15: // I16_OPTIONAL_FIELD
        return I16_OPTIONAL_FIELD;
      case 4: // I32_FIELD
        return I32_FIELD;
      case 5: // I64_FIELD
        return I64_FIELD;
      case 6: // DOUBLE_FIELD
        return DOUBLE_FIELD;
      case 7: // STRING_FIELD
        return STRING_FIELD;
      case 8: // BINARY_FIELD
        return BINARY_FIELD;
      case 9: // MAP_FIELD
        return MAP_FIELD;
      case 10: // LIST_FIELD
        return LIST_FIELD;
      case 11: // SET_FIELD
        return SET_FIELD;
      case 12: // ENUM_FIELD
        return ENUM_FIELD;
      case 13: // STRUCT_FIELD
        return STRUCT_FIELD;
      case 14: // FOO_OR_BAR
        return FOO_OR_BAR;
      default:
        return null;
      }
    }

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

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

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

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

    public short getThriftFieldId() {
      return _thriftId;
    }

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

  // isset id assignments
  private static final int __BOOLFIELD_ISSET_ID = 0;
  private static final int __BYTEFIELD_ISSET_ID = 1;
  private static final int __BYTEOPTIONALFIELD_ISSET_ID = 2;
  private static final int __I16FIELD_ISSET_ID = 3;
  private static final int __I16OPTIONALFIELD_ISSET_ID = 4;
  private static final int __I32FIELD_ISSET_ID = 5;
  private static final int __I64FIELD_ISSET_ID = 6;
  private static final int __DOUBLEFIELD_ISSET_ID = 7;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = { _Fields.BYTE_OPTIONAL_FIELD, _Fields.I16_OPTIONAL_FIELD,
      _Fields.I32_FIELD, _Fields.BINARY_FIELD };
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
        _Fields.class);
    tmpMap.put(_Fields.BOOL_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("boolField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.BYTE_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("byteField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.BYTE_OPTIONAL_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("byteOptionalField",
            org.apache.thrift.TFieldRequirementType.OPTIONAL,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.I16_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("i16Field", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.I16_OPTIONAL_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("i16OptionalField",
            org.apache.thrift.TFieldRequirementType.OPTIONAL,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.I32_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("i32Field", org.apache.thrift.TFieldRequirementType.OPTIONAL,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.I64_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("i64Field", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DOUBLE_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("doubleField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.STRING_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("stringField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BINARY_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("binaryField", org.apache.thrift.TFieldRequirementType.OPTIONAL,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
    tmpMap.put(_Fields.MAP_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("mapField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.LIST_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("listField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            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.SET_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("setField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.ENUM_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("enumField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, E.class)));
    tmpMap.put(_Fields.STRUCT_FIELD,
        new org.apache.thrift.meta_data.FieldMetaData("structField", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Nested.class)));
    tmpMap.put(_Fields.FOO_OR_BAR,
        new org.apache.thrift.meta_data.FieldMetaData("fooOrBar", org.apache.thrift.TFieldRequirementType.DEFAULT,
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, FooOrBar.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Test.class, metaDataMap);
  }

  public Test() {
  }

  public Test(boolean boolField, byte byteField, short i16Field, long i64Field, double doubleField,
      java.lang.String stringField, java.util.Map<java.lang.String, java.lang.Integer> mapField,
      java.util.List<java.lang.Integer> listField, java.util.Set<java.lang.Integer> setField, E enumField,
      Nested structField, FooOrBar fooOrBar) {
    this();
    this.boolField = boolField;
    setBoolFieldIsSet(true);
    this.byteField = byteField;
    setByteFieldIsSet(true);
    this.i16Field = i16Field;
    setI16FieldIsSet(true);
    this.i64Field = i64Field;
    setI64FieldIsSet(true);
    this.doubleField = doubleField;
    setDoubleFieldIsSet(true);
    this.stringField = stringField;
    this.mapField = mapField;
    this.listField = listField;
    this.setField = setField;
    this.enumField = enumField;
    this.structField = structField;
    this.fooOrBar = fooOrBar;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Test(Test other) {
    __isset_bitfield = other.__isset_bitfield;
    this.boolField = other.boolField;
    this.byteField = other.byteField;
    this.byteOptionalField = other.byteOptionalField;
    this.i16Field = other.i16Field;
    this.i16OptionalField = other.i16OptionalField;
    this.i32Field = other.i32Field;
    this.i64Field = other.i64Field;
    this.doubleField = other.doubleField;
    if (other.isSetStringField()) {
      this.stringField = other.stringField;
    }
    if (other.isSetBinaryField()) {
      this.binaryField = org.apache.thrift.TBaseHelper.copyBinary(other.binaryField);
    }
    if (other.isSetMapField()) {
      java.util.Map<java.lang.String, java.lang.Integer> __this__mapField = new java.util.HashMap<java.lang.String, java.lang.Integer>(
          other.mapField);
      this.mapField = __this__mapField;
    }
    if (other.isSetListField()) {
      java.util.List<java.lang.Integer> __this__listField = new java.util.ArrayList<java.lang.Integer>(other.listField);
      this.listField = __this__listField;
    }
    if (other.isSetSetField()) {
      java.util.Set<java.lang.Integer> __this__setField = new java.util.HashSet<java.lang.Integer>(other.setField);
      this.setField = __this__setField;
    }
    if (other.isSetEnumField()) {
      this.enumField = other.enumField;
    }
    if (other.isSetStructField()) {
      this.structField = new Nested(other.structField);
    }
    if (other.isSetFooOrBar()) {
      this.fooOrBar = new FooOrBar(other.fooOrBar);
    }
  }

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

  @Override
  public void clear() {
    setBoolFieldIsSet(false);
    this.boolField = false;
    setByteFieldIsSet(false);
    this.byteField = 0;
    setByteOptionalFieldIsSet(false);
    this.byteOptionalField = 0;
    setI16FieldIsSet(false);
    this.i16Field = 0;
    setI16OptionalFieldIsSet(false);
    this.i16OptionalField = 0;
    setI32FieldIsSet(false);
    this.i32Field = 0;
    setI64FieldIsSet(false);
    this.i64Field = 0;
    setDoubleFieldIsSet(false);
    this.doubleField = 0.0;
    this.stringField = null;
    this.binaryField = null;
    this.mapField = null;
    this.listField = null;
    this.setField = null;
    this.enumField = null;
    this.structField = null;
    this.fooOrBar = null;
  }

  public boolean isBoolField() {
    return this.boolField;
  }

  public void setBoolField(boolean boolField) {
    this.boolField = boolField;
    setBoolFieldIsSet(true);
  }

  public void unsetBoolField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BOOLFIELD_ISSET_ID);
  }

  /**
   * Returns true if field boolField is set (has been assigned a value) and false
   * otherwise
   */
  public boolean isSetBoolField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BOOLFIELD_ISSET_ID);
  }

  public void setBoolFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BOOLFIELD_ISSET_ID, value);
  }

  public byte getByteField() {
    return this.byteField;
  }

  public void setByteField(byte byteField) {
    this.byteField = byteField;
    setByteFieldIsSet(true);
  }

  public void unsetByteField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BYTEFIELD_ISSET_ID);
  }

  /**
   * Returns true if field byteField is set (has been assigned a value) and false
   * otherwise
   */
  public boolean isSetByteField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BYTEFIELD_ISSET_ID);
  }

  public void setByteFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BYTEFIELD_ISSET_ID, value);
  }

  public byte getByteOptionalField() {
    return this.byteOptionalField;
  }

  public void setByteOptionalField(byte byteOptionalField) {
    this.byteOptionalField = byteOptionalField;
    setByteOptionalFieldIsSet(true);
  }

  public void unsetByteOptionalField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BYTEOPTIONALFIELD_ISSET_ID);
  }

  /**
   * Returns true if field byteOptionalField is set (has been assigned a value)
   * and false otherwise
   */
  public boolean isSetByteOptionalField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BYTEOPTIONALFIELD_ISSET_ID);
  }

  public void setByteOptionalFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BYTEOPTIONALFIELD_ISSET_ID, value);
  }

  public short getI16Field() {
    return this.i16Field;
  }

  public void setI16Field(short i16Field) {
    this.i16Field = i16Field;
    setI16FieldIsSet(true);
  }

  public void unsetI16Field() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __I16FIELD_ISSET_ID);
  }

  /**
   * Returns true if field i16Field is set (has been assigned a value) and false
   * otherwise
   */
  public boolean isSetI16Field() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __I16FIELD_ISSET_ID);
  }

  public void setI16FieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __I16FIELD_ISSET_ID, value);
  }

  public short getI16OptionalField() {
    return this.i16OptionalField;
  }

  public void setI16OptionalField(short i16OptionalField) {
    this.i16OptionalField = i16OptionalField;
    setI16OptionalFieldIsSet(true);
  }

  public void unsetI16OptionalField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __I16OPTIONALFIELD_ISSET_ID);
  }

  /**
   * Returns true if field i16OptionalField is set (has been assigned a value) and
   * false otherwise
   */
  public boolean isSetI16OptionalField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __I16OPTIONALFIELD_ISSET_ID);
  }

  public void setI16OptionalFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __I16OPTIONALFIELD_ISSET_ID, value);
  }

  public int getI32Field() {
    return this.i32Field;
  }

  public void setI32Field(int i32Field) {
    this.i32Field = i32Field;
    setI32FieldIsSet(true);
  }

  public void unsetI32Field() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __I32FIELD_ISSET_ID);
  }

  /**
   * Returns true if field i32Field is set (has been assigned a value) and false
   * otherwise
   */
  public boolean isSetI32Field() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __I32FIELD_ISSET_ID);
  }

  public void setI32FieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __I32FIELD_ISSET_ID, value);
  }

  public long getI64Field() {
    return this.i64Field;
  }

  public void setI64Field(long i64Field) {
    this.i64Field = i64Field;
    setI64FieldIsSet(true);
  }

  public void unsetI64Field() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __I64FIELD_ISSET_ID);
  }

  /**
   * Returns true if field i64Field is set (has been assigned a value) and false
   * otherwise
   */
  public boolean isSetI64Field() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __I64FIELD_ISSET_ID);
  }

  public void setI64FieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __I64FIELD_ISSET_ID, value);
  }

  public double getDoubleField() {
    return this.doubleField;
  }

  public void setDoubleField(double doubleField) {
    this.doubleField = doubleField;
    setDoubleFieldIsSet(true);
  }

  public void unsetDoubleField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID);
  }

  /**
   * Returns true if field doubleField is set (has been assigned a value) and
   * false otherwise
   */
  public boolean isSetDoubleField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID);
  }

  public void setDoubleFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getStringField() {
    return this.stringField;
  }

  public void setStringField(@org.apache.thrift.annotation.Nullable java.lang.String stringField) {
    this.stringField = stringField;
  }

  public void unsetStringField() {
    this.stringField = null;
  }

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

  public void setStringFieldIsSet(boolean value) {
    if (!value) {
      this.stringField = null;
    }
  }

  public byte[] getBinaryField() {
    setBinaryField(org.apache.thrift.TBaseHelper.rightSize(binaryField));
    return binaryField == null ? null : binaryField.array();
  }

  public java.nio.ByteBuffer bufferForBinaryField() {
    return org.apache.thrift.TBaseHelper.copyBinary(binaryField);
  }

  public void setBinaryField(byte[] binaryField) {
    this.binaryField = binaryField == null ? (java.nio.ByteBuffer) null : java.nio.ByteBuffer.wrap(binaryField.clone());
  }

  public void setBinaryField(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer binaryField) {
    this.binaryField = org.apache.thrift.TBaseHelper.copyBinary(binaryField);
  }

  public void unsetBinaryField() {
    this.binaryField = null;
  }

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

  public void setBinaryFieldIsSet(boolean value) {
    if (!value) {
      this.binaryField = null;
    }
  }

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

  public void putToMapField(java.lang.String key, int val) {
    if (this.mapField == null) {
      this.mapField = new java.util.HashMap<java.lang.String, java.lang.Integer>();
    }
    this.mapField.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String, java.lang.Integer> getMapField() {
    return this.mapField;
  }

  public void setMapField(
      @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String, java.lang.Integer> mapField) {
    this.mapField = mapField;
  }

  public void unsetMapField() {
    this.mapField = null;
  }

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

  public void setMapFieldIsSet(boolean value) {
    if (!value) {
      this.mapField = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Integer> getListFieldIterator() {
    return (this.listField == null) ? null : this.listField.iterator();
  }

  public void addToListField(int elem) {
    if (this.listField == null) {
      this.listField = new java.util.ArrayList<java.lang.Integer>();
    }
    this.listField.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Integer> getListField() {
    return this.listField;
  }

  public void setListField(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Integer> listField) {
    this.listField = listField;
  }

  public void unsetListField() {
    this.listField = null;
  }

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

  public void setListFieldIsSet(boolean value) {
    if (!value) {
      this.listField = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Integer> getSetFieldIterator() {
    return (this.setField == null) ? null : this.setField.iterator();
  }

  public void addToSetField(int elem) {
    if (this.setField == null) {
      this.setField = new java.util.HashSet<java.lang.Integer>();
    }
    this.setField.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Set<java.lang.Integer> getSetField() {
    return this.setField;
  }

  public void setSetField(@org.apache.thrift.annotation.Nullable java.util.Set<java.lang.Integer> setField) {
    this.setField = setField;
  }

  public void unsetSetField() {
    this.setField = null;
  }

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

  public void setSetFieldIsSet(boolean value) {
    if (!value) {
      this.setField = null;
    }
  }

  /**
   * 
   * @see E
   */
  @org.apache.thrift.annotation.Nullable
  public E getEnumField() {
    return this.enumField;
  }

  /**
   * 
   * @see E
   */
  public void setEnumField(@org.apache.thrift.annotation.Nullable E enumField) {
    this.enumField = enumField;
  }

  public void unsetEnumField() {
    this.enumField = null;
  }

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

  public void setEnumFieldIsSet(boolean value) {
    if (!value) {
      this.enumField = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public Nested getStructField() {
    return this.structField;
  }

  public void setStructField(@org.apache.thrift.annotation.Nullable Nested structField) {
    this.structField = structField;
  }

  public void unsetStructField() {
    this.structField = null;
  }

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

  public void setStructFieldIsSet(boolean value) {
    if (!value) {
      this.structField = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public FooOrBar getFooOrBar() {
    return this.fooOrBar;
  }

  public void setFooOrBar(@org.apache.thrift.annotation.Nullable FooOrBar fooOrBar) {
    this.fooOrBar = fooOrBar;
  }

  public void unsetFooOrBar() {
    this.fooOrBar = null;
  }

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

  public void setFooOrBarIsSet(boolean value) {
    if (!value) {
      this.fooOrBar = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case BOOL_FIELD:
      if (value == null) {
        unsetBoolField();
      } else {
        setBoolField((java.lang.Boolean) value);
      }
      break;

    case BYTE_FIELD:
      if (value == null) {
        unsetByteField();
      } else {
        setByteField((java.lang.Byte) value);
      }
      break;

    case BYTE_OPTIONAL_FIELD:
      if (value == null) {
        unsetByteOptionalField();
      } else {
        setByteOptionalField((java.lang.Byte) value);
      }
      break;

    case I16_FIELD:
      if (value == null) {
        unsetI16Field();
      } else {
        setI16Field((java.lang.Short) value);
      }
      break;

    case I16_OPTIONAL_FIELD:
      if (value == null) {
        unsetI16OptionalField();
      } else {
        setI16OptionalField((java.lang.Short) value);
      }
      break;

    case I32_FIELD:
      if (value == null) {
        unsetI32Field();
      } else {
        setI32Field((java.lang.Integer) value);
      }
      break;

    case I64_FIELD:
      if (value == null) {
        unsetI64Field();
      } else {
        setI64Field((java.lang.Long) value);
      }
      break;

    case DOUBLE_FIELD:
      if (value == null) {
        unsetDoubleField();
      } else {
        setDoubleField((java.lang.Double) value);
      }
      break;

    case STRING_FIELD:
      if (value == null) {
        unsetStringField();
      } else {
        setStringField((java.lang.String) value);
      }
      break;

    case BINARY_FIELD:
      if (value == null) {
        unsetBinaryField();
      } else {
        if (value instanceof byte[]) {
          setBinaryField((byte[]) value);
        } else {
          setBinaryField((java.nio.ByteBuffer) value);
        }
      }
      break;

    case MAP_FIELD:
      if (value == null) {
        unsetMapField();
      } else {
        setMapField((java.util.Map<java.lang.String, java.lang.Integer>) value);
      }
      break;

    case LIST_FIELD:
      if (value == null) {
        unsetListField();
      } else {
        setListField((java.util.List<java.lang.Integer>) value);
      }
      break;

    case SET_FIELD:
      if (value == null) {
        unsetSetField();
      } else {
        setSetField((java.util.Set<java.lang.Integer>) value);
      }
      break;

    case ENUM_FIELD:
      if (value == null) {
        unsetEnumField();
      } else {
        setEnumField((E) value);
      }
      break;

    case STRUCT_FIELD:
      if (value == null) {
        unsetStructField();
      } else {
        setStructField((Nested) value);
      }
      break;

    case FOO_OR_BAR:
      if (value == null) {
        unsetFooOrBar();
      } else {
        setFooOrBar((FooOrBar) value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case BOOL_FIELD:
      return isBoolField();

    case BYTE_FIELD:
      return getByteField();

    case BYTE_OPTIONAL_FIELD:
      return getByteOptionalField();

    case I16_FIELD:
      return getI16Field();

    case I16_OPTIONAL_FIELD:
      return getI16OptionalField();

    case I32_FIELD:
      return getI32Field();

    case I64_FIELD:
      return getI64Field();

    case DOUBLE_FIELD:
      return getDoubleField();

    case STRING_FIELD:
      return getStringField();

    case BINARY_FIELD:
      return getBinaryField();

    case MAP_FIELD:
      return getMapField();

    case LIST_FIELD:
      return getListField();

    case SET_FIELD:
      return getSetField();

    case ENUM_FIELD:
      return getEnumField();

    case STRUCT_FIELD:
      return getStructField();

    case FOO_OR_BAR:
      return getFooOrBar();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case BOOL_FIELD:
      return isSetBoolField();
    case BYTE_FIELD:
      return isSetByteField();
    case BYTE_OPTIONAL_FIELD:
      return isSetByteOptionalField();
    case I16_FIELD:
      return isSetI16Field();
    case I16_OPTIONAL_FIELD:
      return isSetI16OptionalField();
    case I32_FIELD:
      return isSetI32Field();
    case I64_FIELD:
      return isSetI64Field();
    case DOUBLE_FIELD:
      return isSetDoubleField();
    case STRING_FIELD:
      return isSetStringField();
    case BINARY_FIELD:
      return isSetBinaryField();
    case MAP_FIELD:
      return isSetMapField();
    case LIST_FIELD:
      return isSetListField();
    case SET_FIELD:
      return isSetSetField();
    case ENUM_FIELD:
      return isSetEnumField();
    case STRUCT_FIELD:
      return isSetStructField();
    case FOO_OR_BAR:
      return isSetFooOrBar();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof Test)
      return this.equals((Test) that);
    return false;
  }

  public boolean equals(Test that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_boolField = true;
    boolean that_present_boolField = true;
    if (this_present_boolField || that_present_boolField) {
      if (!(this_present_boolField && that_present_boolField))
        return false;
      if (this.boolField != that.boolField)
        return false;
    }

    boolean this_present_byteField = true;
    boolean that_present_byteField = true;
    if (this_present_byteField || that_present_byteField) {
      if (!(this_present_byteField && that_present_byteField))
        return false;
      if (this.byteField != that.byteField)
        return false;
    }

    boolean this_present_byteOptionalField = true && this.isSetByteOptionalField();
    boolean that_present_byteOptionalField = true && that.isSetByteOptionalField();
    if (this_present_byteOptionalField || that_present_byteOptionalField) {
      if (!(this_present_byteOptionalField && that_present_byteOptionalField))
        return false;
      if (this.byteOptionalField != that.byteOptionalField)
        return false;
    }

    boolean this_present_i16Field = true;
    boolean that_present_i16Field = true;
    if (this_present_i16Field || that_present_i16Field) {
      if (!(this_present_i16Field && that_present_i16Field))
        return false;
      if (this.i16Field != that.i16Field)
        return false;
    }

    boolean this_present_i16OptionalField = true && this.isSetI16OptionalField();
    boolean that_present_i16OptionalField = true && that.isSetI16OptionalField();
    if (this_present_i16OptionalField || that_present_i16OptionalField) {
      if (!(this_present_i16OptionalField && that_present_i16OptionalField))
        return false;
      if (this.i16OptionalField != that.i16OptionalField)
        return false;
    }

    boolean this_present_i32Field = true && this.isSetI32Field();
    boolean that_present_i32Field = true && that.isSetI32Field();
    if (this_present_i32Field || that_present_i32Field) {
      if (!(this_present_i32Field && that_present_i32Field))
        return false;
      if (this.i32Field != that.i32Field)
        return false;
    }

    boolean this_present_i64Field = true;
    boolean that_present_i64Field = true;
    if (this_present_i64Field || that_present_i64Field) {
      if (!(this_present_i64Field && that_present_i64Field))
        return false;
      if (this.i64Field != that.i64Field)
        return false;
    }

    boolean this_present_doubleField = true;
    boolean that_present_doubleField = true;
    if (this_present_doubleField || that_present_doubleField) {
      if (!(this_present_doubleField && that_present_doubleField))
        return false;
      if (this.doubleField != that.doubleField)
        return false;
    }

    boolean this_present_stringField = true && this.isSetStringField();
    boolean that_present_stringField = true && that.isSetStringField();
    if (this_present_stringField || that_present_stringField) {
      if (!(this_present_stringField && that_present_stringField))
        return false;
      if (!this.stringField.equals(that.stringField))
        return false;
    }

    boolean this_present_binaryField = true && this.isSetBinaryField();
    boolean that_present_binaryField = true && that.isSetBinaryField();
    if (this_present_binaryField || that_present_binaryField) {
      if (!(this_present_binaryField && that_present_binaryField))
        return false;
      if (!this.binaryField.equals(that.binaryField))
        return false;
    }

    boolean this_present_mapField = true && this.isSetMapField();
    boolean that_present_mapField = true && that.isSetMapField();
    if (this_present_mapField || that_present_mapField) {
      if (!(this_present_mapField && that_present_mapField))
        return false;
      if (!this.mapField.equals(that.mapField))
        return false;
    }

    boolean this_present_listField = true && this.isSetListField();
    boolean that_present_listField = true && that.isSetListField();
    if (this_present_listField || that_present_listField) {
      if (!(this_present_listField && that_present_listField))
        return false;
      if (!this.listField.equals(that.listField))
        return false;
    }

    boolean this_present_setField = true && this.isSetSetField();
    boolean that_present_setField = true && that.isSetSetField();
    if (this_present_setField || that_present_setField) {
      if (!(this_present_setField && that_present_setField))
        return false;
      if (!this.setField.equals(that.setField))
        return false;
    }

    boolean this_present_enumField = true && this.isSetEnumField();
    boolean that_present_enumField = true && that.isSetEnumField();
    if (this_present_enumField || that_present_enumField) {
      if (!(this_present_enumField && that_present_enumField))
        return false;
      if (!this.enumField.equals(that.enumField))
        return false;
    }

    boolean this_present_structField = true && this.isSetStructField();
    boolean that_present_structField = true && that.isSetStructField();
    if (this_present_structField || that_present_structField) {
      if (!(this_present_structField && that_present_structField))
        return false;
      if (!this.structField.equals(that.structField))
        return false;
    }

    boolean this_present_fooOrBar = true && this.isSetFooOrBar();
    boolean that_present_fooOrBar = true && that.isSetFooOrBar();
    if (this_present_fooOrBar || that_present_fooOrBar) {
      if (!(this_present_fooOrBar && that_present_fooOrBar))
        return false;
      if (!this.fooOrBar.equals(that.fooOrBar))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((boolField) ? 131071 : 524287);

    hashCode = hashCode * 8191 + (int) (byteField);

    hashCode = hashCode * 8191 + ((isSetByteOptionalField()) ? 131071 : 524287);
    if (isSetByteOptionalField())
      hashCode = hashCode * 8191 + (int) (byteOptionalField);

    hashCode = hashCode * 8191 + i16Field;

    hashCode = hashCode * 8191 + ((isSetI16OptionalField()) ? 131071 : 524287);
    if (isSetI16OptionalField())
      hashCode = hashCode * 8191 + i16OptionalField;

    hashCode = hashCode * 8191 + ((isSetI32Field()) ? 131071 : 524287);
    if (isSetI32Field())
      hashCode = hashCode * 8191 + i32Field;

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(i64Field);

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(doubleField);

    hashCode = hashCode * 8191 + ((isSetStringField()) ? 131071 : 524287);
    if (isSetStringField())
      hashCode = hashCode * 8191 + stringField.hashCode();

    hashCode = hashCode * 8191 + ((isSetBinaryField()) ? 131071 : 524287);
    if (isSetBinaryField())
      hashCode = hashCode * 8191 + binaryField.hashCode();

    hashCode = hashCode * 8191 + ((isSetMapField()) ? 131071 : 524287);
    if (isSetMapField())
      hashCode = hashCode * 8191 + mapField.hashCode();

    hashCode = hashCode * 8191 + ((isSetListField()) ? 131071 : 524287);
    if (isSetListField())
      hashCode = hashCode * 8191 + listField.hashCode();

    hashCode = hashCode * 8191 + ((isSetSetField()) ? 131071 : 524287);
    if (isSetSetField())
      hashCode = hashCode * 8191 + setField.hashCode();

    hashCode = hashCode * 8191 + ((isSetEnumField()) ? 131071 : 524287);
    if (isSetEnumField())
      hashCode = hashCode * 8191 + enumField.getValue();

    hashCode = hashCode * 8191 + ((isSetStructField()) ? 131071 : 524287);
    if (isSetStructField())
      hashCode = hashCode * 8191 + structField.hashCode();

    hashCode = hashCode * 8191 + ((isSetFooOrBar()) ? 131071 : 524287);
    if (isSetFooOrBar())
      hashCode = hashCode * 8191 + fooOrBar.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetBoolField(), other.isSetBoolField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBoolField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.boolField, other.boolField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetByteField(), other.isSetByteField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetByteField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.byteField, other.byteField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetByteOptionalField(), other.isSetByteOptionalField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetByteOptionalField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.byteOptionalField, other.byteOptionalField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetI16Field(), other.isSetI16Field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI16Field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i16Field, other.i16Field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetI16OptionalField(), other.isSetI16OptionalField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI16OptionalField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i16OptionalField, other.i16OptionalField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetI32Field(), other.isSetI32Field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI32Field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i32Field, other.i32Field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetI64Field(), other.isSetI64Field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI64Field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i64Field, other.i64Field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDoubleField(), other.isSetDoubleField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDoubleField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.doubleField, other.doubleField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStringField(), other.isSetStringField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStringField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stringField, other.stringField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBinaryField(), other.isSetBinaryField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBinaryField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.binaryField, other.binaryField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMapField(), other.isSetMapField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMapField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mapField, other.mapField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetListField(), other.isSetListField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetListField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.listField, other.listField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetSetField(), other.isSetSetField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSetField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.setField, other.setField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetEnumField(), other.isSetEnumField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEnumField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enumField, other.enumField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetStructField(), other.isSetStructField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStructField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.structField, other.structField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetFooOrBar(), other.isSetFooOrBar());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFooOrBar()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fooOrBar, other.fooOrBar);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("Test(");
    boolean first = true;

    sb.append("boolField:");
    sb.append(this.boolField);
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("byteField:");
    sb.append(this.byteField);
    first = false;
    if (isSetByteOptionalField()) {
      if (!first)
        sb.append(", ");
      sb.append("byteOptionalField:");
      sb.append(this.byteOptionalField);
      first = false;
    }
    if (!first)
      sb.append(", ");
    sb.append("i16Field:");
    sb.append(this.i16Field);
    first = false;
    if (isSetI16OptionalField()) {
      if (!first)
        sb.append(", ");
      sb.append("i16OptionalField:");
      sb.append(this.i16OptionalField);
      first = false;
    }
    if (isSetI32Field()) {
      if (!first)
        sb.append(", ");
      sb.append("i32Field:");
      sb.append(this.i32Field);
      first = false;
    }
    if (!first)
      sb.append(", ");
    sb.append("i64Field:");
    sb.append(this.i64Field);
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("doubleField:");
    sb.append(this.doubleField);
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("stringField:");
    if (this.stringField == null) {
      sb.append("null");
    } else {
      sb.append(this.stringField);
    }
    first = false;
    if (isSetBinaryField()) {
      if (!first)
        sb.append(", ");
      sb.append("binaryField:");
      if (this.binaryField == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.binaryField, sb);
      }
      first = false;
    }
    if (!first)
      sb.append(", ");
    sb.append("mapField:");
    if (this.mapField == null) {
      sb.append("null");
    } else {
      sb.append(this.mapField);
    }
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("listField:");
    if (this.listField == null) {
      sb.append("null");
    } else {
      sb.append(this.listField);
    }
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("setField:");
    if (this.setField == null) {
      sb.append("null");
    } else {
      sb.append(this.setField);
    }
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("enumField:");
    if (this.enumField == null) {
      sb.append("null");
    } else {
      sb.append(this.enumField);
    }
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("structField:");
    if (this.structField == null) {
      sb.append("null");
    } else {
      sb.append(this.structField);
    }
    first = false;
    if (!first)
      sb.append(", ");
    sb.append("fooOrBar:");
    if (this.fooOrBar == null) {
      sb.append("null");
    } else {
      sb.append(this.fooOrBar);
    }
    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 (structField != null) {
      structField.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, java.lang.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 TestStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TestStandardScheme getScheme() {
      return new TestStandardScheme();
    }
  }

  private static class TestStandardScheme extends org.apache.thrift.scheme.StandardScheme<Test> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Test 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_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
            struct.boolField = iprot.readBool();
            struct.setBoolFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 2: // BYTE_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
            struct.byteField = iprot.readByte();
            struct.setByteFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 16: // BYTE_OPTIONAL_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
            struct.byteOptionalField = iprot.readByte();
            struct.setByteOptionalFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 3: // I16_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
            struct.i16Field = iprot.readI16();
            struct.setI16FieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 15: // I16_OPTIONAL_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
            struct.i16OptionalField = iprot.readI16();
            struct.setI16OptionalFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 4: // I32_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
            struct.i32Field = iprot.readI32();
            struct.setI32FieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 5: // I64_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
            struct.i64Field = iprot.readI64();
            struct.setI64FieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 6: // DOUBLE_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
            struct.doubleField = iprot.readDouble();
            struct.setDoubleFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 7: // STRING_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
            struct.stringField = iprot.readString();
            struct.setStringFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 8: // BINARY_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
            struct.binaryField = iprot.readBinary();
            struct.setBinaryFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 9: // MAP_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
            {
              org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
              struct.mapField = new java.util.HashMap<java.lang.String, java.lang.Integer>(2 * _map0.size);
              @org.apache.thrift.annotation.Nullable
              java.lang.String _key1;
              int _val2;
              for (int _i3 = 0; _i3 < _map0.size; ++_i3) {
                _key1 = iprot.readString();
                _val2 = iprot.readI32();
                struct.mapField.put(_key1, _val2);
              }
              iprot.readMapEnd();
            }
            struct.setMapFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 10: // LIST_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
              struct.listField = new java.util.ArrayList<java.lang.Integer>(_list4.size);
              int _elem5;
              for (int _i6 = 0; _i6 < _list4.size; ++_i6) {
                _elem5 = iprot.readI32();
                struct.listField.add(_elem5);
              }
              iprot.readListEnd();
            }
            struct.setListFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 11: // SET_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
            {
              org.apache.thrift.protocol.TSet _set7 = iprot.readSetBegin();
              struct.setField = new java.util.HashSet<java.lang.Integer>(2 * _set7.size);
              int _elem8;
              for (int _i9 = 0; _i9 < _set7.size; ++_i9) {
                _elem8 = iprot.readI32();
                struct.setField.add(_elem8);
              }
              iprot.readSetEnd();
            }
            struct.setSetFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 12: // ENUM_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
            struct.enumField = org.apache.avro.thrift.test.E.findByValue(iprot.readI32());
            struct.setEnumFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 13: // STRUCT_FIELD
          if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
            struct.structField = new Nested();
            struct.structField.read(iprot);
            struct.setStructFieldIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          break;
        case 14: // FOO_OR_BAR
          if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
            struct.fooOrBar = new FooOrBar();
            struct.fooOrBar.read(iprot);
            struct.setFooOrBarIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BOOL_FIELD_FIELD_DESC);
      oprot.writeBool(struct.boolField);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BYTE_FIELD_FIELD_DESC);
      oprot.writeByte(struct.byteField);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(I16_FIELD_FIELD_DESC);
      oprot.writeI16(struct.i16Field);
      oprot.writeFieldEnd();
      if (struct.isSetI32Field()) {
        oprot.writeFieldBegin(I32_FIELD_FIELD_DESC);
        oprot.writeI32(struct.i32Field);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(I64_FIELD_FIELD_DESC);
      oprot.writeI64(struct.i64Field);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(DOUBLE_FIELD_FIELD_DESC);
      oprot.writeDouble(struct.doubleField);
      oprot.writeFieldEnd();
      if (struct.stringField != null) {
        oprot.writeFieldBegin(STRING_FIELD_FIELD_DESC);
        oprot.writeString(struct.stringField);
        oprot.writeFieldEnd();
      }
      if (struct.binaryField != null) {
        if (struct.isSetBinaryField()) {
          oprot.writeFieldBegin(BINARY_FIELD_FIELD_DESC);
          oprot.writeBinary(struct.binaryField);
          oprot.writeFieldEnd();
        }
      }
      if (struct.mapField != null) {
        oprot.writeFieldBegin(MAP_FIELD_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING,
              org.apache.thrift.protocol.TType.I32, struct.mapField.size()));
          for (java.util.Map.Entry<java.lang.String, java.lang.Integer> _iter10 : struct.mapField.entrySet()) {
            oprot.writeString(_iter10.getKey());
            oprot.writeI32(_iter10.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.listField != null) {
        oprot.writeFieldBegin(LIST_FIELD_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.listField.size()));
          for (int _iter11 : struct.listField) {
            oprot.writeI32(_iter11);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.setField != null) {
        oprot.writeFieldBegin(SET_FIELD_FIELD_DESC);
        {
          oprot.writeSetBegin(
              new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.setField.size()));
          for (int _iter12 : struct.setField) {
            oprot.writeI32(_iter12);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.enumField != null) {
        oprot.writeFieldBegin(ENUM_FIELD_FIELD_DESC);
        oprot.writeI32(struct.enumField.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.structField != null) {
        oprot.writeFieldBegin(STRUCT_FIELD_FIELD_DESC);
        struct.structField.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.fooOrBar != null) {
        oprot.writeFieldBegin(FOO_OR_BAR_FIELD_DESC);
        struct.fooOrBar.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.isSetI16OptionalField()) {
        oprot.writeFieldBegin(I16_OPTIONAL_FIELD_FIELD_DESC);
        oprot.writeI16(struct.i16OptionalField);
        oprot.writeFieldEnd();
      }
      if (struct.isSetByteOptionalField()) {
        oprot.writeFieldBegin(BYTE_OPTIONAL_FIELD_FIELD_DESC);
        oprot.writeByte(struct.byteOptionalField);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TestTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TestTupleScheme getScheme() {
      return new TestTupleScheme();
    }
  }

  private static class TestTupleScheme extends org.apache.thrift.scheme.TupleScheme<Test> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Test struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetBoolField()) {
        optionals.set(0);
      }
      if (struct.isSetByteField()) {
        optionals.set(1);
      }
      if (struct.isSetByteOptionalField()) {
        optionals.set(2);
      }
      if (struct.isSetI16Field()) {
        optionals.set(3);
      }
      if (struct.isSetI16OptionalField()) {
        optionals.set(4);
      }
      if (struct.isSetI32Field()) {
        optionals.set(5);
      }
      if (struct.isSetI64Field()) {
        optionals.set(6);
      }
      if (struct.isSetDoubleField()) {
        optionals.set(7);
      }
      if (struct.isSetStringField()) {
        optionals.set(8);
      }
      if (struct.isSetBinaryField()) {
        optionals.set(9);
      }
      if (struct.isSetMapField()) {
        optionals.set(10);
      }
      if (struct.isSetListField()) {
        optionals.set(11);
      }
      if (struct.isSetSetField()) {
        optionals.set(12);
      }
      if (struct.isSetEnumField()) {
        optionals.set(13);
      }
      if (struct.isSetStructField()) {
        optionals.set(14);
      }
      if (struct.isSetFooOrBar()) {
        optionals.set(15);
      }
      oprot.writeBitSet(optionals, 16);
      if (struct.isSetBoolField()) {
        oprot.writeBool(struct.boolField);
      }
      if (struct.isSetByteField()) {
        oprot.writeByte(struct.byteField);
      }
      if (struct.isSetByteOptionalField()) {
        oprot.writeByte(struct.byteOptionalField);
      }
      if (struct.isSetI16Field()) {
        oprot.writeI16(struct.i16Field);
      }
      if (struct.isSetI16OptionalField()) {
        oprot.writeI16(struct.i16OptionalField);
      }
      if (struct.isSetI32Field()) {
        oprot.writeI32(struct.i32Field);
      }
      if (struct.isSetI64Field()) {
        oprot.writeI64(struct.i64Field);
      }
      if (struct.isSetDoubleField()) {
        oprot.writeDouble(struct.doubleField);
      }
      if (struct.isSetStringField()) {
        oprot.writeString(struct.stringField);
      }
      if (struct.isSetBinaryField()) {
        oprot.writeBinary(struct.binaryField);
      }
      if (struct.isSetMapField()) {
        {
          oprot.writeI32(struct.mapField.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Integer> _iter13 : struct.mapField.entrySet()) {
            oprot.writeString(_iter13.getKey());
            oprot.writeI32(_iter13.getValue());
          }
        }
      }
      if (struct.isSetListField()) {
        {
          oprot.writeI32(struct.listField.size());
          for (int _iter14 : struct.listField) {
            oprot.writeI32(_iter14);
          }
        }
      }
      if (struct.isSetSetField()) {
        {
          oprot.writeI32(struct.setField.size());
          for (int _iter15 : struct.setField) {
            oprot.writeI32(_iter15);
          }
        }
      }
      if (struct.isSetEnumField()) {
        oprot.writeI32(struct.enumField.getValue());
      }
      if (struct.isSetStructField()) {
        struct.structField.write(oprot);
      }
      if (struct.isSetFooOrBar()) {
        struct.fooOrBar.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Test struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(16);
      if (incoming.get(0)) {
        struct.boolField = iprot.readBool();
        struct.setBoolFieldIsSet(true);
      }
      if (incoming.get(1)) {
        struct.byteField = iprot.readByte();
        struct.setByteFieldIsSet(true);
      }
      if (incoming.get(2)) {
        struct.byteOptionalField = iprot.readByte();
        struct.setByteOptionalFieldIsSet(true);
      }
      if (incoming.get(3)) {
        struct.i16Field = iprot.readI16();
        struct.setI16FieldIsSet(true);
      }
      if (incoming.get(4)) {
        struct.i16OptionalField = iprot.readI16();
        struct.setI16OptionalFieldIsSet(true);
      }
      if (incoming.get(5)) {
        struct.i32Field = iprot.readI32();
        struct.setI32FieldIsSet(true);
      }
      if (incoming.get(6)) {
        struct.i64Field = iprot.readI64();
        struct.setI64FieldIsSet(true);
      }
      if (incoming.get(7)) {
        struct.doubleField = iprot.readDouble();
        struct.setDoubleFieldIsSet(true);
      }
      if (incoming.get(8)) {
        struct.stringField = iprot.readString();
        struct.setStringFieldIsSet(true);
      }
      if (incoming.get(9)) {
        struct.binaryField = iprot.readBinary();
        struct.setBinaryFieldIsSet(true);
      }
      if (incoming.get(10)) {
        {
          org.apache.thrift.protocol.TMap _map16 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING,
              org.apache.thrift.protocol.TType.I32);
          struct.mapField = new java.util.HashMap<java.lang.String, java.lang.Integer>(2 * _map16.size);
          @org.apache.thrift.annotation.Nullable
          java.lang.String _key17;
          int _val18;
          for (int _i19 = 0; _i19 < _map16.size; ++_i19) {
            _key17 = iprot.readString();
            _val18 = iprot.readI32();
            struct.mapField.put(_key17, _val18);
          }
        }
        struct.setMapFieldIsSet(true);
      }
      if (incoming.get(11)) {
        {
          org.apache.thrift.protocol.TList _list20 = iprot.readListBegin(org.apache.thrift.protocol.TType.I32);
          struct.listField = new java.util.ArrayList<java.lang.Integer>(_list20.size);
          int _elem21;
          for (int _i22 = 0; _i22 < _list20.size; ++_i22) {
            _elem21 = iprot.readI32();
            struct.listField.add(_elem21);
          }
        }
        struct.setListFieldIsSet(true);
      }
      if (incoming.get(12)) {
        {
          org.apache.thrift.protocol.TSet _set23 = iprot.readSetBegin(org.apache.thrift.protocol.TType.I32);
          struct.setField = new java.util.HashSet<java.lang.Integer>(2 * _set23.size);
          int _elem24;
          for (int _i25 = 0; _i25 < _set23.size; ++_i25) {
            _elem24 = iprot.readI32();
            struct.setField.add(_elem24);
          }
        }
        struct.setSetFieldIsSet(true);
      }
      if (incoming.get(13)) {
        struct.enumField = org.apache.avro.thrift.test.E.findByValue(iprot.readI32());
        struct.setEnumFieldIsSet(true);
      }
      if (incoming.get(14)) {
        struct.structField = new Nested();
        struct.structField.read(iprot);
        struct.setStructFieldIsSet(true);
      }
      if (incoming.get(15)) {
        struct.fooOrBar = new FooOrBar();
        struct.fooOrBar.read(iprot);
        struct.setFooOrBarIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY
        : TUPLE_SCHEME_FACTORY).getScheme();
  }
}
