/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
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", "unchecked" })
public class MyUnion extends TUnion<MyUnion> implements Comparable<MyUnion> {
  private static final TStruct STRUCT_DESC = new TStruct("MyUnion");
  private static final TField BOOL_FIELD_FIELD_DESC = new TField("bool_field", TType.BOOL, (short)1);
  private static final TField BYTE_FIELD_FIELD_DESC = new TField("byte_field", TType.BYTE, (short)2);
  private static final TField SHORT_FIELD_FIELD_DESC = new TField("short_field", TType.I16, (short)3);
  private static final TField INT_FIELD_FIELD_DESC = new TField("int_field", TType.I32, (short)4);
  private static final TField LONG_FIELD_FIELD_DESC = new TField("long_field", TType.I64, (short)5);
  private static final TField FLOAT_FIELD_FIELD_DESC = new TField("float_field", TType.FLOAT, (short)6);
  private static final TField DOUBLE_FIELD_FIELD_DESC = new TField("double_field", TType.DOUBLE, (short)7);
  private static final TField STRING_FIELD_FIELD_DESC = new TField("string_field", TType.STRING, (short)8);
  private static final TField BINARY_FIELD_FIELD_DESC = new TField("binary_field", TType.STRING, (short)9);
  private static final TField ENUM_FIELD_FIELD_DESC = new TField("enum_field", TType.I32, (short)10);
  private static final TField LIST_FIELD_FIELD_DESC = new TField("list_field", TType.LIST, (short)11);
  private static final TField SET_FIELD_FIELD_DESC = new TField("set_field", TType.SET, (short)12);
  private static final TField MAP_FIELD_FIELD_DESC = new TField("map_field", TType.MAP, (short)13);
  private static final TField STRUCT_FIELD_FIELD_DESC = new TField("struct_field", TType.STRUCT, (short)14);

  public static final int BOOL_FIELD = 1;
  public static final int BYTE_FIELD = 2;
  public static final int SHORT_FIELD = 3;
  public static final int INT_FIELD = 4;
  public static final int LONG_FIELD = 5;
  public static final int FLOAT_FIELD = 6;
  public static final int DOUBLE_FIELD = 7;
  public static final int STRING_FIELD = 8;
  public static final int BINARY_FIELD = 9;
  public static final int ENUM_FIELD = 10;
  public static final int LIST_FIELD = 11;
  public static final int SET_FIELD = 12;
  public static final int MAP_FIELD = 13;
  public static final int STRUCT_FIELD = 14;

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(BOOL_FIELD, new FieldMetaData("bool_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(BYTE_FIELD, new FieldMetaData("byte_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BYTE)));
    tmpMetaDataMap.put(SHORT_FIELD, new FieldMetaData("short_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I16)));
    tmpMetaDataMap.put(INT_FIELD, new FieldMetaData("int_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(LONG_FIELD, new FieldMetaData("long_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(FLOAT_FIELD, new FieldMetaData("float_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.FLOAT)));
    tmpMetaDataMap.put(DOUBLE_FIELD, new FieldMetaData("double_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    tmpMetaDataMap.put(STRING_FIELD, new FieldMetaData("string_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(BINARY_FIELD, new FieldMetaData("binary_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(ENUM_FIELD, new FieldMetaData("enum_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(LIST_FIELD, new FieldMetaData("list_field", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new FieldValueMetaData(TType.I16))));
    tmpMetaDataMap.put(SET_FIELD, new FieldMetaData("set_field", TFieldRequirementType.DEFAULT, 
        new SetMetaData(TType.SET, 
            new FieldValueMetaData(TType.I16))));
    tmpMetaDataMap.put(MAP_FIELD, new FieldMetaData("map_field", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.I16), 
            new FieldValueMetaData(TType.I16))));
    tmpMetaDataMap.put(STRUCT_FIELD, new FieldMetaData("struct_field", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyStruct.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  public MyUnion() {
    super();
  }

  public MyUnion(int setField, Object __value) {
    super(setField, __value);
  }

  public MyUnion(MyUnion other) {
    super(other);
  }

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

  public static MyUnion bool_field(boolean __value) {
    MyUnion x = new MyUnion();
    x.setBool_field(__value);
    return x;
  }

  public static MyUnion byte_field(byte __value) {
    MyUnion x = new MyUnion();
    x.setByte_field(__value);
    return x;
  }

  public static MyUnion short_field(short __value) {
    MyUnion x = new MyUnion();
    x.setShort_field(__value);
    return x;
  }

  public static MyUnion int_field(int __value) {
    MyUnion x = new MyUnion();
    x.setInt_field(__value);
    return x;
  }

  public static MyUnion long_field(long __value) {
    MyUnion x = new MyUnion();
    x.setLong_field(__value);
    return x;
  }

  public static MyUnion float_field(float __value) {
    MyUnion x = new MyUnion();
    x.setFloat_field(__value);
    return x;
  }

  public static MyUnion double_field(double __value) {
    MyUnion x = new MyUnion();
    x.setDouble_field(__value);
    return x;
  }

  public static MyUnion string_field(String __value) {
    MyUnion x = new MyUnion();
    x.setString_field(__value);
    return x;
  }

  public static MyUnion binary_field(byte[] __value) {
    MyUnion x = new MyUnion();
    x.setBinary_field(__value);
    return x;
  }

  public static MyUnion enum_field(MyEnum __value) {
    MyUnion x = new MyUnion();
    x.setEnum_field(__value);
    return x;
  }

  public static MyUnion list_field(List<Short> __value) {
    MyUnion x = new MyUnion();
    x.setList_field(__value);
    return x;
  }

  public static MyUnion set_field(Set<Short> __value) {
    MyUnion x = new MyUnion();
    x.setSet_field(__value);
    return x;
  }

  public static MyUnion map_field(Map<Short,Short> __value) {
    MyUnion x = new MyUnion();
    x.setMap_field(__value);
    return x;
  }

  public static MyUnion struct_field(MyStruct __value) {
    MyUnion x = new MyUnion();
    x.setStruct_field(__value);
    return x;
  }


  @Override
  protected void checkType(short setField, Object __value) throws ClassCastException {
    switch (setField) {
      case BOOL_FIELD:
        if (__value instanceof Boolean) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Boolean for field 'bool_field', but got " + __value.getClass().getSimpleName());
      case BYTE_FIELD:
        if (__value instanceof Byte) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Byte for field 'byte_field', but got " + __value.getClass().getSimpleName());
      case SHORT_FIELD:
        if (__value instanceof Short) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Short for field 'short_field', but got " + __value.getClass().getSimpleName());
      case INT_FIELD:
        if (__value instanceof Integer) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Integer for field 'int_field', but got " + __value.getClass().getSimpleName());
      case LONG_FIELD:
        if (__value instanceof Long) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Long for field 'long_field', but got " + __value.getClass().getSimpleName());
      case FLOAT_FIELD:
        if (__value instanceof Float) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Float for field 'float_field', but got " + __value.getClass().getSimpleName());
      case DOUBLE_FIELD:
        if (__value instanceof Double) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Double for field 'double_field', but got " + __value.getClass().getSimpleName());
      case STRING_FIELD:
        if (__value instanceof String) {
          break;
        }
        throw new ClassCastException("Was expecting value of type String for field 'string_field', but got " + __value.getClass().getSimpleName());
      case BINARY_FIELD:
        if (__value instanceof byte[]) {
          break;
        }
        throw new ClassCastException("Was expecting value of type byte[] for field 'binary_field', but got " + __value.getClass().getSimpleName());
      case ENUM_FIELD:
        if (__value instanceof MyEnum) {
          break;
        }
        throw new ClassCastException("Was expecting value of type MyEnum for field 'enum_field', but got " + __value.getClass().getSimpleName());
      case LIST_FIELD:
        if (__value instanceof List) {
          break;
        }
        throw new ClassCastException("Was expecting value of type List<Short> for field 'list_field', but got " + __value.getClass().getSimpleName());
      case SET_FIELD:
        if (__value instanceof Set) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Set<Short> for field 'set_field', but got " + __value.getClass().getSimpleName());
      case MAP_FIELD:
        if (__value instanceof Map) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Map<Short,Short> for field 'map_field', but got " + __value.getClass().getSimpleName());
      case STRUCT_FIELD:
        if (__value instanceof MyStruct) {
          break;
        }
        throw new ClassCastException("Was expecting value of type MyStruct for field 'struct_field', but got " + __value.getClass().getSimpleName());
      default:
        throw new IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  public void read(TProtocol iprot) throws TException {
    setField_ = 0;
    value_ = null;
    iprot.readStructBegin(metaDataMap);
    TField __field = iprot.readFieldBegin();
    if (__field.type != TType.STOP)
    {
      value_ = readValue(iprot, __field);
      if (value_ != null)
      {
        switch (__field.id) {
          case BOOL_FIELD:
            if (__field.type == BOOL_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case BYTE_FIELD:
            if (__field.type == BYTE_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case SHORT_FIELD:
            if (__field.type == SHORT_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case INT_FIELD:
            if (__field.type == INT_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case LONG_FIELD:
            if (__field.type == LONG_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case FLOAT_FIELD:
            if (__field.type == FLOAT_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case DOUBLE_FIELD:
            if (__field.type == DOUBLE_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case STRING_FIELD:
            if (__field.type == STRING_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case BINARY_FIELD:
            if (__field.type == BINARY_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case ENUM_FIELD:
            if (__field.type == ENUM_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case LIST_FIELD:
            if (__field.type == LIST_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case SET_FIELD:
            if (__field.type == SET_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case MAP_FIELD:
            if (__field.type == MAP_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
          case STRUCT_FIELD:
            if (__field.type == STRUCT_FIELD_FIELD_DESC.type) {
              setField_ = __field.id;
            }
            break;
        }
      }
      iprot.readFieldEnd();
      TField __stopField = iprot.readFieldBegin();
      if (__stopField.type != TType.STOP) {
        throw new TProtocolException(TProtocolException.INVALID_DATA, "Union 'MyUnion' is missing a STOP byte");
      }
    }
    iprot.readStructEnd();
  }

  @Override
  protected Object readValue(TProtocol iprot, TField __field) throws TException {
    switch (__field.id) {
      case BOOL_FIELD:
        if (__field.type == BOOL_FIELD_FIELD_DESC.type) {
          Boolean bool_field;
          bool_field = iprot.readBool();
          return bool_field;
        }
        break;
      case BYTE_FIELD:
        if (__field.type == BYTE_FIELD_FIELD_DESC.type) {
          Byte byte_field;
          byte_field = iprot.readByte();
          return byte_field;
        }
        break;
      case SHORT_FIELD:
        if (__field.type == SHORT_FIELD_FIELD_DESC.type) {
          Short short_field;
          short_field = iprot.readI16();
          return short_field;
        }
        break;
      case INT_FIELD:
        if (__field.type == INT_FIELD_FIELD_DESC.type) {
          Integer int_field;
          int_field = iprot.readI32();
          return int_field;
        }
        break;
      case LONG_FIELD:
        if (__field.type == LONG_FIELD_FIELD_DESC.type) {
          Long long_field;
          long_field = iprot.readI64();
          return long_field;
        }
        break;
      case FLOAT_FIELD:
        if (__field.type == FLOAT_FIELD_FIELD_DESC.type) {
          Float float_field;
          float_field = iprot.readFloat();
          return float_field;
        }
        break;
      case DOUBLE_FIELD:
        if (__field.type == DOUBLE_FIELD_FIELD_DESC.type) {
          Double double_field;
          double_field = iprot.readDouble();
          return double_field;
        }
        break;
      case STRING_FIELD:
        if (__field.type == STRING_FIELD_FIELD_DESC.type) {
          String string_field;
          string_field = iprot.readString();
          return string_field;
        }
        break;
      case BINARY_FIELD:
        if (__field.type == BINARY_FIELD_FIELD_DESC.type) {
          byte[] binary_field;
          binary_field = iprot.readBinary();
          return binary_field;
        }
        break;
      case ENUM_FIELD:
        if (__field.type == ENUM_FIELD_FIELD_DESC.type) {
          MyEnum enum_field;
          enum_field = MyEnum.findByValue(iprot.readI32());
          return enum_field;
        }
        break;
      case LIST_FIELD:
        if (__field.type == LIST_FIELD_FIELD_DESC.type) {
          List<Short> list_field;
          {
            TList _list0 = iprot.readListBegin();
            list_field = 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();
              list_field.add(_elem2);
            }
            iprot.readListEnd();
          }
          return list_field;
        }
        break;
      case SET_FIELD:
        if (__field.type == SET_FIELD_FIELD_DESC.type) {
          Set<Short> set_field;
          {
            TSet _set3 = iprot.readSetBegin();
            set_field = new HashSet<Short>(Math.max(0, 2*_set3.size));
            for (int _i4 = 0; 
                 (_set3.size < 0) ? iprot.peekSet() : (_i4 < _set3.size); 
                 ++_i4)
            {
              short _elem5;
              _elem5 = iprot.readI16();
              set_field.add(_elem5);
            }
            iprot.readSetEnd();
          }
          return set_field;
        }
        break;
      case MAP_FIELD:
        if (__field.type == MAP_FIELD_FIELD_DESC.type) {
          Map<Short,Short> map_field;
          {
            TMap _map6 = iprot.readMapBegin();
            map_field = new HashMap<Short,Short>(Math.max(0, 2*_map6.size));
            for (int _i7 = 0; 
                 (_map6.size < 0) ? iprot.peekMap() : (_i7 < _map6.size); 
                 ++_i7)
            {
              short _key8;
              short _val9;
              _key8 = iprot.readI16();
              _val9 = iprot.readI16();
              map_field.put(_key8, _val9);
            }
            iprot.readMapEnd();
          }
          return map_field;
        }
        break;
      case STRUCT_FIELD:
        if (__field.type == STRUCT_FIELD_FIELD_DESC.type) {
          MyStruct struct_field;
          struct_field = new MyStruct();
          struct_field.read(iprot);
          return struct_field;
        }
        break;
    }
    TProtocolUtil.skip(iprot, __field.type);
    return null;
  }

  @Override
  protected void writeValue(TProtocol oprot, short setField, Object __value) throws TException {
    switch (setField) {
      case BOOL_FIELD:
        Boolean bool_field = (Boolean)getFieldValue();
        oprot.writeBool(bool_field);
        return;
      case BYTE_FIELD:
        Byte byte_field = (Byte)getFieldValue();
        oprot.writeByte(byte_field);
        return;
      case SHORT_FIELD:
        Short short_field = (Short)getFieldValue();
        oprot.writeI16(short_field);
        return;
      case INT_FIELD:
        Integer int_field = (Integer)getFieldValue();
        oprot.writeI32(int_field);
        return;
      case LONG_FIELD:
        Long long_field = (Long)getFieldValue();
        oprot.writeI64(long_field);
        return;
      case FLOAT_FIELD:
        Float float_field = (Float)getFieldValue();
        oprot.writeFloat(float_field);
        return;
      case DOUBLE_FIELD:
        Double double_field = (Double)getFieldValue();
        oprot.writeDouble(double_field);
        return;
      case STRING_FIELD:
        String string_field = (String)getFieldValue();
        oprot.writeString(string_field);
        return;
      case BINARY_FIELD:
        byte[] binary_field = (byte[])getFieldValue();
        oprot.writeBinary(binary_field);
        return;
      case ENUM_FIELD:
        MyEnum enum_field = (MyEnum)getFieldValue();
        oprot.writeI32(enum_field == null ? 0 : enum_field.getValue());
        return;
      case LIST_FIELD:
        List<Short> list_field = (List<Short>)getFieldValue();
        {
          oprot.writeListBegin(new TList(TType.I16, list_field.size()));
          for (short _iter10 : list_field)          {
            oprot.writeI16(_iter10);
          }
          oprot.writeListEnd();
        }
        return;
      case SET_FIELD:
        Set<Short> set_field = (Set<Short>)getFieldValue();
        {
          oprot.writeSetBegin(new TSet(TType.I16, set_field.size()));
          for (short _iter11 : set_field)          {
            oprot.writeI16(_iter11);
          }
          oprot.writeSetEnd();
        }
        return;
      case MAP_FIELD:
        Map<Short,Short> map_field = (Map<Short,Short>)getFieldValue();
        {
          oprot.writeMapBegin(new TMap(TType.I16, TType.I16, map_field.size()));
          for (Map.Entry<Short, Short> _iter12 : map_field.entrySet())          {
            oprot.writeI16(_iter12.getKey());
            oprot.writeI16(_iter12.getValue());
          }
          oprot.writeMapEnd();
        }
        return;
      case STRUCT_FIELD:
        MyStruct struct_field = (MyStruct)getFieldValue();
        struct_field.write(oprot);
        return;
      default:
        throw new IllegalStateException("Cannot write union with unknown field " + setField);
    }
  }

  @Override
  protected TField getFieldDesc(int setField) {
    switch (setField) {
      case BOOL_FIELD:
        return BOOL_FIELD_FIELD_DESC;
      case BYTE_FIELD:
        return BYTE_FIELD_FIELD_DESC;
      case SHORT_FIELD:
        return SHORT_FIELD_FIELD_DESC;
      case INT_FIELD:
        return INT_FIELD_FIELD_DESC;
      case LONG_FIELD:
        return LONG_FIELD_FIELD_DESC;
      case FLOAT_FIELD:
        return FLOAT_FIELD_FIELD_DESC;
      case DOUBLE_FIELD:
        return DOUBLE_FIELD_FIELD_DESC;
      case STRING_FIELD:
        return STRING_FIELD_FIELD_DESC;
      case BINARY_FIELD:
        return BINARY_FIELD_FIELD_DESC;
      case ENUM_FIELD:
        return ENUM_FIELD_FIELD_DESC;
      case LIST_FIELD:
        return LIST_FIELD_FIELD_DESC;
      case SET_FIELD:
        return SET_FIELD_FIELD_DESC;
      case MAP_FIELD:
        return MAP_FIELD_FIELD_DESC;
      case STRUCT_FIELD:
        return STRUCT_FIELD_FIELD_DESC;
      default:
        throw new IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  protected TStruct getStructDesc() {
    return STRUCT_DESC;
  }

  @Override
  protected Map<Integer, FieldMetaData> getMetaDataMap() { return metaDataMap; }

  private Object __getValue(int expectedFieldId) {
    if (getSetField() == expectedFieldId) {
      return getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field '" + getFieldDesc(expectedFieldId).name + "' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  private void __setValue(int fieldId, Object __value) {
    if (__value == null) throw new NullPointerException();
    setField_ = fieldId;
    value_ = __value;
  }

  public boolean isBool_field() {
    return (Boolean) __getValue(BOOL_FIELD);
  }

  public void setBool_field(boolean __value) {
    setField_ = BOOL_FIELD;
    value_ = __value;
  }

  public byte getByte_field() {
    return (Byte) __getValue(BYTE_FIELD);
  }

  public void setByte_field(byte __value) {
    setField_ = BYTE_FIELD;
    value_ = __value;
  }

  public short getShort_field() {
    return (Short) __getValue(SHORT_FIELD);
  }

  public void setShort_field(short __value) {
    setField_ = SHORT_FIELD;
    value_ = __value;
  }

  public int getInt_field() {
    return (Integer) __getValue(INT_FIELD);
  }

  public void setInt_field(int __value) {
    setField_ = INT_FIELD;
    value_ = __value;
  }

  public long getLong_field() {
    return (Long) __getValue(LONG_FIELD);
  }

  public void setLong_field(long __value) {
    setField_ = LONG_FIELD;
    value_ = __value;
  }

  public float getFloat_field() {
    return (Float) __getValue(FLOAT_FIELD);
  }

  public void setFloat_field(float __value) {
    setField_ = FLOAT_FIELD;
    value_ = __value;
  }

  public double getDouble_field() {
    return (Double) __getValue(DOUBLE_FIELD);
  }

  public void setDouble_field(double __value) {
    setField_ = DOUBLE_FIELD;
    value_ = __value;
  }

  public String getString_field() {
    return (String) __getValue(STRING_FIELD);
  }

  public void setString_field(String __value) {
    __setValue(STRING_FIELD, __value);
  }

  public byte[] getBinary_field() {
    return (byte[]) __getValue(BINARY_FIELD);
  }

  public void setBinary_field(byte[] __value) {
    __setValue(BINARY_FIELD, __value);
  }

  /**
   * 
   * @see MyEnum
   */
  public MyEnum getEnum_field() {
    return (MyEnum) __getValue(ENUM_FIELD);
  }

  /**
   * 
   * @see MyEnum
   */
  public void setEnum_field(MyEnum __value) {
    __setValue(ENUM_FIELD, __value);
  }

  public List<Short> getList_field() {
    return (List<Short>) __getValue(LIST_FIELD);
  }

  public void setList_field(List<Short> __value) {
    __setValue(LIST_FIELD, __value);
  }

  public Set<Short> getSet_field() {
    return (Set<Short>) __getValue(SET_FIELD);
  }

  public void setSet_field(Set<Short> __value) {
    __setValue(SET_FIELD, __value);
  }

  public Map<Short,Short> getMap_field() {
    return (Map<Short,Short>) __getValue(MAP_FIELD);
  }

  public void setMap_field(Map<Short,Short> __value) {
    __setValue(MAP_FIELD, __value);
  }

  public MyStruct getStruct_field() {
    return (MyStruct) __getValue(STRUCT_FIELD);
  }

  public void setStruct_field(MyStruct __value) {
    __setValue(STRUCT_FIELD, __value);
  }

  public boolean equals(Object other) {
    if (other instanceof MyUnion) {
      return equals((MyUnion)other);
    } else {
      return false;
    }
  }

  public boolean equals(MyUnion other) {
    return equalsSlowImpl(other);
  }

  @Override
  public int compareTo(MyUnion other) {
    return compareToImpl(other);
  }


  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {getSetField(), getFieldValue()});
  }

}
