/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package test.fixtures.patch;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

@SuppressWarnings({ "unused", "serial" })
public class MyStruct implements TBase, java.io.Serializable, Cloneable, Comparable<MyStruct> {
  private static final TStruct STRUCT_DESC = new TStruct("MyStruct");
  private static final TField BOOL_VAL_FIELD_DESC = new TField("boolVal", TType.BOOL, (short)-1);
  private static final TField BYTE_VAL_FIELD_DESC = new TField("byteVal", TType.BYTE, (short)-2);
  private static final TField I16_VAL_FIELD_DESC = new TField("i16Val", TType.I16, (short)-3);
  private static final TField I32_VAL_FIELD_DESC = new TField("i32Val", TType.I32, (short)-4);
  private static final TField I64_VAL_FIELD_DESC = new TField("i64Val", TType.I64, (short)-5);
  private static final TField FLOAT_VAL_FIELD_DESC = new TField("floatVal", TType.FLOAT, (short)-6);
  private static final TField DOUBLE_VAL_FIELD_DESC = new TField("doubleVal", TType.DOUBLE, (short)-7);
  private static final TField STRING_VAL_FIELD_DESC = new TField("stringVal", TType.STRING, (short)-8);
  private static final TField BINARY_VAL_FIELD_DESC = new TField("binaryVal", TType.STRING, (short)-9);
  private static final TField ENUM_VAL_FIELD_DESC = new TField("enumVal", TType.I32, (short)-10);
  private static final TField STRUCT_VAL_FIELD_DESC = new TField("structVal", TType.STRUCT, (short)-11);
  private static final TField UNION_VAL_FIELD_DESC = new TField("unionVal", TType.STRUCT, (short)-12);
  private static final TField LATE_STRUCT_VAL_FIELD_DESC = new TField("lateStructVal", TType.STRUCT, (short)-13);
  private static final TField OPT_BOOL_VAL_FIELD_DESC = new TField("optBoolVal", TType.BOOL, (short)-14);
  private static final TField OPT_BYTE_VAL_FIELD_DESC = new TField("optByteVal", TType.BYTE, (short)-15);
  private static final TField OPT_I16_VAL_FIELD_DESC = new TField("optI16Val", TType.I16, (short)-16);
  private static final TField OPT_I32_VAL_FIELD_DESC = new TField("optI32Val", TType.I32, (short)-17);
  private static final TField OPT_I64_VAL_FIELD_DESC = new TField("optI64Val", TType.I64, (short)-18);
  private static final TField OPT_FLOAT_VAL_FIELD_DESC = new TField("optFloatVal", TType.FLOAT, (short)-19);
  private static final TField OPT_DOUBLE_VAL_FIELD_DESC = new TField("optDoubleVal", TType.DOUBLE, (short)-20);
  private static final TField OPT_STRING_VAL_FIELD_DESC = new TField("optStringVal", TType.STRING, (short)-21);
  private static final TField OPT_BINARY_VAL_FIELD_DESC = new TField("optBinaryVal", TType.STRING, (short)-22);
  private static final TField OPT_ENUM_VAL_FIELD_DESC = new TField("optEnumVal", TType.I32, (short)-23);
  private static final TField OPT_STRUCT_VAL_FIELD_DESC = new TField("optStructVal", TType.STRUCT, (short)-24);
  private static final TField OPT_LATE_STRUCT_VAL_FIELD_DESC = new TField("optLateStructVal", TType.STRUCT, (short)-25);
  private static final TField OPT_LIST_VAL_FIELD_DESC = new TField("optListVal", TType.LIST, (short)-26);
  private static final TField OPT_SET_VAL_FIELD_DESC = new TField("optSetVal", TType.SET, (short)-27);
  private static final TField OPT_MAP_VAL_FIELD_DESC = new TField("optMapVal", TType.MAP, (short)-28);
  private static final TField LIST_MAP_FIELD_DESC = new TField("listMap", TType.LIST, (short)-29);
  private static final TField MAP_MAP_FIELD_DESC = new TField("mapMap", TType.MAP, (short)-30);
  private static final TField I32_WITH_CUSTOM_DEFAULT_FIELD_DESC = new TField("i32WithCustomDefault", TType.I32, (short)-31);
  private static final TField STRUCT_WITH_CUSTOM_DEFAULT_FIELD_DESC = new TField("structWithCustomDefault", TType.STRUCT, (short)-32);
  private static final TField STRUCT_WITH_FIELD_CUSTOM_DEFAULT_FIELD_DESC = new TField("structWithFieldCustomDefault", TType.STRUCT, (short)1);

  public boolean boolVal;
  public byte byteVal;
  public short i16Val;
  public int i32Val;
  public long i64Val;
  public float floatVal;
  public double doubleVal;
  public String stringVal;
  public byte[] binaryVal;
  /**
   * 
   * @see MyEnum
   */
  public MyEnum enumVal;
  public MyData structVal;
  public MyUnion unionVal;
  public LateDefStruct lateStructVal;
  public boolean optBoolVal;
  public byte optByteVal;
  public short optI16Val;
  public int optI32Val;
  public long optI64Val;
  public float optFloatVal;
  public double optDoubleVal;
  public String optStringVal;
  public byte[] optBinaryVal;
  /**
   * 
   * @see MyEnum
   */
  public MyEnum optEnumVal;
  public MyData optStructVal;
  public LateDefStruct optLateStructVal;
  public List<Short> optListVal;
  public Set<String> optSetVal;
  public Map<String,String> optMapVal;
  public List<Map<String,Integer>> listMap;
  public Map<String,Map<String,Integer>> mapMap;
  public int i32WithCustomDefault;
  public MyDataWithCustomDefault structWithCustomDefault;
  public MyData structWithFieldCustomDefault;
  public static final int BOOLVAL = -1;
  public static final int BYTEVAL = -2;
  public static final int I16VAL = -3;
  public static final int I32VAL = -4;
  public static final int I64VAL = -5;
  public static final int FLOATVAL = -6;
  public static final int DOUBLEVAL = -7;
  public static final int STRINGVAL = -8;
  public static final int BINARYVAL = -9;
  public static final int ENUMVAL = -10;
  public static final int STRUCTVAL = -11;
  public static final int UNIONVAL = -12;
  public static final int LATESTRUCTVAL = -13;
  public static final int OPTBOOLVAL = -14;
  public static final int OPTBYTEVAL = -15;
  public static final int OPTI16VAL = -16;
  public static final int OPTI32VAL = -17;
  public static final int OPTI64VAL = -18;
  public static final int OPTFLOATVAL = -19;
  public static final int OPTDOUBLEVAL = -20;
  public static final int OPTSTRINGVAL = -21;
  public static final int OPTBINARYVAL = -22;
  public static final int OPTENUMVAL = -23;
  public static final int OPTSTRUCTVAL = -24;
  public static final int OPTLATESTRUCTVAL = -25;
  public static final int OPTLISTVAL = -26;
  public static final int OPTSETVAL = -27;
  public static final int OPTMAPVAL = -28;
  public static final int LISTMAP = -29;
  public static final int MAPMAP = -30;
  public static final int I32WITHCUSTOMDEFAULT = -31;
  public static final int STRUCTWITHCUSTOMDEFAULT = -32;
  public static final int STRUCTWITHFIELDCUSTOMDEFAULT = 1;

  // isset id assignments
  private static final int __BOOLVAL_ISSET_ID = 0;
  private static final int __BYTEVAL_ISSET_ID = 1;
  private static final int __I16VAL_ISSET_ID = 2;
  private static final int __I32VAL_ISSET_ID = 3;
  private static final int __I64VAL_ISSET_ID = 4;
  private static final int __FLOATVAL_ISSET_ID = 5;
  private static final int __DOUBLEVAL_ISSET_ID = 6;
  private static final int __OPTBOOLVAL_ISSET_ID = 7;
  private static final int __OPTBYTEVAL_ISSET_ID = 8;
  private static final int __OPTI16VAL_ISSET_ID = 9;
  private static final int __OPTI32VAL_ISSET_ID = 10;
  private static final int __OPTI64VAL_ISSET_ID = 11;
  private static final int __OPTFLOATVAL_ISSET_ID = 12;
  private static final int __OPTDOUBLEVAL_ISSET_ID = 13;
  private static final int __I32WITHCUSTOMDEFAULT_ISSET_ID = 14;
  private BitSet __isset_bit_vector = new BitSet(15);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(BOOLVAL, new FieldMetaData("boolVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(BYTEVAL, new FieldMetaData("byteVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BYTE)));
    tmpMetaDataMap.put(I16VAL, new FieldMetaData("i16Val", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I16)));
    tmpMetaDataMap.put(I32VAL, new FieldMetaData("i32Val", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(I64VAL, new FieldMetaData("i64Val", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(FLOATVAL, new FieldMetaData("floatVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.FLOAT)));
    tmpMetaDataMap.put(DOUBLEVAL, new FieldMetaData("doubleVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    tmpMetaDataMap.put(STRINGVAL, new FieldMetaData("stringVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(BINARYVAL, new FieldMetaData("binaryVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(ENUMVAL, new FieldMetaData("enumVal", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(STRUCTVAL, new FieldMetaData("structVal", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyData.class)));
    tmpMetaDataMap.put(UNIONVAL, new FieldMetaData("unionVal", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyUnion.class)));
    tmpMetaDataMap.put(LATESTRUCTVAL, new FieldMetaData("lateStructVal", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, LateDefStruct.class)));
    tmpMetaDataMap.put(OPTBOOLVAL, new FieldMetaData("optBoolVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(OPTBYTEVAL, new FieldMetaData("optByteVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.BYTE)));
    tmpMetaDataMap.put(OPTI16VAL, new FieldMetaData("optI16Val", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I16)));
    tmpMetaDataMap.put(OPTI32VAL, new FieldMetaData("optI32Val", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(OPTI64VAL, new FieldMetaData("optI64Val", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(OPTFLOATVAL, new FieldMetaData("optFloatVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.FLOAT)));
    tmpMetaDataMap.put(OPTDOUBLEVAL, new FieldMetaData("optDoubleVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.DOUBLE)));
    tmpMetaDataMap.put(OPTSTRINGVAL, new FieldMetaData("optStringVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(OPTBINARYVAL, new FieldMetaData("optBinaryVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(OPTENUMVAL, new FieldMetaData("optEnumVal", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(OPTSTRUCTVAL, new FieldMetaData("optStructVal", TFieldRequirementType.OPTIONAL, 
        new StructMetaData(TType.STRUCT, MyData.class)));
    tmpMetaDataMap.put(OPTLATESTRUCTVAL, new FieldMetaData("optLateStructVal", TFieldRequirementType.OPTIONAL, 
        new StructMetaData(TType.STRUCT, LateDefStruct.class)));
    tmpMetaDataMap.put(OPTLISTVAL, new FieldMetaData("optListVal", TFieldRequirementType.OPTIONAL, 
        new ListMetaData(TType.LIST, 
            new FieldValueMetaData(TType.I16))));
    tmpMetaDataMap.put(OPTSETVAL, new FieldMetaData("optSetVal", TFieldRequirementType.OPTIONAL, 
        new SetMetaData(TType.SET, 
            new FieldValueMetaData(TType.STRING))));
    tmpMetaDataMap.put(OPTMAPVAL, new FieldMetaData("optMapVal", TFieldRequirementType.OPTIONAL, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.STRING), 
            new FieldValueMetaData(TType.STRING))));
    tmpMetaDataMap.put(LISTMAP, new FieldMetaData("listMap", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new MapMetaData(TType.MAP, 
                new FieldValueMetaData(TType.STRING), 
                new FieldValueMetaData(TType.I32)))));
    tmpMetaDataMap.put(MAPMAP, new FieldMetaData("mapMap", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.STRING), 
            new MapMetaData(TType.MAP, 
                new FieldValueMetaData(TType.STRING), 
                new FieldValueMetaData(TType.I32)))));
    tmpMetaDataMap.put(I32WITHCUSTOMDEFAULT, new FieldMetaData("i32WithCustomDefault", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(STRUCTWITHCUSTOMDEFAULT, new FieldMetaData("structWithCustomDefault", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyDataWithCustomDefault.class)));
    tmpMetaDataMap.put(STRUCTWITHFIELDCUSTOMDEFAULT, new FieldMetaData("structWithFieldCustomDefault", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyData.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  static {
    FieldMetaData.addStructMetaDataMap(MyStruct.class, metaDataMap);
  }

  public MyStruct() {
    this.i32WithCustomDefault = 1;

    this.structWithFieldCustomDefault = new MyData();
    this.structWithFieldCustomDefault.setData1("1");
    this.structWithFieldCustomDefault.setData2(2);

  }

  public MyStruct(
      boolean boolVal,
      byte byteVal,
      short i16Val,
      int i32Val,
      long i64Val,
      float floatVal,
      double doubleVal,
      String stringVal,
      byte[] binaryVal,
      MyEnum enumVal,
      MyData structVal,
      MyUnion unionVal,
      LateDefStruct lateStructVal,
      List<Map<String,Integer>> listMap,
      Map<String,Map<String,Integer>> mapMap,
      int i32WithCustomDefault,
      MyDataWithCustomDefault structWithCustomDefault,
      MyData structWithFieldCustomDefault) {
    this();
    this.boolVal = boolVal;
    setBoolValIsSet(true);
    this.byteVal = byteVal;
    setByteValIsSet(true);
    this.i16Val = i16Val;
    setI16ValIsSet(true);
    this.i32Val = i32Val;
    setI32ValIsSet(true);
    this.i64Val = i64Val;
    setI64ValIsSet(true);
    this.floatVal = floatVal;
    setFloatValIsSet(true);
    this.doubleVal = doubleVal;
    setDoubleValIsSet(true);
    this.stringVal = stringVal;
    this.binaryVal = binaryVal;
    this.enumVal = enumVal;
    this.structVal = structVal;
    this.unionVal = unionVal;
    this.lateStructVal = lateStructVal;
    this.listMap = listMap;
    this.mapMap = mapMap;
    this.i32WithCustomDefault = i32WithCustomDefault;
    setI32WithCustomDefaultIsSet(true);
    this.structWithCustomDefault = structWithCustomDefault;
    this.structWithFieldCustomDefault = structWithFieldCustomDefault;
  }

  public MyStruct(
      boolean boolVal,
      byte byteVal,
      short i16Val,
      int i32Val,
      long i64Val,
      float floatVal,
      double doubleVal,
      String stringVal,
      byte[] binaryVal,
      MyEnum enumVal,
      MyData structVal,
      MyUnion unionVal,
      LateDefStruct lateStructVal,
      boolean optBoolVal,
      byte optByteVal,
      short optI16Val,
      int optI32Val,
      long optI64Val,
      float optFloatVal,
      double optDoubleVal,
      String optStringVal,
      byte[] optBinaryVal,
      MyEnum optEnumVal,
      MyData optStructVal,
      LateDefStruct optLateStructVal,
      List<Short> optListVal,
      Set<String> optSetVal,
      Map<String,String> optMapVal,
      List<Map<String,Integer>> listMap,
      Map<String,Map<String,Integer>> mapMap,
      int i32WithCustomDefault,
      MyDataWithCustomDefault structWithCustomDefault,
      MyData structWithFieldCustomDefault) {
    this();
    this.boolVal = boolVal;
    setBoolValIsSet(true);
    this.byteVal = byteVal;
    setByteValIsSet(true);
    this.i16Val = i16Val;
    setI16ValIsSet(true);
    this.i32Val = i32Val;
    setI32ValIsSet(true);
    this.i64Val = i64Val;
    setI64ValIsSet(true);
    this.floatVal = floatVal;
    setFloatValIsSet(true);
    this.doubleVal = doubleVal;
    setDoubleValIsSet(true);
    this.stringVal = stringVal;
    this.binaryVal = binaryVal;
    this.enumVal = enumVal;
    this.structVal = structVal;
    this.unionVal = unionVal;
    this.lateStructVal = lateStructVal;
    this.optBoolVal = optBoolVal;
    setOptBoolValIsSet(true);
    this.optByteVal = optByteVal;
    setOptByteValIsSet(true);
    this.optI16Val = optI16Val;
    setOptI16ValIsSet(true);
    this.optI32Val = optI32Val;
    setOptI32ValIsSet(true);
    this.optI64Val = optI64Val;
    setOptI64ValIsSet(true);
    this.optFloatVal = optFloatVal;
    setOptFloatValIsSet(true);
    this.optDoubleVal = optDoubleVal;
    setOptDoubleValIsSet(true);
    this.optStringVal = optStringVal;
    this.optBinaryVal = optBinaryVal;
    this.optEnumVal = optEnumVal;
    this.optStructVal = optStructVal;
    this.optLateStructVal = optLateStructVal;
    this.optListVal = optListVal;
    this.optSetVal = optSetVal;
    this.optMapVal = optMapVal;
    this.listMap = listMap;
    this.mapMap = mapMap;
    this.i32WithCustomDefault = i32WithCustomDefault;
    setI32WithCustomDefaultIsSet(true);
    this.structWithCustomDefault = structWithCustomDefault;
    this.structWithFieldCustomDefault = structWithFieldCustomDefault;
  }

  public static class Builder {
    private boolean boolVal;
    private byte byteVal;
    private short i16Val;
    private int i32Val;
    private long i64Val;
    private float floatVal;
    private double doubleVal;
    private String stringVal;
    private byte[] binaryVal;
    private MyEnum enumVal;
    private MyData structVal;
    private MyUnion unionVal;
    private LateDefStruct lateStructVal;
    private boolean optBoolVal;
    private byte optByteVal;
    private short optI16Val;
    private int optI32Val;
    private long optI64Val;
    private float optFloatVal;
    private double optDoubleVal;
    private String optStringVal;
    private byte[] optBinaryVal;
    private MyEnum optEnumVal;
    private MyData optStructVal;
    private LateDefStruct optLateStructVal;
    private List<Short> optListVal;
    private Set<String> optSetVal;
    private Map<String,String> optMapVal;
    private List<Map<String,Integer>> listMap;
    private Map<String,Map<String,Integer>> mapMap;
    private int i32WithCustomDefault;
    private MyDataWithCustomDefault structWithCustomDefault;
    private MyData structWithFieldCustomDefault;

    BitSet __optional_isset = new BitSet(15);

    public Builder() {
    }

    public Builder setBoolVal(final boolean boolVal) {
      this.boolVal = boolVal;
      __optional_isset.set(__BOOLVAL_ISSET_ID, true);
      return this;
    }

    public Builder setByteVal(final byte byteVal) {
      this.byteVal = byteVal;
      __optional_isset.set(__BYTEVAL_ISSET_ID, true);
      return this;
    }

    public Builder setI16Val(final short i16Val) {
      this.i16Val = i16Val;
      __optional_isset.set(__I16VAL_ISSET_ID, true);
      return this;
    }

    public Builder setI32Val(final int i32Val) {
      this.i32Val = i32Val;
      __optional_isset.set(__I32VAL_ISSET_ID, true);
      return this;
    }

    public Builder setI64Val(final long i64Val) {
      this.i64Val = i64Val;
      __optional_isset.set(__I64VAL_ISSET_ID, true);
      return this;
    }

    public Builder setFloatVal(final float floatVal) {
      this.floatVal = floatVal;
      __optional_isset.set(__FLOATVAL_ISSET_ID, true);
      return this;
    }

    public Builder setDoubleVal(final double doubleVal) {
      this.doubleVal = doubleVal;
      __optional_isset.set(__DOUBLEVAL_ISSET_ID, true);
      return this;
    }

    public Builder setStringVal(final String stringVal) {
      this.stringVal = stringVal;
      return this;
    }

    public Builder setBinaryVal(final byte[] binaryVal) {
      this.binaryVal = binaryVal;
      return this;
    }

    public Builder setEnumVal(final MyEnum enumVal) {
      this.enumVal = enumVal;
      return this;
    }

    public Builder setStructVal(final MyData structVal) {
      this.structVal = structVal;
      return this;
    }

    public Builder setUnionVal(final MyUnion unionVal) {
      this.unionVal = unionVal;
      return this;
    }

    public Builder setLateStructVal(final LateDefStruct lateStructVal) {
      this.lateStructVal = lateStructVal;
      return this;
    }

    public Builder setOptBoolVal(final boolean optBoolVal) {
      this.optBoolVal = optBoolVal;
      __optional_isset.set(__OPTBOOLVAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptByteVal(final byte optByteVal) {
      this.optByteVal = optByteVal;
      __optional_isset.set(__OPTBYTEVAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptI16Val(final short optI16Val) {
      this.optI16Val = optI16Val;
      __optional_isset.set(__OPTI16VAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptI32Val(final int optI32Val) {
      this.optI32Val = optI32Val;
      __optional_isset.set(__OPTI32VAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptI64Val(final long optI64Val) {
      this.optI64Val = optI64Val;
      __optional_isset.set(__OPTI64VAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptFloatVal(final float optFloatVal) {
      this.optFloatVal = optFloatVal;
      __optional_isset.set(__OPTFLOATVAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptDoubleVal(final double optDoubleVal) {
      this.optDoubleVal = optDoubleVal;
      __optional_isset.set(__OPTDOUBLEVAL_ISSET_ID, true);
      return this;
    }

    public Builder setOptStringVal(final String optStringVal) {
      this.optStringVal = optStringVal;
      return this;
    }

    public Builder setOptBinaryVal(final byte[] optBinaryVal) {
      this.optBinaryVal = optBinaryVal;
      return this;
    }

    public Builder setOptEnumVal(final MyEnum optEnumVal) {
      this.optEnumVal = optEnumVal;
      return this;
    }

    public Builder setOptStructVal(final MyData optStructVal) {
      this.optStructVal = optStructVal;
      return this;
    }

    public Builder setOptLateStructVal(final LateDefStruct optLateStructVal) {
      this.optLateStructVal = optLateStructVal;
      return this;
    }

    public Builder setOptListVal(final List<Short> optListVal) {
      this.optListVal = optListVal;
      return this;
    }

    public Builder setOptSetVal(final Set<String> optSetVal) {
      this.optSetVal = optSetVal;
      return this;
    }

    public Builder setOptMapVal(final Map<String,String> optMapVal) {
      this.optMapVal = optMapVal;
      return this;
    }

    public Builder setListMap(final List<Map<String,Integer>> listMap) {
      this.listMap = listMap;
      return this;
    }

    public Builder setMapMap(final Map<String,Map<String,Integer>> mapMap) {
      this.mapMap = mapMap;
      return this;
    }

    public Builder setI32WithCustomDefault(final int i32WithCustomDefault) {
      this.i32WithCustomDefault = i32WithCustomDefault;
      __optional_isset.set(__I32WITHCUSTOMDEFAULT_ISSET_ID, true);
      return this;
    }

    public Builder setStructWithCustomDefault(final MyDataWithCustomDefault structWithCustomDefault) {
      this.structWithCustomDefault = structWithCustomDefault;
      return this;
    }

    public Builder setStructWithFieldCustomDefault(final MyData structWithFieldCustomDefault) {
      this.structWithFieldCustomDefault = structWithFieldCustomDefault;
      return this;
    }

    public MyStruct build() {
      MyStruct result = new MyStruct();
      if (__optional_isset.get(__BOOLVAL_ISSET_ID)) {
        result.setBoolVal(this.boolVal);
      }
      if (__optional_isset.get(__BYTEVAL_ISSET_ID)) {
        result.setByteVal(this.byteVal);
      }
      if (__optional_isset.get(__I16VAL_ISSET_ID)) {
        result.setI16Val(this.i16Val);
      }
      if (__optional_isset.get(__I32VAL_ISSET_ID)) {
        result.setI32Val(this.i32Val);
      }
      if (__optional_isset.get(__I64VAL_ISSET_ID)) {
        result.setI64Val(this.i64Val);
      }
      if (__optional_isset.get(__FLOATVAL_ISSET_ID)) {
        result.setFloatVal(this.floatVal);
      }
      if (__optional_isset.get(__DOUBLEVAL_ISSET_ID)) {
        result.setDoubleVal(this.doubleVal);
      }
      result.setStringVal(this.stringVal);
      result.setBinaryVal(this.binaryVal);
      result.setEnumVal(this.enumVal);
      result.setStructVal(this.structVal);
      result.setUnionVal(this.unionVal);
      result.setLateStructVal(this.lateStructVal);
      if (__optional_isset.get(__OPTBOOLVAL_ISSET_ID)) {
        result.setOptBoolVal(this.optBoolVal);
      }
      if (__optional_isset.get(__OPTBYTEVAL_ISSET_ID)) {
        result.setOptByteVal(this.optByteVal);
      }
      if (__optional_isset.get(__OPTI16VAL_ISSET_ID)) {
        result.setOptI16Val(this.optI16Val);
      }
      if (__optional_isset.get(__OPTI32VAL_ISSET_ID)) {
        result.setOptI32Val(this.optI32Val);
      }
      if (__optional_isset.get(__OPTI64VAL_ISSET_ID)) {
        result.setOptI64Val(this.optI64Val);
      }
      if (__optional_isset.get(__OPTFLOATVAL_ISSET_ID)) {
        result.setOptFloatVal(this.optFloatVal);
      }
      if (__optional_isset.get(__OPTDOUBLEVAL_ISSET_ID)) {
        result.setOptDoubleVal(this.optDoubleVal);
      }
      result.setOptStringVal(this.optStringVal);
      result.setOptBinaryVal(this.optBinaryVal);
      result.setOptEnumVal(this.optEnumVal);
      result.setOptStructVal(this.optStructVal);
      result.setOptLateStructVal(this.optLateStructVal);
      result.setOptListVal(this.optListVal);
      result.setOptSetVal(this.optSetVal);
      result.setOptMapVal(this.optMapVal);
      result.setListMap(this.listMap);
      result.setMapMap(this.mapMap);
      if (__optional_isset.get(__I32WITHCUSTOMDEFAULT_ISSET_ID)) {
        result.setI32WithCustomDefault(this.i32WithCustomDefault);
      }
      result.setStructWithCustomDefault(this.structWithCustomDefault);
      result.setStructWithFieldCustomDefault(this.structWithFieldCustomDefault);
      return result;
    }
  }

  public static Builder builder() {
    return new Builder();
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public MyStruct(MyStruct other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.boolVal = TBaseHelper.deepCopy(other.boolVal);
    this.byteVal = TBaseHelper.deepCopy(other.byteVal);
    this.i16Val = TBaseHelper.deepCopy(other.i16Val);
    this.i32Val = TBaseHelper.deepCopy(other.i32Val);
    this.i64Val = TBaseHelper.deepCopy(other.i64Val);
    this.floatVal = TBaseHelper.deepCopy(other.floatVal);
    this.doubleVal = TBaseHelper.deepCopy(other.doubleVal);
    if (other.isSetStringVal()) {
      this.stringVal = TBaseHelper.deepCopy(other.stringVal);
    }
    if (other.isSetBinaryVal()) {
      this.binaryVal = TBaseHelper.deepCopy(other.binaryVal);
    }
    if (other.isSetEnumVal()) {
      this.enumVal = TBaseHelper.deepCopy(other.enumVal);
    }
    if (other.isSetStructVal()) {
      this.structVal = TBaseHelper.deepCopy(other.structVal);
    }
    if (other.isSetUnionVal()) {
      this.unionVal = TBaseHelper.deepCopy(other.unionVal);
    }
    if (other.isSetLateStructVal()) {
      this.lateStructVal = TBaseHelper.deepCopy(other.lateStructVal);
    }
    this.optBoolVal = TBaseHelper.deepCopy(other.optBoolVal);
    this.optByteVal = TBaseHelper.deepCopy(other.optByteVal);
    this.optI16Val = TBaseHelper.deepCopy(other.optI16Val);
    this.optI32Val = TBaseHelper.deepCopy(other.optI32Val);
    this.optI64Val = TBaseHelper.deepCopy(other.optI64Val);
    this.optFloatVal = TBaseHelper.deepCopy(other.optFloatVal);
    this.optDoubleVal = TBaseHelper.deepCopy(other.optDoubleVal);
    if (other.isSetOptStringVal()) {
      this.optStringVal = TBaseHelper.deepCopy(other.optStringVal);
    }
    if (other.isSetOptBinaryVal()) {
      this.optBinaryVal = TBaseHelper.deepCopy(other.optBinaryVal);
    }
    if (other.isSetOptEnumVal()) {
      this.optEnumVal = TBaseHelper.deepCopy(other.optEnumVal);
    }
    if (other.isSetOptStructVal()) {
      this.optStructVal = TBaseHelper.deepCopy(other.optStructVal);
    }
    if (other.isSetOptLateStructVal()) {
      this.optLateStructVal = TBaseHelper.deepCopy(other.optLateStructVal);
    }
    if (other.isSetOptListVal()) {
      this.optListVal = TBaseHelper.deepCopy(other.optListVal);
    }
    if (other.isSetOptSetVal()) {
      this.optSetVal = TBaseHelper.deepCopy(other.optSetVal);
    }
    if (other.isSetOptMapVal()) {
      this.optMapVal = TBaseHelper.deepCopy(other.optMapVal);
    }
    if (other.isSetListMap()) {
      this.listMap = TBaseHelper.deepCopy(other.listMap);
    }
    if (other.isSetMapMap()) {
      this.mapMap = TBaseHelper.deepCopy(other.mapMap);
    }
    this.i32WithCustomDefault = TBaseHelper.deepCopy(other.i32WithCustomDefault);
    if (other.isSetStructWithCustomDefault()) {
      this.structWithCustomDefault = TBaseHelper.deepCopy(other.structWithCustomDefault);
    }
    if (other.isSetStructWithFieldCustomDefault()) {
      this.structWithFieldCustomDefault = TBaseHelper.deepCopy(other.structWithFieldCustomDefault);
    }
  }

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

  public boolean isBoolVal() {
    return this.boolVal;
  }

  public MyStruct setBoolVal(boolean boolVal) {
    this.boolVal = boolVal;
    setBoolValIsSet(true);
    return this;
  }

  public void unsetBoolVal() {
    __isset_bit_vector.clear(__BOOLVAL_ISSET_ID);
  }

  // Returns true if field boolVal is set (has been assigned a value) and false otherwise
  public boolean isSetBoolVal() {
    return __isset_bit_vector.get(__BOOLVAL_ISSET_ID);
  }

  public void setBoolValIsSet(boolean __value) {
    __isset_bit_vector.set(__BOOLVAL_ISSET_ID, __value);
  }

  public byte getByteVal() {
    return this.byteVal;
  }

  public MyStruct setByteVal(byte byteVal) {
    this.byteVal = byteVal;
    setByteValIsSet(true);
    return this;
  }

  public void unsetByteVal() {
    __isset_bit_vector.clear(__BYTEVAL_ISSET_ID);
  }

  // Returns true if field byteVal is set (has been assigned a value) and false otherwise
  public boolean isSetByteVal() {
    return __isset_bit_vector.get(__BYTEVAL_ISSET_ID);
  }

  public void setByteValIsSet(boolean __value) {
    __isset_bit_vector.set(__BYTEVAL_ISSET_ID, __value);
  }

  public short getI16Val() {
    return this.i16Val;
  }

  public MyStruct setI16Val(short i16Val) {
    this.i16Val = i16Val;
    setI16ValIsSet(true);
    return this;
  }

  public void unsetI16Val() {
    __isset_bit_vector.clear(__I16VAL_ISSET_ID);
  }

  // Returns true if field i16Val is set (has been assigned a value) and false otherwise
  public boolean isSetI16Val() {
    return __isset_bit_vector.get(__I16VAL_ISSET_ID);
  }

  public void setI16ValIsSet(boolean __value) {
    __isset_bit_vector.set(__I16VAL_ISSET_ID, __value);
  }

  public int getI32Val() {
    return this.i32Val;
  }

  public MyStruct setI32Val(int i32Val) {
    this.i32Val = i32Val;
    setI32ValIsSet(true);
    return this;
  }

  public void unsetI32Val() {
    __isset_bit_vector.clear(__I32VAL_ISSET_ID);
  }

  // Returns true if field i32Val is set (has been assigned a value) and false otherwise
  public boolean isSetI32Val() {
    return __isset_bit_vector.get(__I32VAL_ISSET_ID);
  }

  public void setI32ValIsSet(boolean __value) {
    __isset_bit_vector.set(__I32VAL_ISSET_ID, __value);
  }

  public long getI64Val() {
    return this.i64Val;
  }

  public MyStruct setI64Val(long i64Val) {
    this.i64Val = i64Val;
    setI64ValIsSet(true);
    return this;
  }

  public void unsetI64Val() {
    __isset_bit_vector.clear(__I64VAL_ISSET_ID);
  }

  // Returns true if field i64Val is set (has been assigned a value) and false otherwise
  public boolean isSetI64Val() {
    return __isset_bit_vector.get(__I64VAL_ISSET_ID);
  }

  public void setI64ValIsSet(boolean __value) {
    __isset_bit_vector.set(__I64VAL_ISSET_ID, __value);
  }

  public float getFloatVal() {
    return this.floatVal;
  }

  public MyStruct setFloatVal(float floatVal) {
    this.floatVal = floatVal;
    setFloatValIsSet(true);
    return this;
  }

  public void unsetFloatVal() {
    __isset_bit_vector.clear(__FLOATVAL_ISSET_ID);
  }

  // Returns true if field floatVal is set (has been assigned a value) and false otherwise
  public boolean isSetFloatVal() {
    return __isset_bit_vector.get(__FLOATVAL_ISSET_ID);
  }

  public void setFloatValIsSet(boolean __value) {
    __isset_bit_vector.set(__FLOATVAL_ISSET_ID, __value);
  }

  public double getDoubleVal() {
    return this.doubleVal;
  }

  public MyStruct setDoubleVal(double doubleVal) {
    this.doubleVal = doubleVal;
    setDoubleValIsSet(true);
    return this;
  }

  public void unsetDoubleVal() {
    __isset_bit_vector.clear(__DOUBLEVAL_ISSET_ID);
  }

  // Returns true if field doubleVal is set (has been assigned a value) and false otherwise
  public boolean isSetDoubleVal() {
    return __isset_bit_vector.get(__DOUBLEVAL_ISSET_ID);
  }

  public void setDoubleValIsSet(boolean __value) {
    __isset_bit_vector.set(__DOUBLEVAL_ISSET_ID, __value);
  }

  public String getStringVal() {
    return this.stringVal;
  }

  public MyStruct setStringVal(String stringVal) {
    this.stringVal = stringVal;
    return this;
  }

  public void unsetStringVal() {
    this.stringVal = null;
  }

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

  public void setStringValIsSet(boolean __value) {
    if (!__value) {
      this.stringVal = null;
    }
  }

  public byte[] getBinaryVal() {
    return this.binaryVal;
  }

  public MyStruct setBinaryVal(byte[] binaryVal) {
    this.binaryVal = binaryVal;
    return this;
  }

  public void unsetBinaryVal() {
    this.binaryVal = null;
  }

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

  public void setBinaryValIsSet(boolean __value) {
    if (!__value) {
      this.binaryVal = null;
    }
  }

  /**
   * 
   * @see MyEnum
   */
  public MyEnum getEnumVal() {
    return this.enumVal;
  }

  /**
   * 
   * @see MyEnum
   */
  public MyStruct setEnumVal(MyEnum enumVal) {
    this.enumVal = enumVal;
    return this;
  }

  public void unsetEnumVal() {
    this.enumVal = null;
  }

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

  public void setEnumValIsSet(boolean __value) {
    if (!__value) {
      this.enumVal = null;
    }
  }

  public MyData getStructVal() {
    return this.structVal;
  }

  public MyStruct setStructVal(MyData structVal) {
    this.structVal = structVal;
    return this;
  }

  public void unsetStructVal() {
    this.structVal = null;
  }

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

  public void setStructValIsSet(boolean __value) {
    if (!__value) {
      this.structVal = null;
    }
  }

  public MyUnion getUnionVal() {
    return this.unionVal;
  }

  public MyStruct setUnionVal(MyUnion unionVal) {
    this.unionVal = unionVal;
    return this;
  }

  public void unsetUnionVal() {
    this.unionVal = null;
  }

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

  public void setUnionValIsSet(boolean __value) {
    if (!__value) {
      this.unionVal = null;
    }
  }

  public LateDefStruct getLateStructVal() {
    return this.lateStructVal;
  }

  public MyStruct setLateStructVal(LateDefStruct lateStructVal) {
    this.lateStructVal = lateStructVal;
    return this;
  }

  public void unsetLateStructVal() {
    this.lateStructVal = null;
  }

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

  public void setLateStructValIsSet(boolean __value) {
    if (!__value) {
      this.lateStructVal = null;
    }
  }

  public boolean isOptBoolVal() {
    return this.optBoolVal;
  }

  public MyStruct setOptBoolVal(boolean optBoolVal) {
    this.optBoolVal = optBoolVal;
    setOptBoolValIsSet(true);
    return this;
  }

  public void unsetOptBoolVal() {
    __isset_bit_vector.clear(__OPTBOOLVAL_ISSET_ID);
  }

  // Returns true if field optBoolVal is set (has been assigned a value) and false otherwise
  public boolean isSetOptBoolVal() {
    return __isset_bit_vector.get(__OPTBOOLVAL_ISSET_ID);
  }

  public void setOptBoolValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTBOOLVAL_ISSET_ID, __value);
  }

  public byte getOptByteVal() {
    return this.optByteVal;
  }

  public MyStruct setOptByteVal(byte optByteVal) {
    this.optByteVal = optByteVal;
    setOptByteValIsSet(true);
    return this;
  }

  public void unsetOptByteVal() {
    __isset_bit_vector.clear(__OPTBYTEVAL_ISSET_ID);
  }

  // Returns true if field optByteVal is set (has been assigned a value) and false otherwise
  public boolean isSetOptByteVal() {
    return __isset_bit_vector.get(__OPTBYTEVAL_ISSET_ID);
  }

  public void setOptByteValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTBYTEVAL_ISSET_ID, __value);
  }

  public short getOptI16Val() {
    return this.optI16Val;
  }

  public MyStruct setOptI16Val(short optI16Val) {
    this.optI16Val = optI16Val;
    setOptI16ValIsSet(true);
    return this;
  }

  public void unsetOptI16Val() {
    __isset_bit_vector.clear(__OPTI16VAL_ISSET_ID);
  }

  // Returns true if field optI16Val is set (has been assigned a value) and false otherwise
  public boolean isSetOptI16Val() {
    return __isset_bit_vector.get(__OPTI16VAL_ISSET_ID);
  }

  public void setOptI16ValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTI16VAL_ISSET_ID, __value);
  }

  public int getOptI32Val() {
    return this.optI32Val;
  }

  public MyStruct setOptI32Val(int optI32Val) {
    this.optI32Val = optI32Val;
    setOptI32ValIsSet(true);
    return this;
  }

  public void unsetOptI32Val() {
    __isset_bit_vector.clear(__OPTI32VAL_ISSET_ID);
  }

  // Returns true if field optI32Val is set (has been assigned a value) and false otherwise
  public boolean isSetOptI32Val() {
    return __isset_bit_vector.get(__OPTI32VAL_ISSET_ID);
  }

  public void setOptI32ValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTI32VAL_ISSET_ID, __value);
  }

  public long getOptI64Val() {
    return this.optI64Val;
  }

  public MyStruct setOptI64Val(long optI64Val) {
    this.optI64Val = optI64Val;
    setOptI64ValIsSet(true);
    return this;
  }

  public void unsetOptI64Val() {
    __isset_bit_vector.clear(__OPTI64VAL_ISSET_ID);
  }

  // Returns true if field optI64Val is set (has been assigned a value) and false otherwise
  public boolean isSetOptI64Val() {
    return __isset_bit_vector.get(__OPTI64VAL_ISSET_ID);
  }

  public void setOptI64ValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTI64VAL_ISSET_ID, __value);
  }

  public float getOptFloatVal() {
    return this.optFloatVal;
  }

  public MyStruct setOptFloatVal(float optFloatVal) {
    this.optFloatVal = optFloatVal;
    setOptFloatValIsSet(true);
    return this;
  }

  public void unsetOptFloatVal() {
    __isset_bit_vector.clear(__OPTFLOATVAL_ISSET_ID);
  }

  // Returns true if field optFloatVal is set (has been assigned a value) and false otherwise
  public boolean isSetOptFloatVal() {
    return __isset_bit_vector.get(__OPTFLOATVAL_ISSET_ID);
  }

  public void setOptFloatValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTFLOATVAL_ISSET_ID, __value);
  }

  public double getOptDoubleVal() {
    return this.optDoubleVal;
  }

  public MyStruct setOptDoubleVal(double optDoubleVal) {
    this.optDoubleVal = optDoubleVal;
    setOptDoubleValIsSet(true);
    return this;
  }

  public void unsetOptDoubleVal() {
    __isset_bit_vector.clear(__OPTDOUBLEVAL_ISSET_ID);
  }

  // Returns true if field optDoubleVal is set (has been assigned a value) and false otherwise
  public boolean isSetOptDoubleVal() {
    return __isset_bit_vector.get(__OPTDOUBLEVAL_ISSET_ID);
  }

  public void setOptDoubleValIsSet(boolean __value) {
    __isset_bit_vector.set(__OPTDOUBLEVAL_ISSET_ID, __value);
  }

  public String getOptStringVal() {
    return this.optStringVal;
  }

  public MyStruct setOptStringVal(String optStringVal) {
    this.optStringVal = optStringVal;
    return this;
  }

  public void unsetOptStringVal() {
    this.optStringVal = null;
  }

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

  public void setOptStringValIsSet(boolean __value) {
    if (!__value) {
      this.optStringVal = null;
    }
  }

  public byte[] getOptBinaryVal() {
    return this.optBinaryVal;
  }

  public MyStruct setOptBinaryVal(byte[] optBinaryVal) {
    this.optBinaryVal = optBinaryVal;
    return this;
  }

  public void unsetOptBinaryVal() {
    this.optBinaryVal = null;
  }

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

  public void setOptBinaryValIsSet(boolean __value) {
    if (!__value) {
      this.optBinaryVal = null;
    }
  }

  /**
   * 
   * @see MyEnum
   */
  public MyEnum getOptEnumVal() {
    return this.optEnumVal;
  }

  /**
   * 
   * @see MyEnum
   */
  public MyStruct setOptEnumVal(MyEnum optEnumVal) {
    this.optEnumVal = optEnumVal;
    return this;
  }

  public void unsetOptEnumVal() {
    this.optEnumVal = null;
  }

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

  public void setOptEnumValIsSet(boolean __value) {
    if (!__value) {
      this.optEnumVal = null;
    }
  }

  public MyData getOptStructVal() {
    return this.optStructVal;
  }

  public MyStruct setOptStructVal(MyData optStructVal) {
    this.optStructVal = optStructVal;
    return this;
  }

  public void unsetOptStructVal() {
    this.optStructVal = null;
  }

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

  public void setOptStructValIsSet(boolean __value) {
    if (!__value) {
      this.optStructVal = null;
    }
  }

  public LateDefStruct getOptLateStructVal() {
    return this.optLateStructVal;
  }

  public MyStruct setOptLateStructVal(LateDefStruct optLateStructVal) {
    this.optLateStructVal = optLateStructVal;
    return this;
  }

  public void unsetOptLateStructVal() {
    this.optLateStructVal = null;
  }

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

  public void setOptLateStructValIsSet(boolean __value) {
    if (!__value) {
      this.optLateStructVal = null;
    }
  }

  public List<Short> getOptListVal() {
    return this.optListVal;
  }

  public MyStruct setOptListVal(List<Short> optListVal) {
    this.optListVal = optListVal;
    return this;
  }

  public void unsetOptListVal() {
    this.optListVal = null;
  }

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

  public void setOptListValIsSet(boolean __value) {
    if (!__value) {
      this.optListVal = null;
    }
  }

  public Set<String> getOptSetVal() {
    return this.optSetVal;
  }

  public MyStruct setOptSetVal(Set<String> optSetVal) {
    this.optSetVal = optSetVal;
    return this;
  }

  public void unsetOptSetVal() {
    this.optSetVal = null;
  }

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

  public void setOptSetValIsSet(boolean __value) {
    if (!__value) {
      this.optSetVal = null;
    }
  }

  public Map<String,String> getOptMapVal() {
    return this.optMapVal;
  }

  public MyStruct setOptMapVal(Map<String,String> optMapVal) {
    this.optMapVal = optMapVal;
    return this;
  }

  public void unsetOptMapVal() {
    this.optMapVal = null;
  }

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

  public void setOptMapValIsSet(boolean __value) {
    if (!__value) {
      this.optMapVal = null;
    }
  }

  public List<Map<String,Integer>> getListMap() {
    return this.listMap;
  }

  public MyStruct setListMap(List<Map<String,Integer>> listMap) {
    this.listMap = listMap;
    return this;
  }

  public void unsetListMap() {
    this.listMap = null;
  }

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

  public void setListMapIsSet(boolean __value) {
    if (!__value) {
      this.listMap = null;
    }
  }

  public Map<String,Map<String,Integer>> getMapMap() {
    return this.mapMap;
  }

  public MyStruct setMapMap(Map<String,Map<String,Integer>> mapMap) {
    this.mapMap = mapMap;
    return this;
  }

  public void unsetMapMap() {
    this.mapMap = null;
  }

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

  public void setMapMapIsSet(boolean __value) {
    if (!__value) {
      this.mapMap = null;
    }
  }

  public int getI32WithCustomDefault() {
    return this.i32WithCustomDefault;
  }

  public MyStruct setI32WithCustomDefault(int i32WithCustomDefault) {
    this.i32WithCustomDefault = i32WithCustomDefault;
    setI32WithCustomDefaultIsSet(true);
    return this;
  }

  public void unsetI32WithCustomDefault() {
    __isset_bit_vector.clear(__I32WITHCUSTOMDEFAULT_ISSET_ID);
  }

  // Returns true if field i32WithCustomDefault is set (has been assigned a value) and false otherwise
  public boolean isSetI32WithCustomDefault() {
    return __isset_bit_vector.get(__I32WITHCUSTOMDEFAULT_ISSET_ID);
  }

  public void setI32WithCustomDefaultIsSet(boolean __value) {
    __isset_bit_vector.set(__I32WITHCUSTOMDEFAULT_ISSET_ID, __value);
  }

  public MyDataWithCustomDefault getStructWithCustomDefault() {
    return this.structWithCustomDefault;
  }

  public MyStruct setStructWithCustomDefault(MyDataWithCustomDefault structWithCustomDefault) {
    this.structWithCustomDefault = structWithCustomDefault;
    return this;
  }

  public void unsetStructWithCustomDefault() {
    this.structWithCustomDefault = null;
  }

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

  public void setStructWithCustomDefaultIsSet(boolean __value) {
    if (!__value) {
      this.structWithCustomDefault = null;
    }
  }

  public MyData getStructWithFieldCustomDefault() {
    return this.structWithFieldCustomDefault;
  }

  public MyStruct setStructWithFieldCustomDefault(MyData structWithFieldCustomDefault) {
    this.structWithFieldCustomDefault = structWithFieldCustomDefault;
    return this;
  }

  public void unsetStructWithFieldCustomDefault() {
    this.structWithFieldCustomDefault = null;
  }

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

  public void setStructWithFieldCustomDefaultIsSet(boolean __value) {
    if (!__value) {
      this.structWithFieldCustomDefault = null;
    }
  }

  @SuppressWarnings("unchecked")
  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case BOOLVAL:
      if (__value == null) {
        unsetBoolVal();
      } else {
        setBoolVal((Boolean)__value);
      }
      break;

    case BYTEVAL:
      if (__value == null) {
        unsetByteVal();
      } else {
        setByteVal((Byte)__value);
      }
      break;

    case I16VAL:
      if (__value == null) {
        unsetI16Val();
      } else {
        setI16Val((Short)__value);
      }
      break;

    case I32VAL:
      if (__value == null) {
        unsetI32Val();
      } else {
        setI32Val((Integer)__value);
      }
      break;

    case I64VAL:
      if (__value == null) {
        unsetI64Val();
      } else {
        setI64Val((Long)__value);
      }
      break;

    case FLOATVAL:
      if (__value == null) {
        unsetFloatVal();
      } else {
        setFloatVal((Float)__value);
      }
      break;

    case DOUBLEVAL:
      if (__value == null) {
        unsetDoubleVal();
      } else {
        setDoubleVal((Double)__value);
      }
      break;

    case STRINGVAL:
      if (__value == null) {
        unsetStringVal();
      } else {
        setStringVal((String)__value);
      }
      break;

    case BINARYVAL:
      if (__value == null) {
        unsetBinaryVal();
      } else {
        setBinaryVal((byte[])__value);
      }
      break;

    case ENUMVAL:
      if (__value == null) {
        unsetEnumVal();
      } else {
        setEnumVal((MyEnum)__value);
      }
      break;

    case STRUCTVAL:
      if (__value == null) {
        unsetStructVal();
      } else {
        setStructVal((MyData)__value);
      }
      break;

    case UNIONVAL:
      if (__value == null) {
        unsetUnionVal();
      } else {
        setUnionVal((MyUnion)__value);
      }
      break;

    case LATESTRUCTVAL:
      if (__value == null) {
        unsetLateStructVal();
      } else {
        setLateStructVal((LateDefStruct)__value);
      }
      break;

    case OPTBOOLVAL:
      if (__value == null) {
        unsetOptBoolVal();
      } else {
        setOptBoolVal((Boolean)__value);
      }
      break;

    case OPTBYTEVAL:
      if (__value == null) {
        unsetOptByteVal();
      } else {
        setOptByteVal((Byte)__value);
      }
      break;

    case OPTI16VAL:
      if (__value == null) {
        unsetOptI16Val();
      } else {
        setOptI16Val((Short)__value);
      }
      break;

    case OPTI32VAL:
      if (__value == null) {
        unsetOptI32Val();
      } else {
        setOptI32Val((Integer)__value);
      }
      break;

    case OPTI64VAL:
      if (__value == null) {
        unsetOptI64Val();
      } else {
        setOptI64Val((Long)__value);
      }
      break;

    case OPTFLOATVAL:
      if (__value == null) {
        unsetOptFloatVal();
      } else {
        setOptFloatVal((Float)__value);
      }
      break;

    case OPTDOUBLEVAL:
      if (__value == null) {
        unsetOptDoubleVal();
      } else {
        setOptDoubleVal((Double)__value);
      }
      break;

    case OPTSTRINGVAL:
      if (__value == null) {
        unsetOptStringVal();
      } else {
        setOptStringVal((String)__value);
      }
      break;

    case OPTBINARYVAL:
      if (__value == null) {
        unsetOptBinaryVal();
      } else {
        setOptBinaryVal((byte[])__value);
      }
      break;

    case OPTENUMVAL:
      if (__value == null) {
        unsetOptEnumVal();
      } else {
        setOptEnumVal((MyEnum)__value);
      }
      break;

    case OPTSTRUCTVAL:
      if (__value == null) {
        unsetOptStructVal();
      } else {
        setOptStructVal((MyData)__value);
      }
      break;

    case OPTLATESTRUCTVAL:
      if (__value == null) {
        unsetOptLateStructVal();
      } else {
        setOptLateStructVal((LateDefStruct)__value);
      }
      break;

    case OPTLISTVAL:
      if (__value == null) {
        unsetOptListVal();
      } else {
        setOptListVal((List<Short>)__value);
      }
      break;

    case OPTSETVAL:
      if (__value == null) {
        unsetOptSetVal();
      } else {
        setOptSetVal((Set<String>)__value);
      }
      break;

    case OPTMAPVAL:
      if (__value == null) {
        unsetOptMapVal();
      } else {
        setOptMapVal((Map<String,String>)__value);
      }
      break;

    case LISTMAP:
      if (__value == null) {
        unsetListMap();
      } else {
        setListMap((List<Map<String,Integer>>)__value);
      }
      break;

    case MAPMAP:
      if (__value == null) {
        unsetMapMap();
      } else {
        setMapMap((Map<String,Map<String,Integer>>)__value);
      }
      break;

    case I32WITHCUSTOMDEFAULT:
      if (__value == null) {
        unsetI32WithCustomDefault();
      } else {
        setI32WithCustomDefault((Integer)__value);
      }
      break;

    case STRUCTWITHCUSTOMDEFAULT:
      if (__value == null) {
        unsetStructWithCustomDefault();
      } else {
        setStructWithCustomDefault((MyDataWithCustomDefault)__value);
      }
      break;

    case STRUCTWITHFIELDCUSTOMDEFAULT:
      if (__value == null) {
        unsetStructWithFieldCustomDefault();
      } else {
        setStructWithFieldCustomDefault((MyData)__value);
      }
      break;

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case BOOLVAL:
      return new Boolean(isBoolVal());

    case BYTEVAL:
      return new Byte(getByteVal());

    case I16VAL:
      return new Short(getI16Val());

    case I32VAL:
      return new Integer(getI32Val());

    case I64VAL:
      return new Long(getI64Val());

    case FLOATVAL:
      return new Float(getFloatVal());

    case DOUBLEVAL:
      return new Double(getDoubleVal());

    case STRINGVAL:
      return getStringVal();

    case BINARYVAL:
      return getBinaryVal();

    case ENUMVAL:
      return getEnumVal();

    case STRUCTVAL:
      return getStructVal();

    case UNIONVAL:
      return getUnionVal();

    case LATESTRUCTVAL:
      return getLateStructVal();

    case OPTBOOLVAL:
      return new Boolean(isOptBoolVal());

    case OPTBYTEVAL:
      return new Byte(getOptByteVal());

    case OPTI16VAL:
      return new Short(getOptI16Val());

    case OPTI32VAL:
      return new Integer(getOptI32Val());

    case OPTI64VAL:
      return new Long(getOptI64Val());

    case OPTFLOATVAL:
      return new Float(getOptFloatVal());

    case OPTDOUBLEVAL:
      return new Double(getOptDoubleVal());

    case OPTSTRINGVAL:
      return getOptStringVal();

    case OPTBINARYVAL:
      return getOptBinaryVal();

    case OPTENUMVAL:
      return getOptEnumVal();

    case OPTSTRUCTVAL:
      return getOptStructVal();

    case OPTLATESTRUCTVAL:
      return getOptLateStructVal();

    case OPTLISTVAL:
      return getOptListVal();

    case OPTSETVAL:
      return getOptSetVal();

    case OPTMAPVAL:
      return getOptMapVal();

    case LISTMAP:
      return getListMap();

    case MAPMAP:
      return getMapMap();

    case I32WITHCUSTOMDEFAULT:
      return new Integer(getI32WithCustomDefault());

    case STRUCTWITHCUSTOMDEFAULT:
      return getStructWithCustomDefault();

    case STRUCTWITHFIELDCUSTOMDEFAULT:
      return getStructWithFieldCustomDefault();

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  @Override
  public boolean equals(Object _that) {
    if (_that == null)
      return false;
    if (this == _that)
      return true;
    if (!(_that instanceof MyStruct))
      return false;
    MyStruct that = (MyStruct)_that;

    if (!TBaseHelper.equalsNobinary(this.boolVal, that.boolVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.byteVal, that.byteVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.i16Val, that.i16Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.i32Val, that.i32Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.i64Val, that.i64Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.floatVal, that.floatVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.doubleVal, that.doubleVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetStringVal(), that.isSetStringVal(), this.stringVal, that.stringVal)) { return false; }

    if (!TBaseHelper.equalsSlow(this.isSetBinaryVal(), that.isSetBinaryVal(), this.binaryVal, that.binaryVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetEnumVal(), that.isSetEnumVal(), this.enumVal, that.enumVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetStructVal(), that.isSetStructVal(), this.structVal, that.structVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetUnionVal(), that.isSetUnionVal(), this.unionVal, that.unionVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetLateStructVal(), that.isSetLateStructVal(), this.lateStructVal, that.lateStructVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptBoolVal(), that.isSetOptBoolVal(), this.optBoolVal, that.optBoolVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptByteVal(), that.isSetOptByteVal(), this.optByteVal, that.optByteVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptI16Val(), that.isSetOptI16Val(), this.optI16Val, that.optI16Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptI32Val(), that.isSetOptI32Val(), this.optI32Val, that.optI32Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptI64Val(), that.isSetOptI64Val(), this.optI64Val, that.optI64Val)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptFloatVal(), that.isSetOptFloatVal(), this.optFloatVal, that.optFloatVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptDoubleVal(), that.isSetOptDoubleVal(), this.optDoubleVal, that.optDoubleVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptStringVal(), that.isSetOptStringVal(), this.optStringVal, that.optStringVal)) { return false; }

    if (!TBaseHelper.equalsSlow(this.isSetOptBinaryVal(), that.isSetOptBinaryVal(), this.optBinaryVal, that.optBinaryVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptEnumVal(), that.isSetOptEnumVal(), this.optEnumVal, that.optEnumVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptStructVal(), that.isSetOptStructVal(), this.optStructVal, that.optStructVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptLateStructVal(), that.isSetOptLateStructVal(), this.optLateStructVal, that.optLateStructVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptListVal(), that.isSetOptListVal(), this.optListVal, that.optListVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptSetVal(), that.isSetOptSetVal(), this.optSetVal, that.optSetVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetOptMapVal(), that.isSetOptMapVal(), this.optMapVal, that.optMapVal)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetListMap(), that.isSetListMap(), this.listMap, that.listMap)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetMapMap(), that.isSetMapMap(), this.mapMap, that.mapMap)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.i32WithCustomDefault, that.i32WithCustomDefault)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetStructWithCustomDefault(), that.isSetStructWithCustomDefault(), this.structWithCustomDefault, that.structWithCustomDefault)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetStructWithFieldCustomDefault(), that.isSetStructWithFieldCustomDefault(), this.structWithFieldCustomDefault, that.structWithFieldCustomDefault)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {boolVal, byteVal, i16Val, i32Val, i64Val, floatVal, doubleVal, stringVal, binaryVal, enumVal, structVal, unionVal, lateStructVal, optBoolVal, optByteVal, optI16Val, optI32Val, optI64Val, optFloatVal, optDoubleVal, optStringVal, optBinaryVal, optEnumVal, optStructVal, optLateStructVal, optListVal, optSetVal, optMapVal, listMap, mapMap, i32WithCustomDefault, structWithCustomDefault, structWithFieldCustomDefault});
  }

  @Override
  public int compareTo(MyStruct other) {
    if (other == null) {
      // See java.lang.Comparable docs
      throw new NullPointerException();
    }

    if (other == this) {
      return 0;
    }
    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetBoolVal()).compareTo(other.isSetBoolVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(boolVal, other.boolVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetByteVal()).compareTo(other.isSetByteVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(byteVal, other.byteVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetI16Val()).compareTo(other.isSetI16Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(i16Val, other.i16Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetI32Val()).compareTo(other.isSetI32Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(i32Val, other.i32Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetI64Val()).compareTo(other.isSetI64Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(i64Val, other.i64Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetFloatVal()).compareTo(other.isSetFloatVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(floatVal, other.floatVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDoubleVal()).compareTo(other.isSetDoubleVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(doubleVal, other.doubleVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStringVal()).compareTo(other.isSetStringVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(stringVal, other.stringVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetBinaryVal()).compareTo(other.isSetBinaryVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(binaryVal, other.binaryVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetEnumVal()).compareTo(other.isSetEnumVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(enumVal, other.enumVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStructVal()).compareTo(other.isSetStructVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(structVal, other.structVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUnionVal()).compareTo(other.isSetUnionVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(unionVal, other.unionVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetLateStructVal()).compareTo(other.isSetLateStructVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(lateStructVal, other.lateStructVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptBoolVal()).compareTo(other.isSetOptBoolVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optBoolVal, other.optBoolVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptByteVal()).compareTo(other.isSetOptByteVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optByteVal, other.optByteVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptI16Val()).compareTo(other.isSetOptI16Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optI16Val, other.optI16Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptI32Val()).compareTo(other.isSetOptI32Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optI32Val, other.optI32Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptI64Val()).compareTo(other.isSetOptI64Val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optI64Val, other.optI64Val);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptFloatVal()).compareTo(other.isSetOptFloatVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optFloatVal, other.optFloatVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptDoubleVal()).compareTo(other.isSetOptDoubleVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optDoubleVal, other.optDoubleVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptStringVal()).compareTo(other.isSetOptStringVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optStringVal, other.optStringVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptBinaryVal()).compareTo(other.isSetOptBinaryVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optBinaryVal, other.optBinaryVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptEnumVal()).compareTo(other.isSetOptEnumVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optEnumVal, other.optEnumVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptStructVal()).compareTo(other.isSetOptStructVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optStructVal, other.optStructVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptLateStructVal()).compareTo(other.isSetOptLateStructVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optLateStructVal, other.optLateStructVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptListVal()).compareTo(other.isSetOptListVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optListVal, other.optListVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptSetVal()).compareTo(other.isSetOptSetVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optSetVal, other.optSetVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOptMapVal()).compareTo(other.isSetOptMapVal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(optMapVal, other.optMapVal);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetListMap()).compareTo(other.isSetListMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(listMap, other.listMap);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMapMap()).compareTo(other.isSetMapMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(mapMap, other.mapMap);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetI32WithCustomDefault()).compareTo(other.isSetI32WithCustomDefault());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(i32WithCustomDefault, other.i32WithCustomDefault);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStructWithCustomDefault()).compareTo(other.isSetStructWithCustomDefault());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(structWithCustomDefault, other.structWithCustomDefault);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStructWithFieldCustomDefault()).compareTo(other.isSetStructWithFieldCustomDefault());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(structWithFieldCustomDefault, other.structWithFieldCustomDefault);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField __field;
    iprot.readStructBegin(metaDataMap);
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case BOOLVAL:
          if (__field.type == TType.BOOL) {
            this.boolVal = iprot.readBool();
            setBoolValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case BYTEVAL:
          if (__field.type == TType.BYTE) {
            this.byteVal = iprot.readByte();
            setByteValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case I16VAL:
          if (__field.type == TType.I16) {
            this.i16Val = iprot.readI16();
            setI16ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case I32VAL:
          if (__field.type == TType.I32) {
            this.i32Val = iprot.readI32();
            setI32ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case I64VAL:
          if (__field.type == TType.I64) {
            this.i64Val = iprot.readI64();
            setI64ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case FLOATVAL:
          if (__field.type == TType.FLOAT) {
            this.floatVal = iprot.readFloat();
            setFloatValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DOUBLEVAL:
          if (__field.type == TType.DOUBLE) {
            this.doubleVal = iprot.readDouble();
            setDoubleValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STRINGVAL:
          if (__field.type == TType.STRING) {
            this.stringVal = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case BINARYVAL:
          if (__field.type == TType.STRING) {
            this.binaryVal = iprot.readBinary();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case ENUMVAL:
          if (__field.type == TType.I32) {
            this.enumVal = MyEnum.findByValue(iprot.readI32());
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STRUCTVAL:
          if (__field.type == TType.STRUCT) {
            this.structVal = new MyData();
            this.structVal.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case UNIONVAL:
          if (__field.type == TType.STRUCT) {
            this.unionVal = new MyUnion();
            this.unionVal.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case LATESTRUCTVAL:
          if (__field.type == TType.STRUCT) {
            this.lateStructVal = new LateDefStruct();
            this.lateStructVal.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTBOOLVAL:
          if (__field.type == TType.BOOL) {
            this.optBoolVal = iprot.readBool();
            setOptBoolValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTBYTEVAL:
          if (__field.type == TType.BYTE) {
            this.optByteVal = iprot.readByte();
            setOptByteValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTI16VAL:
          if (__field.type == TType.I16) {
            this.optI16Val = iprot.readI16();
            setOptI16ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTI32VAL:
          if (__field.type == TType.I32) {
            this.optI32Val = iprot.readI32();
            setOptI32ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTI64VAL:
          if (__field.type == TType.I64) {
            this.optI64Val = iprot.readI64();
            setOptI64ValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTFLOATVAL:
          if (__field.type == TType.FLOAT) {
            this.optFloatVal = iprot.readFloat();
            setOptFloatValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTDOUBLEVAL:
          if (__field.type == TType.DOUBLE) {
            this.optDoubleVal = iprot.readDouble();
            setOptDoubleValIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTSTRINGVAL:
          if (__field.type == TType.STRING) {
            this.optStringVal = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTBINARYVAL:
          if (__field.type == TType.STRING) {
            this.optBinaryVal = iprot.readBinary();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTENUMVAL:
          if (__field.type == TType.I32) {
            this.optEnumVal = MyEnum.findByValue(iprot.readI32());
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTSTRUCTVAL:
          if (__field.type == TType.STRUCT) {
            this.optStructVal = new MyData();
            this.optStructVal.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTLATESTRUCTVAL:
          if (__field.type == TType.STRUCT) {
            this.optLateStructVal = new LateDefStruct();
            this.optLateStructVal.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTLISTVAL:
          if (__field.type == TType.LIST) {
            {
              TList _list0 = iprot.readListBegin();
              this.optListVal = new ArrayList<Short>(Math.max(0, _list0.size));
              for (int _i1 = 0; 
                   (_list0.size < 0) ? iprot.peekList() : (_i1 < _list0.size); 
                   ++_i1)
              {
                short _elem2;
                _elem2 = iprot.readI16();
                this.optListVal.add(_elem2);
              }
              iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTSETVAL:
          if (__field.type == TType.SET) {
            {
              TSet _set3 = iprot.readSetBegin();
              this.optSetVal = new HashSet<String>(Math.max(0, 2*_set3.size));
              for (int _i4 = 0; 
                   (_set3.size < 0) ? iprot.peekSet() : (_i4 < _set3.size); 
                   ++_i4)
              {
                String _elem5;
                _elem5 = iprot.readString();
                this.optSetVal.add(_elem5);
              }
              iprot.readSetEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case OPTMAPVAL:
          if (__field.type == TType.MAP) {
            {
              TMap _map6 = iprot.readMapBegin();
              this.optMapVal = new HashMap<String,String>(Math.max(0, 2*_map6.size));
              for (int _i7 = 0; 
                   (_map6.size < 0) ? iprot.peekMap() : (_i7 < _map6.size); 
                   ++_i7)
              {
                String _key8;
                String _val9;
                _key8 = iprot.readString();
                _val9 = iprot.readString();
                this.optMapVal.put(_key8, _val9);
              }
              iprot.readMapEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case LISTMAP:
          if (__field.type == TType.LIST) {
            {
              TList _list10 = iprot.readListBegin();
              this.listMap = new ArrayList<Map<String,Integer>>(Math.max(0, _list10.size));
              for (int _i11 = 0; 
                   (_list10.size < 0) ? iprot.peekList() : (_i11 < _list10.size); 
                   ++_i11)
              {
                Map<String,Integer> _elem12;
                {
                  TMap _map13 = iprot.readMapBegin();
                  _elem12 = new HashMap<String,Integer>(Math.max(0, 2*_map13.size));
                  for (int _i14 = 0; 
                       (_map13.size < 0) ? iprot.peekMap() : (_i14 < _map13.size); 
                       ++_i14)
                  {
                    String _key15;
                    int _val16;
                    _key15 = iprot.readString();
                    _val16 = iprot.readI32();
                    _elem12.put(_key15, _val16);
                  }
                  iprot.readMapEnd();
                }
                this.listMap.add(_elem12);
              }
              iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case MAPMAP:
          if (__field.type == TType.MAP) {
            {
              TMap _map17 = iprot.readMapBegin();
              this.mapMap = new HashMap<String,Map<String,Integer>>(Math.max(0, 2*_map17.size));
              for (int _i18 = 0; 
                   (_map17.size < 0) ? iprot.peekMap() : (_i18 < _map17.size); 
                   ++_i18)
              {
                String _key19;
                Map<String,Integer> _val20;
                _key19 = iprot.readString();
                {
                  TMap _map21 = iprot.readMapBegin();
                  _val20 = new HashMap<String,Integer>(Math.max(0, 2*_map21.size));
                  for (int _i22 = 0; 
                       (_map21.size < 0) ? iprot.peekMap() : (_i22 < _map21.size); 
                       ++_i22)
                  {
                    String _key23;
                    int _val24;
                    _key23 = iprot.readString();
                    _val24 = iprot.readI32();
                    _val20.put(_key23, _val24);
                  }
                  iprot.readMapEnd();
                }
                this.mapMap.put(_key19, _val20);
              }
              iprot.readMapEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case I32WITHCUSTOMDEFAULT:
          if (__field.type == TType.I32) {
            this.i32WithCustomDefault = iprot.readI32();
            setI32WithCustomDefaultIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STRUCTWITHCUSTOMDEFAULT:
          if (__field.type == TType.STRUCT) {
            this.structWithCustomDefault = new MyDataWithCustomDefault();
            this.structWithCustomDefault.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STRUCTWITHFIELDCUSTOMDEFAULT:
          if (__field.type == TType.STRUCT) {
            this.structWithFieldCustomDefault = new MyData();
            this.structWithFieldCustomDefault.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();


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

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.structWithCustomDefault != null) {
      oprot.writeFieldBegin(STRUCT_WITH_CUSTOM_DEFAULT_FIELD_DESC);
      this.structWithCustomDefault.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(I32_WITH_CUSTOM_DEFAULT_FIELD_DESC);
    oprot.writeI32(this.i32WithCustomDefault);
    oprot.writeFieldEnd();
    if (this.mapMap != null) {
      oprot.writeFieldBegin(MAP_MAP_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.MAP, this.mapMap.size()));
        for (Map.Entry<String, Map<String,Integer>> _iter25 : this.mapMap.entrySet())        {
          oprot.writeString(_iter25.getKey());
          {
            oprot.writeMapBegin(new TMap(TType.STRING, TType.I32, _iter25.getValue().size()));
            for (Map.Entry<String, Integer> _iter26 : _iter25.getValue().entrySet())            {
              oprot.writeString(_iter26.getKey());
              oprot.writeI32(_iter26.getValue());
            }
            oprot.writeMapEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.listMap != null) {
      oprot.writeFieldBegin(LIST_MAP_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.MAP, this.listMap.size()));
        for (Map<String,Integer> _iter27 : this.listMap)        {
          {
            oprot.writeMapBegin(new TMap(TType.STRING, TType.I32, _iter27.size()));
            for (Map.Entry<String, Integer> _iter28 : _iter27.entrySet())            {
              oprot.writeString(_iter28.getKey());
              oprot.writeI32(_iter28.getValue());
            }
            oprot.writeMapEnd();
          }
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.optMapVal != null) {
      if (isSetOptMapVal()) {
        oprot.writeFieldBegin(OPT_MAP_VAL_FIELD_DESC);
        {
          oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.optMapVal.size()));
          for (Map.Entry<String, String> _iter29 : this.optMapVal.entrySet())          {
            oprot.writeString(_iter29.getKey());
            oprot.writeString(_iter29.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (this.optSetVal != null) {
      if (isSetOptSetVal()) {
        oprot.writeFieldBegin(OPT_SET_VAL_FIELD_DESC);
        {
          oprot.writeSetBegin(new TSet(TType.STRING, this.optSetVal.size()));
          for (String _iter30 : this.optSetVal)          {
            oprot.writeString(_iter30);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (this.optListVal != null) {
      if (isSetOptListVal()) {
        oprot.writeFieldBegin(OPT_LIST_VAL_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.I16, this.optListVal.size()));
          for (short _iter31 : this.optListVal)          {
            oprot.writeI16(_iter31);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (this.optLateStructVal != null) {
      if (isSetOptLateStructVal()) {
        oprot.writeFieldBegin(OPT_LATE_STRUCT_VAL_FIELD_DESC);
        this.optLateStructVal.write(oprot);
        oprot.writeFieldEnd();
      }
    }
    if (this.optStructVal != null) {
      if (isSetOptStructVal()) {
        oprot.writeFieldBegin(OPT_STRUCT_VAL_FIELD_DESC);
        this.optStructVal.write(oprot);
        oprot.writeFieldEnd();
      }
    }
    if (this.optEnumVal != null) {
      if (isSetOptEnumVal()) {
        oprot.writeFieldBegin(OPT_ENUM_VAL_FIELD_DESC);
        oprot.writeI32(this.optEnumVal == null ? 0 : this.optEnumVal.getValue());
        oprot.writeFieldEnd();
      }
    }
    if (this.optBinaryVal != null) {
      if (isSetOptBinaryVal()) {
        oprot.writeFieldBegin(OPT_BINARY_VAL_FIELD_DESC);
        oprot.writeBinary(this.optBinaryVal);
        oprot.writeFieldEnd();
      }
    }
    if (this.optStringVal != null) {
      if (isSetOptStringVal()) {
        oprot.writeFieldBegin(OPT_STRING_VAL_FIELD_DESC);
        oprot.writeString(this.optStringVal);
        oprot.writeFieldEnd();
      }
    }
    if (isSetOptDoubleVal()) {
      oprot.writeFieldBegin(OPT_DOUBLE_VAL_FIELD_DESC);
      oprot.writeDouble(this.optDoubleVal);
      oprot.writeFieldEnd();
    }
    if (isSetOptFloatVal()) {
      oprot.writeFieldBegin(OPT_FLOAT_VAL_FIELD_DESC);
      oprot.writeFloat(this.optFloatVal);
      oprot.writeFieldEnd();
    }
    if (isSetOptI64Val()) {
      oprot.writeFieldBegin(OPT_I64_VAL_FIELD_DESC);
      oprot.writeI64(this.optI64Val);
      oprot.writeFieldEnd();
    }
    if (isSetOptI32Val()) {
      oprot.writeFieldBegin(OPT_I32_VAL_FIELD_DESC);
      oprot.writeI32(this.optI32Val);
      oprot.writeFieldEnd();
    }
    if (isSetOptI16Val()) {
      oprot.writeFieldBegin(OPT_I16_VAL_FIELD_DESC);
      oprot.writeI16(this.optI16Val);
      oprot.writeFieldEnd();
    }
    if (isSetOptByteVal()) {
      oprot.writeFieldBegin(OPT_BYTE_VAL_FIELD_DESC);
      oprot.writeByte(this.optByteVal);
      oprot.writeFieldEnd();
    }
    if (isSetOptBoolVal()) {
      oprot.writeFieldBegin(OPT_BOOL_VAL_FIELD_DESC);
      oprot.writeBool(this.optBoolVal);
      oprot.writeFieldEnd();
    }
    if (this.lateStructVal != null) {
      oprot.writeFieldBegin(LATE_STRUCT_VAL_FIELD_DESC);
      this.lateStructVal.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.unionVal != null) {
      oprot.writeFieldBegin(UNION_VAL_FIELD_DESC);
      this.unionVal.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.structVal != null) {
      oprot.writeFieldBegin(STRUCT_VAL_FIELD_DESC);
      this.structVal.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.enumVal != null) {
      oprot.writeFieldBegin(ENUM_VAL_FIELD_DESC);
      oprot.writeI32(this.enumVal == null ? 0 : this.enumVal.getValue());
      oprot.writeFieldEnd();
    }
    if (this.binaryVal != null) {
      oprot.writeFieldBegin(BINARY_VAL_FIELD_DESC);
      oprot.writeBinary(this.binaryVal);
      oprot.writeFieldEnd();
    }
    if (this.stringVal != null) {
      oprot.writeFieldBegin(STRING_VAL_FIELD_DESC);
      oprot.writeString(this.stringVal);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DOUBLE_VAL_FIELD_DESC);
    oprot.writeDouble(this.doubleVal);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(FLOAT_VAL_FIELD_DESC);
    oprot.writeFloat(this.floatVal);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(I64_VAL_FIELD_DESC);
    oprot.writeI64(this.i64Val);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(I32_VAL_FIELD_DESC);
    oprot.writeI32(this.i32Val);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(I16_VAL_FIELD_DESC);
    oprot.writeI16(this.i16Val);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(BYTE_VAL_FIELD_DESC);
    oprot.writeByte(this.byteVal);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(BOOL_VAL_FIELD_DESC);
    oprot.writeBool(this.boolVal);
    oprot.writeFieldEnd();
    if (this.structWithFieldCustomDefault != null) {
      oprot.writeFieldBegin(STRUCT_WITH_FIELD_CUSTOM_DEFAULT_FIELD_DESC);
      this.structWithFieldCustomDefault.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    return toString(1, true);
  }

  @Override
  public String toString(int indent, boolean prettyPrint) {
    String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
    String newLine = prettyPrint ? "\n" : "";
    String space = prettyPrint ? " " : "";
    StringBuilder sb = new StringBuilder("MyStruct");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("boolVal");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isBoolVal(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("byteVal");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getByteVal(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("i16Val");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getI16Val(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("i32Val");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getI32Val(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("i64Val");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getI64Val(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("floatVal");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getFloatVal(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("doubleVal");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getDoubleVal(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("stringVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getStringVal() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getStringVal(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("binaryVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getBinaryVal() == null) {
      sb.append("null");
    } else {
        int __binaryVal_size = Math.min(this.getBinaryVal().length, 128);
        for (int i = 0; i < __binaryVal_size; i++) {
          if (i != 0) sb.append(" ");
          sb.append(Integer.toHexString(this.getBinaryVal()[i]).length() > 1 ? Integer.toHexString(this.getBinaryVal()[i]).substring(Integer.toHexString(this.getBinaryVal()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getBinaryVal()[i]).toUpperCase());
        }
        if (this.getBinaryVal().length > 128) sb.append(" ...");
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("enumVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getEnumVal() == null) {
      sb.append("null");
    } else {
      String enumVal_name = this.getEnumVal() == null ? "null" : this.getEnumVal().name();
      if (enumVal_name != null) {
        sb.append(enumVal_name);
        sb.append(" (");
      }
      sb.append(this.getEnumVal());
      if (enumVal_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("structVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getStructVal() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getStructVal(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("unionVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getUnionVal() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getUnionVal(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("lateStructVal");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getLateStructVal() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getLateStructVal(), indent + 1, prettyPrint));
    }
    first = false;
    if (isSetOptBoolVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optBoolVal");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.isOptBoolVal(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptByteVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optByteVal");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptByteVal(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptI16Val())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optI16Val");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptI16Val(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptI32Val())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optI32Val");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptI32Val(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptI64Val())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optI64Val");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptI64Val(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptFloatVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optFloatVal");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptFloatVal(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptDoubleVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optDoubleVal");
      sb.append(space);
      sb.append(":").append(space);
      sb.append(TBaseHelper.toString(this.getOptDoubleVal(), indent + 1, prettyPrint));
      first = false;
    }
    if (isSetOptStringVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optStringVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptStringVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptStringVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (isSetOptBinaryVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optBinaryVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptBinaryVal() == null) {
        sb.append("null");
      } else {
          int __optBinaryVal_size = Math.min(this.getOptBinaryVal().length, 128);
          for (int i = 0; i < __optBinaryVal_size; i++) {
            if (i != 0) sb.append(" ");
            sb.append(Integer.toHexString(this.getOptBinaryVal()[i]).length() > 1 ? Integer.toHexString(this.getOptBinaryVal()[i]).substring(Integer.toHexString(this.getOptBinaryVal()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getOptBinaryVal()[i]).toUpperCase());
          }
          if (this.getOptBinaryVal().length > 128) sb.append(" ...");
      }
      first = false;
    }
    if (isSetOptEnumVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optEnumVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptEnumVal() == null) {
        sb.append("null");
      } else {
        String optEnumVal_name = this.getOptEnumVal() == null ? "null" : this.getOptEnumVal().name();
        if (optEnumVal_name != null) {
          sb.append(optEnumVal_name);
          sb.append(" (");
        }
        sb.append(this.getOptEnumVal());
        if (optEnumVal_name != null) {
          sb.append(")");
        }
      }
      first = false;
    }
    if (isSetOptStructVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optStructVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptStructVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptStructVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (isSetOptLateStructVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optLateStructVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptLateStructVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptLateStructVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (isSetOptListVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optListVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptListVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptListVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (isSetOptSetVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optSetVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptSetVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptSetVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (isSetOptMapVal())
    {
      if (!first) sb.append("," + newLine);
      sb.append(indentStr);
      sb.append("optMapVal");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getOptMapVal() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getOptMapVal(), indent + 1, prettyPrint));
      }
      first = false;
    }
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("listMap");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getListMap() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getListMap(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("mapMap");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMapMap() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getMapMap(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("i32WithCustomDefault");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getI32WithCustomDefault(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("structWithCustomDefault");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getStructWithCustomDefault() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getStructWithCustomDefault(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("structWithFieldCustomDefault");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getStructWithFieldCustomDefault() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getStructWithFieldCustomDefault(), indent + 1, prettyPrint));
    }
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}

