...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/AnyUnion.java

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3package MyGame.Example;
     4
     5import com.google.flatbuffers.FlatBufferBuilder;
     6
     7public class AnyUnion {
     8  private byte type;
     9  private Object value;
    10
    11  public byte getType() { return type; }
    12
    13  public void setType(byte type) { this.type = type; }
    14
    15  public Object getValue() { return value; }
    16
    17  public void setValue(Object value) { this.value = value; }
    18
    19  public AnyUnion() {
    20    this.type = Any.NONE;
    21    this.value = null;
    22  }
    23
    24  public MyGame.Example.MonsterT asMonster() { return (MyGame.Example.MonsterT) value; }
    25  MyGame.Example.TestSimpleTableWithEnumT asTestSimpleTableWithEnum() { return (MyGame.Example.TestSimpleTableWithEnumT) value; }
    26  public MyGame.Example2.MonsterT asMyGame_Example2_Monster() { return (MyGame.Example2.MonsterT) value; }
    27
    28  public static int pack(FlatBufferBuilder builder, AnyUnion _o) {
    29    switch (_o.type) {
    30      case Any.Monster: return MyGame.Example.Monster.pack(builder, _o.asMonster());
    31      case Any.TestSimpleTableWithEnum: return MyGame.Example.TestSimpleTableWithEnum.pack(builder, _o.asTestSimpleTableWithEnum());
    32      case Any.MyGame_Example2_Monster: return MyGame.Example2.Monster.pack(builder, _o.asMyGame_Example2_Monster());
    33      default: return 0;
    34    }
    35  }
    36}
    37

View as plain text