...

Text file src/github.com/google/flatbuffers/tests/union_vector/GadgetUnion.java

Documentation: github.com/google/flatbuffers/tests/union_vector

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3import com.google.flatbuffers.FlatBufferBuilder;
     4
     5public class GadgetUnion {
     6  private byte type;
     7  private Object value;
     8
     9  public byte getType() { return type; }
    10
    11  public void setType(byte type) { this.type = type; }
    12
    13  public Object getValue() { return value; }
    14
    15  public void setValue(Object value) { this.value = value; }
    16
    17  public GadgetUnion() {
    18    this.type = Gadget.NONE;
    19    this.value = null;
    20  }
    21
    22  public FallingTubT asFallingTub() { return (FallingTubT) value; }
    23  public HandFanT asHandFan() { return (HandFanT) value; }
    24
    25  public static int pack(FlatBufferBuilder builder, GadgetUnion _o) {
    26    switch (_o.type) {
    27      case Gadget.FallingTub: return FallingTub.pack(builder, _o.asFallingTub());
    28      case Gadget.HandFan: return HandFan.pack(builder, _o.asHandFan());
    29      default: return 0;
    30    }
    31  }
    32}
    33

View as plain text