...

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

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

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3import com.google.flatbuffers.BaseVector;
     4import com.google.flatbuffers.BooleanVector;
     5import com.google.flatbuffers.ByteVector;
     6import com.google.flatbuffers.Constants;
     7import com.google.flatbuffers.DoubleVector;
     8import com.google.flatbuffers.FlatBufferBuilder;
     9import com.google.flatbuffers.FloatVector;
    10import com.google.flatbuffers.IntVector;
    11import com.google.flatbuffers.LongVector;
    12import com.google.flatbuffers.ShortVector;
    13import com.google.flatbuffers.StringVector;
    14import com.google.flatbuffers.Struct;
    15import com.google.flatbuffers.Table;
    16import com.google.flatbuffers.UnionVector;
    17import java.nio.ByteBuffer;
    18import java.nio.ByteOrder;
    19
    20@SuppressWarnings("unused")
    21public final class Rapunzel extends Struct {
    22  public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
    23  public Rapunzel __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    24
    25  public int hairLength() { return bb.getInt(bb_pos + 0); }
    26  public void mutateHairLength(int hair_length) { bb.putInt(bb_pos + 0, hair_length); }
    27
    28  public static int createRapunzel(FlatBufferBuilder builder, int hairLength) {
    29    builder.prep(4, 4);
    30    builder.putInt(hairLength);
    31    return builder.offset();
    32  }
    33
    34  public static final class Vector extends BaseVector {
    35    public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
    36
    37    public Rapunzel get(int j) { return get(new Rapunzel(), j); }
    38    public Rapunzel get(Rapunzel obj, int j) {  return obj.__assign(__element(j), bb); }
    39  }
    40  public RapunzelT unpack() {
    41    RapunzelT _o = new RapunzelT();
    42    unpackTo(_o);
    43    return _o;
    44  }
    45  public void unpackTo(RapunzelT _o) {
    46    int _oHairLength = hairLength();
    47    _o.setHairLength(_oHairLength);
    48  }
    49  public static int pack(FlatBufferBuilder builder, RapunzelT _o) {
    50    if (_o == null) return 0;
    51    return createRapunzel(
    52      builder,
    53      _o.getHairLength());
    54  }
    55}
    56

View as plain text