[Java] ObjectAPI implementation (#6521) (#6582)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)

* [Java] ObjectAPI implementation (#6521)
This commit is contained in:
ofirm93
2021-06-04 00:17:40 +03:00
committed by GitHub
parent baaffbaedd
commit 7c3e267e1e
77 changed files with 3538 additions and 238 deletions

View File

@@ -13,14 +13,14 @@ public final class Ability extends Struct {
public Ability __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public long id() { return (long)bb.getInt(bb_pos + 0) & 0xFFFFFFFFL; }
public void mutateId(long id) { bb.putInt(bb_pos + 0, (int)id); }
public void mutateId(long id) { bb.putInt(bb_pos + 0, (int) id); }
public long distance() { return (long)bb.getInt(bb_pos + 4) & 0xFFFFFFFFL; }
public void mutateDistance(long distance) { bb.putInt(bb_pos + 4, (int)distance); }
public void mutateDistance(long distance) { bb.putInt(bb_pos + 4, (int) distance); }
public static int createAbility(FlatBufferBuilder builder, long id, long distance) {
builder.prep(4, 8);
builder.putInt((int)distance);
builder.putInt((int)id);
builder.putInt((int) distance);
builder.putInt((int) id);
return builder.offset();
}
@@ -30,5 +30,23 @@ public final class Ability extends Struct {
public Ability get(int j) { return get(new Ability(), j); }
public Ability get(Ability obj, int j) { return obj.__assign(__element(j), bb); }
}
public AbilityT unpack() {
AbilityT _o = new AbilityT();
unpackTo(_o);
return _o;
}
public void unpackTo(AbilityT _o) {
long _oId = id();
_o.setId(_oId);
long _oDistance = distance();
_o.setDistance(_oDistance);
}
public static int pack(FlatBufferBuilder builder, AbilityT _o) {
if (_o == null) return 0;
return createAbility(
builder,
_o.getId(),
_o.getDistance());
}
}

View File

@@ -0,0 +1,28 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class AbilityT {
private long id;
private long distance;
public long getId() { return id; }
public void setId(long id) { this.id = id; }
public long getDistance() { return distance; }
public void setDistance(long distance) { this.distance = distance; }
public AbilityT() {
this.id = 0L;
this.distance = 0L;
}
}

View File

@@ -2,6 +2,7 @@
package MyGame.Example;
@SuppressWarnings("unused")
public final class Any {
private Any() { }
public static final byte NONE = 0;

View File

@@ -2,6 +2,7 @@
package MyGame.Example;
@SuppressWarnings("unused")
public final class AnyAmbiguousAliases {
private AnyAmbiguousAliases() { }
public static final byte NONE = 0;

View File

@@ -0,0 +1,37 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import com.google.flatbuffers.FlatBufferBuilder;
public class AnyAmbiguousAliasesUnion {
private byte type;
private Object value;
public byte getType() { return type; }
public void setType(byte type) { this.type = type; }
public Object getValue() { return value; }
public void setValue(Object value) { this.value = value; }
public AnyAmbiguousAliasesUnion() {
this.type = AnyAmbiguousAliases.NONE;
this.value = null;
}
public MyGame.Example.MonsterT asM1() { return (MyGame.Example.MonsterT) value; }
public MyGame.Example.MonsterT asM2() { return (MyGame.Example.MonsterT) value; }
public MyGame.Example.MonsterT asM3() { return (MyGame.Example.MonsterT) value; }
public static int pack(FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
switch (_o.type) {
case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.pack(builder, _o.asM1());
case AnyAmbiguousAliases.M2: return MyGame.Example.Monster.pack(builder, _o.asM2());
case AnyAmbiguousAliases.M3: return MyGame.Example.Monster.pack(builder, _o.asM3());
default: return 0;
}
}
}

View File

@@ -0,0 +1,37 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import com.google.flatbuffers.FlatBufferBuilder;
public class AnyUnion {
private byte type;
private Object value;
public byte getType() { return type; }
public void setType(byte type) { this.type = type; }
public Object getValue() { return value; }
public void setValue(Object value) { this.value = value; }
public AnyUnion() {
this.type = Any.NONE;
this.value = null;
}
public MyGame.Example.MonsterT asMonster() { return (MyGame.Example.MonsterT) value; }
MyGame.Example.TestSimpleTableWithEnumT asTestSimpleTableWithEnum() { return (MyGame.Example.TestSimpleTableWithEnumT) value; }
public MyGame.Example2.MonsterT asMyGame_Example2_Monster() { return (MyGame.Example2.MonsterT) value; }
public static int pack(FlatBufferBuilder builder, AnyUnion _o) {
switch (_o.type) {
case Any.Monster: return MyGame.Example.Monster.pack(builder, _o.asMonster());
case Any.TestSimpleTableWithEnum: return MyGame.Example.TestSimpleTableWithEnum.pack(builder, _o.asTestSimpleTableWithEnum());
case Any.MyGame_Example2_Monster: return MyGame.Example2.Monster.pack(builder, _o.asMyGame_Example2_Monster());
default: return 0;
}
}
}

View File

@@ -2,6 +2,7 @@
package MyGame.Example;
@SuppressWarnings("unused")
public final class AnyUniqueAliases {
private AnyUniqueAliases() { }
public static final byte NONE = 0;

View File

@@ -0,0 +1,37 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import com.google.flatbuffers.FlatBufferBuilder;
public class AnyUniqueAliasesUnion {
private byte type;
private Object value;
public byte getType() { return type; }
public void setType(byte type) { this.type = type; }
public Object getValue() { return value; }
public void setValue(Object value) { this.value = value; }
public AnyUniqueAliasesUnion() {
this.type = AnyUniqueAliases.NONE;
this.value = null;
}
public MyGame.Example.MonsterT asM() { return (MyGame.Example.MonsterT) value; }
MyGame.Example.TestSimpleTableWithEnumT asTS() { return (MyGame.Example.TestSimpleTableWithEnumT) value; }
public MyGame.Example2.MonsterT asM2() { return (MyGame.Example2.MonsterT) value; }
public static int pack(FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
switch (_o.type) {
case AnyUniqueAliases.M: return MyGame.Example.Monster.pack(builder, _o.asM());
case AnyUniqueAliases.TS: return MyGame.Example.TestSimpleTableWithEnum.pack(builder, _o.asTS());
case AnyUniqueAliases.M2: return MyGame.Example2.Monster.pack(builder, _o.asM2());
default: return 0;
}
}
}

View File

@@ -18,6 +18,7 @@ public final class ArrayStruct extends Struct {
public void mutateB(int j, int b) { bb.putInt(bb_pos + 4 + j * 4, b); }
public byte c() { return bb.get(bb_pos + 64); }
public void mutateC(byte c) { bb.put(bb_pos + 64, c); }
public MyGame.Example.NestedStruct d(int j) { return d(new MyGame.Example.NestedStruct(), j); }
public MyGame.Example.NestedStruct d(MyGame.Example.NestedStruct obj, int j) { return obj.__assign(bb_pos + 72 + j * 32, bb); }
public int e() { return bb.getInt(bb_pos + 136); }
public void mutateE(int e) { bb.putInt(bb_pos + 136, e); }
@@ -60,5 +61,48 @@ public final class ArrayStruct extends Struct {
public ArrayStruct get(int j) { return get(new ArrayStruct(), j); }
public ArrayStruct get(ArrayStruct obj, int j) { return obj.__assign(__element(j), bb); }
}
public ArrayStructT unpack() {
ArrayStructT _o = new ArrayStructT();
unpackTo(_o);
return _o;
}
public void unpackTo(ArrayStructT _o) {
float _oA = a();
_o.setA(_oA);
int[] _oB = _o.getB();
for (int _j = 0; _j < 15; ++_j) { _oB[_j] = b(_j); }
byte _oC = c();
_o.setC(_oC);
MyGame.Example.NestedStructT[] _oD = _o.getD();
for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j).unpack(); }
int _oE = e();
_o.setE(_oE);
long[] _oF = _o.getF();
for (int _j = 0; _j < 2; ++_j) { _oF[_j] = f(_j); }
}
public static int pack(FlatBufferBuilder builder, ArrayStructT _o) {
if (_o == null) return 0;
int[] _b = _o.getB();
int[][] _d_a = new int[2][2];
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_a[idx0][idx1] = _o.getD()[idx0].getA()[idx1];}}
byte[] _d_b = new byte[2];
for (int idx0 = 0; idx0 < 2; ++idx0) {_d_b[idx0] = _o.getD()[idx0].getB();}
byte[][] _d_c = new byte[2][2];
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_c[idx0][idx1] = _o.getD()[idx0].getC()[idx1];}}
long[][] _d_d = new long[2][2];
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_d[idx0][idx1] = _o.getD()[idx0].getD()[idx1];}}
long[] _f = _o.getF();
return createArrayStruct(
builder,
_o.getA(),
_b,
_o.getC(),
_d_a,
_d_b,
_d_c,
_d_d,
_o.getE(),
_f);
}
}

View File

@@ -0,0 +1,52 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class ArrayStructT {
private float a;
private int[] b;
private byte c;
private MyGame.Example.NestedStructT[] d;
private int e;
private long[] f;
public float getA() { return a; }
public void setA(float a) { this.a = a; }
public int[] getB() { return b; }
public void setB(int[] b) { if (b != null && b.length == 15) this.b = b; }
public byte getC() { return c; }
public void setC(byte c) { this.c = c; }
public MyGame.Example.NestedStructT[] getD() { return d; }
public void setD(MyGame.Example.NestedStructT[] d) { if (d != null && d.length == 2) this.d = d; }
public int getE() { return e; }
public void setE(int e) { this.e = e; }
public long[] getF() { return f; }
public void setF(long[] f) { if (f != null && f.length == 2) this.f = f; }
public ArrayStructT() {
this.a = 0.0f;
this.b = new int[15];
this.c = 0;
this.d = new MyGame.Example.NestedStructT[2];
this.e = 0;
this.f = new long[2];
}
}

View File

@@ -34,5 +34,20 @@ public final class ArrayTable extends Table {
public ArrayTable get(int j) { return get(new ArrayTable(), j); }
public ArrayTable get(ArrayTable obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public ArrayTableT unpack() {
ArrayTableT _o = new ArrayTableT();
unpackTo(_o);
return _o;
}
public void unpackTo(ArrayTableT _o) {
if (a() != null) a().unpackTo(_o.getA());
else _o.setA(null);
}
public static int pack(FlatBufferBuilder builder, ArrayTableT _o) {
if (_o == null) return 0;
startArrayTable(builder);
addA(builder, MyGame.Example.ArrayStruct.pack(builder, _o.getA()));
return endArrayTable(builder);
}
}

View File

@@ -0,0 +1,30 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class ArrayTableT {
private MyGame.Example.ArrayStructT a;
public MyGame.Example.ArrayStructT getA() { return a; }
public void setA(MyGame.Example.ArrayStructT a) { this.a = a; }
public ArrayTableT() {
this.a = new MyGame.Example.ArrayStructT();
}
public static ArrayTableT deserializeFromBinary(byte[] fbBuffer) {
return ArrayTable.getRootAsArrayTable(ByteBuffer.wrap(fbBuffer)).unpack();
}
public byte[] serializeToBinary() {
FlatBufferBuilder fbb = new FlatBufferBuilder();
ArrayTable.finishArrayTableBuffer(fbb, ArrayTable.pack(fbb, this));
return fbb.sizedByteArray();
}
}

View File

@@ -5,6 +5,7 @@ package MyGame.Example;
/**
* Composite components of Monster color.
*/
@SuppressWarnings("unused")
public final class Color {
private Color() { }
public static final int Red = 1;

View File

@@ -34,9 +34,9 @@ public final class Monster extends Table {
public ByteVector inventoryVector(ByteVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
public ByteBuffer inventoryAsByteBuffer() { return __vector_as_bytebuffer(14, 1); }
public ByteBuffer inventoryInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 14, 1); }
public boolean mutateInventory(int j, int inventory) { int o = __offset(14); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)inventory); return true; } else { return false; } }
public boolean mutateInventory(int j, int inventory) { int o = __offset(14); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) inventory); return true; } else { return false; } }
public int color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 8; }
public boolean mutateColor(int color) { int o = __offset(16); if (o != 0) { bb.put(o + bb_pos, (byte)color); return true; } else { return false; } }
public boolean mutateColor(int color) { int o = __offset(16); if (o != 0) { bb.put(o + bb_pos, (byte) color); return true; } else { return false; } }
public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; }
public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o + bb_pos) : null; }
public MyGame.Example.Test test4(int j) { return test4(new MyGame.Example.Test(), j); }
@@ -69,7 +69,7 @@ public final class Monster extends Table {
public ByteBuffer testnestedflatbufferInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 30, 1); }
public MyGame.Example.Monster testnestedflatbufferAsMonster() { return testnestedflatbufferAsMonster(new MyGame.Example.Monster()); }
public MyGame.Example.Monster testnestedflatbufferAsMonster(MyGame.Example.Monster obj) { int o = __offset(30); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; }
public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)testnestedflatbuffer); return true; } else { return false; } }
public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) testnestedflatbuffer); return true; } else { return false; } }
public MyGame.Example.Stat testempty() { return testempty(new MyGame.Example.Stat()); }
public MyGame.Example.Stat testempty(MyGame.Example.Stat obj) { int o = __offset(32); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public boolean testbool() { int o = __offset(34); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
@@ -77,7 +77,7 @@ public final class Monster extends Table {
public int testhashs32Fnv1() { int o = __offset(36); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public boolean mutateTesthashs32Fnv1(int testhashs32_fnv1) { int o = __offset(36); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1); return true; } else { return false; } }
public long testhashu32Fnv1() { int o = __offset(38); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
public boolean mutateTesthashu32Fnv1(long testhashu32_fnv1) { int o = __offset(38); if (o != 0) { bb.putInt(o + bb_pos, (int)testhashu32_fnv1); return true; } else { return false; } }
public boolean mutateTesthashu32Fnv1(long testhashu32_fnv1) { int o = __offset(38); if (o != 0) { bb.putInt(o + bb_pos, (int) testhashu32_fnv1); return true; } else { return false; } }
public long testhashs64Fnv1() { int o = __offset(40); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
public boolean mutateTesthashs64Fnv1(long testhashs64_fnv1) { int o = __offset(40); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1); return true; } else { return false; } }
public long testhashu64Fnv1() { int o = __offset(42); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
@@ -85,7 +85,7 @@ public final class Monster extends Table {
public int testhashs32Fnv1a() { int o = __offset(44); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public boolean mutateTesthashs32Fnv1a(int testhashs32_fnv1a) { int o = __offset(44); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1a); return true; } else { return false; } }
public long testhashu32Fnv1a() { int o = __offset(46); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
public boolean mutateTesthashu32Fnv1a(long testhashu32_fnv1a) { int o = __offset(46); if (o != 0) { bb.putInt(o + bb_pos, (int)testhashu32_fnv1a); return true; } else { return false; } }
public boolean mutateTesthashu32Fnv1a(long testhashu32_fnv1a) { int o = __offset(46); if (o != 0) { bb.putInt(o + bb_pos, (int) testhashu32_fnv1a); return true; } else { return false; } }
public long testhashs64Fnv1a() { int o = __offset(48); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
public boolean mutateTesthashs64Fnv1a(long testhashs64_fnv1a) { int o = __offset(48); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1a); return true; } else { return false; } }
public long testhashu64Fnv1a() { int o = __offset(50); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
@@ -118,7 +118,7 @@ public final class Monster extends Table {
public ByteVector flexVector(ByteVector obj) { int o = __offset(64); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
public ByteBuffer flexAsByteBuffer() { return __vector_as_bytebuffer(64, 1); }
public ByteBuffer flexInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 64, 1); }
public boolean mutateFlex(int j, int flex) { int o = __offset(64); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)flex); return true; } else { return false; } }
public boolean mutateFlex(int j, int flex) { int o = __offset(64); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) flex); return true; } else { return false; } }
public MyGame.Example.Test test5(int j) { return test5(new MyGame.Example.Test(), j); }
public MyGame.Example.Test test5(MyGame.Example.Test obj, int j) { int o = __offset(66); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; }
public int test5Length() { int o = __offset(66); return o != 0 ? __vector_len(o) : 0; }
@@ -191,7 +191,7 @@ public final class Monster extends Table {
public ByteVector vectorOfEnumsVector(ByteVector obj) { int o = __offset(98); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
public ByteBuffer vectorOfEnumsAsByteBuffer() { return __vector_as_bytebuffer(98, 1); }
public ByteBuffer vectorOfEnumsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 98, 1); }
public boolean mutateVectorOfEnums(int j, int vector_of_enums) { int o = __offset(98); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)vector_of_enums); return true; } else { return false; } }
public boolean mutateVectorOfEnums(int j, int vector_of_enums) { int o = __offset(98); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) vector_of_enums); return true; } else { return false; } }
public byte signedEnum() { int o = __offset(100); return o != 0 ? bb.get(o + bb_pos) : -1; }
public boolean mutateSignedEnum(byte signed_enum) { int o = __offset(100); if (o != 0) { bb.put(o + bb_pos, signed_enum); return true; } else { return false; } }
public int testrequirednestedflatbuffer(int j) { int o = __offset(102); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
@@ -202,7 +202,7 @@ public final class Monster extends Table {
public ByteBuffer testrequirednestedflatbufferInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 102, 1); }
public MyGame.Example.Monster testrequirednestedflatbufferAsMonster() { return testrequirednestedflatbufferAsMonster(new MyGame.Example.Monster()); }
public MyGame.Example.Monster testrequirednestedflatbufferAsMonster(MyGame.Example.Monster obj) { int o = __offset(102); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; }
public boolean mutateTestrequirednestedflatbuffer(int j, int testrequirednestedflatbuffer) { int o = __offset(102); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)testrequirednestedflatbuffer); return true; } else { return false; } }
public boolean mutateTestrequirednestedflatbuffer(int j, int testrequirednestedflatbuffer) { int o = __offset(102); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) testrequirednestedflatbuffer); return true; } else { return false; } }
public MyGame.Example.Stat scalarKeySortedTables(int j) { return scalarKeySortedTables(new MyGame.Example.Stat(), j); }
public MyGame.Example.Stat scalarKeySortedTables(MyGame.Example.Stat obj, int j) { int o = __offset(104); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
public int scalarKeySortedTablesLength() { int o = __offset(104); return o != 0 ? __vector_len(o) : 0; }
@@ -220,7 +220,7 @@ public final class Monster extends Table {
public static int createInventoryVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
public static int createInventoryVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
public static void startInventoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(6, (byte)color, (byte)8); }
public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(6, (byte) color, (byte) 8); }
public static void addTestType(FlatBufferBuilder builder, byte testType) { builder.addByte(7, testType, 0); }
public static void addTest(FlatBufferBuilder builder, int testOffset) { builder.addOffset(8, testOffset, 0); }
public static void addTest4(FlatBufferBuilder builder, int test4Offset) { builder.addOffset(9, test4Offset, 0); }
@@ -239,11 +239,11 @@ public final class Monster extends Table {
public static void addTestempty(FlatBufferBuilder builder, int testemptyOffset) { builder.addOffset(14, testemptyOffset, 0); }
public static void addTestbool(FlatBufferBuilder builder, boolean testbool) { builder.addBoolean(15, testbool, false); }
public static void addTesthashs32Fnv1(FlatBufferBuilder builder, int testhashs32Fnv1) { builder.addInt(16, testhashs32Fnv1, 0); }
public static void addTesthashu32Fnv1(FlatBufferBuilder builder, long testhashu32Fnv1) { builder.addInt(17, (int)testhashu32Fnv1, (int)0L); }
public static void addTesthashu32Fnv1(FlatBufferBuilder builder, long testhashu32Fnv1) { builder.addInt(17, (int) testhashu32Fnv1, (int) 0L); }
public static void addTesthashs64Fnv1(FlatBufferBuilder builder, long testhashs64Fnv1) { builder.addLong(18, testhashs64Fnv1, 0L); }
public static void addTesthashu64Fnv1(FlatBufferBuilder builder, long testhashu64Fnv1) { builder.addLong(19, testhashu64Fnv1, 0L); }
public static void addTesthashs32Fnv1a(FlatBufferBuilder builder, int testhashs32Fnv1a) { builder.addInt(20, testhashs32Fnv1a, 0); }
public static void addTesthashu32Fnv1a(FlatBufferBuilder builder, long testhashu32Fnv1a) { builder.addInt(21, (int)testhashu32Fnv1a, (int)0L); }
public static void addTesthashu32Fnv1a(FlatBufferBuilder builder, long testhashu32Fnv1a) { builder.addInt(21, (int) testhashu32Fnv1a, (int) 0L); }
public static void addTesthashs64Fnv1a(FlatBufferBuilder builder, long testhashs64Fnv1a) { builder.addLong(22, testhashs64Fnv1a, 0L); }
public static void addTesthashu64Fnv1a(FlatBufferBuilder builder, long testhashu64Fnv1a) { builder.addLong(23, testhashu64Fnv1a, 0L); }
public static void addTestarrayofbools(FlatBufferBuilder builder, int testarrayofboolsOffset) { builder.addOffset(24, testarrayofboolsOffset, 0); }
@@ -344,5 +344,367 @@ public final class Monster extends Table {
public Monster getByKey(String key) { return __lookup_by_key(null, __vector(), key, bb); }
public Monster getByKey(Monster obj, String key) { return __lookup_by_key(obj, __vector(), key, bb); }
}
public MonsterT unpack() {
MonsterT _o = new MonsterT();
unpackTo(_o);
return _o;
}
public void unpackTo(MonsterT _o) {
if (pos() != null) pos().unpackTo(_o.getPos());
else _o.setPos(null);
short _oMana = mana();
_o.setMana(_oMana);
short _oHp = hp();
_o.setHp(_oHp);
String _oName = name();
_o.setName(_oName);
int[] _oInventory = new int[inventoryLength()];
for (int _j = 0; _j < inventoryLength(); ++_j) {_oInventory[_j] = inventory(_j);}
_o.setInventory(_oInventory);
int _oColor = color();
_o.setColor(_oColor);
MyGame.Example.AnyUnion _oTest = new MyGame.Example.AnyUnion();
byte _oTestType = testType();
_oTest.setType(_oTestType);
Table _oTestValue;
switch (_oTestType) {
case MyGame.Example.Any.Monster:
_oTestValue = test(new MyGame.Example.Monster());
_oTest.setValue(_oTestValue != null ? ((MyGame.Example.Monster) _oTestValue).unpack() : null);
break;
case MyGame.Example.Any.TestSimpleTableWithEnum:
_oTestValue = test(new MyGame.Example.TestSimpleTableWithEnum());
_oTest.setValue(_oTestValue != null ? ((MyGame.Example.TestSimpleTableWithEnum) _oTestValue).unpack() : null);
break;
case MyGame.Example.Any.MyGame_Example2_Monster:
_oTestValue = test(new MyGame.Example2.Monster());
_oTest.setValue(_oTestValue != null ? ((MyGame.Example2.Monster) _oTestValue).unpack() : null);
break;
default: break;
}
_o.setTest(_oTest);
MyGame.Example.TestT[] _oTest4 = new MyGame.Example.TestT[test4Length()];
for (int _j = 0; _j < test4Length(); ++_j) {_oTest4[_j] = (test4(_j) != null ? test4(_j).unpack() : null);}
_o.setTest4(_oTest4);
String[] _oTestarrayofstring = new String[testarrayofstringLength()];
for (int _j = 0; _j < testarrayofstringLength(); ++_j) {_oTestarrayofstring[_j] = testarrayofstring(_j);}
_o.setTestarrayofstring(_oTestarrayofstring);
MyGame.Example.MonsterT[] _oTestarrayoftables = new MyGame.Example.MonsterT[testarrayoftablesLength()];
for (int _j = 0; _j < testarrayoftablesLength(); ++_j) {_oTestarrayoftables[_j] = (testarrayoftables(_j) != null ? testarrayoftables(_j).unpack() : null);}
_o.setTestarrayoftables(_oTestarrayoftables);
if (enemy() != null) _o.setEnemy(enemy().unpack());
else _o.setEnemy(null);
int[] _oTestnestedflatbuffer = new int[testnestedflatbufferLength()];
for (int _j = 0; _j < testnestedflatbufferLength(); ++_j) {_oTestnestedflatbuffer[_j] = testnestedflatbuffer(_j);}
_o.setTestnestedflatbuffer(_oTestnestedflatbuffer);
if (testempty() != null) _o.setTestempty(testempty().unpack());
else _o.setTestempty(null);
boolean _oTestbool = testbool();
_o.setTestbool(_oTestbool);
int _oTesthashs32Fnv1 = testhashs32Fnv1();
_o.setTesthashs32Fnv1(_oTesthashs32Fnv1);
long _oTesthashu32Fnv1 = testhashu32Fnv1();
_o.setTesthashu32Fnv1(_oTesthashu32Fnv1);
long _oTesthashs64Fnv1 = testhashs64Fnv1();
_o.setTesthashs64Fnv1(_oTesthashs64Fnv1);
long _oTesthashu64Fnv1 = testhashu64Fnv1();
_o.setTesthashu64Fnv1(_oTesthashu64Fnv1);
int _oTesthashs32Fnv1a = testhashs32Fnv1a();
_o.setTesthashs32Fnv1a(_oTesthashs32Fnv1a);
long _oTesthashu32Fnv1a = testhashu32Fnv1a();
_o.setTesthashu32Fnv1a(_oTesthashu32Fnv1a);
long _oTesthashs64Fnv1a = testhashs64Fnv1a();
_o.setTesthashs64Fnv1a(_oTesthashs64Fnv1a);
long _oTesthashu64Fnv1a = testhashu64Fnv1a();
_o.setTesthashu64Fnv1a(_oTesthashu64Fnv1a);
boolean[] _oTestarrayofbools = new boolean[testarrayofboolsLength()];
for (int _j = 0; _j < testarrayofboolsLength(); ++_j) {_oTestarrayofbools[_j] = testarrayofbools(_j);}
_o.setTestarrayofbools(_oTestarrayofbools);
float _oTestf = testf();
_o.setTestf(_oTestf);
float _oTestf2 = testf2();
_o.setTestf2(_oTestf2);
float _oTestf3 = testf3();
_o.setTestf3(_oTestf3);
String[] _oTestarrayofstring2 = new String[testarrayofstring2Length()];
for (int _j = 0; _j < testarrayofstring2Length(); ++_j) {_oTestarrayofstring2[_j] = testarrayofstring2(_j);}
_o.setTestarrayofstring2(_oTestarrayofstring2);
MyGame.Example.AbilityT[] _oTestarrayofsortedstruct = new MyGame.Example.AbilityT[testarrayofsortedstructLength()];
for (int _j = 0; _j < testarrayofsortedstructLength(); ++_j) {_oTestarrayofsortedstruct[_j] = (testarrayofsortedstruct(_j) != null ? testarrayofsortedstruct(_j).unpack() : null);}
_o.setTestarrayofsortedstruct(_oTestarrayofsortedstruct);
int[] _oFlex = new int[flexLength()];
for (int _j = 0; _j < flexLength(); ++_j) {_oFlex[_j] = flex(_j);}
_o.setFlex(_oFlex);
MyGame.Example.TestT[] _oTest5 = new MyGame.Example.TestT[test5Length()];
for (int _j = 0; _j < test5Length(); ++_j) {_oTest5[_j] = (test5(_j) != null ? test5(_j).unpack() : null);}
_o.setTest5(_oTest5);
long[] _oVectorOfLongs = new long[vectorOfLongsLength()];
for (int _j = 0; _j < vectorOfLongsLength(); ++_j) {_oVectorOfLongs[_j] = vectorOfLongs(_j);}
_o.setVectorOfLongs(_oVectorOfLongs);
double[] _oVectorOfDoubles = new double[vectorOfDoublesLength()];
for (int _j = 0; _j < vectorOfDoublesLength(); ++_j) {_oVectorOfDoubles[_j] = vectorOfDoubles(_j);}
_o.setVectorOfDoubles(_oVectorOfDoubles);
if (parentNamespaceTest() != null) _o.setParentNamespaceTest(parentNamespaceTest().unpack());
else _o.setParentNamespaceTest(null);
MyGame.Example.ReferrableT[] _oVectorOfReferrables = new MyGame.Example.ReferrableT[vectorOfReferrablesLength()];
for (int _j = 0; _j < vectorOfReferrablesLength(); ++_j) {_oVectorOfReferrables[_j] = (vectorOfReferrables(_j) != null ? vectorOfReferrables(_j).unpack() : null);}
_o.setVectorOfReferrables(_oVectorOfReferrables);
long _oSingleWeakReference = singleWeakReference();
_o.setSingleWeakReference(_oSingleWeakReference);
long[] _oVectorOfWeakReferences = new long[vectorOfWeakReferencesLength()];
for (int _j = 0; _j < vectorOfWeakReferencesLength(); ++_j) {_oVectorOfWeakReferences[_j] = vectorOfWeakReferences(_j);}
_o.setVectorOfWeakReferences(_oVectorOfWeakReferences);
MyGame.Example.ReferrableT[] _oVectorOfStrongReferrables = new MyGame.Example.ReferrableT[vectorOfStrongReferrablesLength()];
for (int _j = 0; _j < vectorOfStrongReferrablesLength(); ++_j) {_oVectorOfStrongReferrables[_j] = (vectorOfStrongReferrables(_j) != null ? vectorOfStrongReferrables(_j).unpack() : null);}
_o.setVectorOfStrongReferrables(_oVectorOfStrongReferrables);
long _oCoOwningReference = coOwningReference();
_o.setCoOwningReference(_oCoOwningReference);
long[] _oVectorOfCoOwningReferences = new long[vectorOfCoOwningReferencesLength()];
for (int _j = 0; _j < vectorOfCoOwningReferencesLength(); ++_j) {_oVectorOfCoOwningReferences[_j] = vectorOfCoOwningReferences(_j);}
_o.setVectorOfCoOwningReferences(_oVectorOfCoOwningReferences);
long _oNonOwningReference = nonOwningReference();
_o.setNonOwningReference(_oNonOwningReference);
long[] _oVectorOfNonOwningReferences = new long[vectorOfNonOwningReferencesLength()];
for (int _j = 0; _j < vectorOfNonOwningReferencesLength(); ++_j) {_oVectorOfNonOwningReferences[_j] = vectorOfNonOwningReferences(_j);}
_o.setVectorOfNonOwningReferences(_oVectorOfNonOwningReferences);
MyGame.Example.AnyUniqueAliasesUnion _oAnyUnique = new MyGame.Example.AnyUniqueAliasesUnion();
byte _oAnyUniqueType = anyUniqueType();
_oAnyUnique.setType(_oAnyUniqueType);
Table _oAnyUniqueValue;
switch (_oAnyUniqueType) {
case MyGame.Example.AnyUniqueAliases.M:
_oAnyUniqueValue = anyUnique(new MyGame.Example.Monster());
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example.Monster) _oAnyUniqueValue).unpack() : null);
break;
case MyGame.Example.AnyUniqueAliases.TS:
_oAnyUniqueValue = anyUnique(new MyGame.Example.TestSimpleTableWithEnum());
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example.TestSimpleTableWithEnum) _oAnyUniqueValue).unpack() : null);
break;
case MyGame.Example.AnyUniqueAliases.M2:
_oAnyUniqueValue = anyUnique(new MyGame.Example2.Monster());
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example2.Monster) _oAnyUniqueValue).unpack() : null);
break;
default: break;
}
_o.setAnyUnique(_oAnyUnique);
MyGame.Example.AnyAmbiguousAliasesUnion _oAnyAmbiguous = new MyGame.Example.AnyAmbiguousAliasesUnion();
byte _oAnyAmbiguousType = anyAmbiguousType();
_oAnyAmbiguous.setType(_oAnyAmbiguousType);
Table _oAnyAmbiguousValue;
switch (_oAnyAmbiguousType) {
case MyGame.Example.AnyAmbiguousAliases.M1:
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
break;
case MyGame.Example.AnyAmbiguousAliases.M2:
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
break;
case MyGame.Example.AnyAmbiguousAliases.M3:
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
break;
default: break;
}
_o.setAnyAmbiguous(_oAnyAmbiguous);
int[] _oVectorOfEnums = new int[vectorOfEnumsLength()];
for (int _j = 0; _j < vectorOfEnumsLength(); ++_j) {_oVectorOfEnums[_j] = vectorOfEnums(_j);}
_o.setVectorOfEnums(_oVectorOfEnums);
byte _oSignedEnum = signedEnum();
_o.setSignedEnum(_oSignedEnum);
int[] _oTestrequirednestedflatbuffer = new int[testrequirednestedflatbufferLength()];
for (int _j = 0; _j < testrequirednestedflatbufferLength(); ++_j) {_oTestrequirednestedflatbuffer[_j] = testrequirednestedflatbuffer(_j);}
_o.setTestrequirednestedflatbuffer(_oTestrequirednestedflatbuffer);
MyGame.Example.StatT[] _oScalarKeySortedTables = new MyGame.Example.StatT[scalarKeySortedTablesLength()];
for (int _j = 0; _j < scalarKeySortedTablesLength(); ++_j) {_oScalarKeySortedTables[_j] = (scalarKeySortedTables(_j) != null ? scalarKeySortedTables(_j).unpack() : null);}
_o.setScalarKeySortedTables(_oScalarKeySortedTables);
}
public static int pack(FlatBufferBuilder builder, MonsterT _o) {
if (_o == null) return 0;
int _name = _o.getName() == null ? 0 : builder.createString(_o.getName());
int _inventory = 0;
if (_o.getInventory() != null) {
byte[] __inventory = new byte[_o.getInventory().length];
int _j = 0;
for (int _e : _o.getInventory()) { __inventory[_j] = (byte) _e; _j++;}
_inventory = createInventoryVector(builder, __inventory);
}
byte _testType = _o.getTest() == null ? MyGame.Example.Any.NONE : _o.getTest().getType();
int _test = _o.getTest() == null ? 0 : MyGame.Example.AnyUnion.pack(builder, _o.getTest());
int _test4 = 0;
MyGame.Example.TestT[] _oTest4 = _o.getTest4();
if (_oTest4 != null) {
startTest4Vector(builder, _oTest4.length);
for (int _j = _oTest4.length - 1; _j >=0; _j--) { MyGame.Example.Test.pack(builder, _oTest4[_j]);}
_test4 = builder.endVector();
}
int _testarrayofstring = 0;
if (_o.getTestarrayofstring() != null) {
int[] __testarrayofstring = new int[_o.getTestarrayofstring().length];
int _j = 0;
for (String _e : _o.getTestarrayofstring()) { __testarrayofstring[_j] = builder.createString(_e); _j++;}
_testarrayofstring = createTestarrayofstringVector(builder, __testarrayofstring);
}
int _testarrayoftables = 0;
if (_o.getTestarrayoftables() != null) {
int[] __testarrayoftables = new int[_o.getTestarrayoftables().length];
int _j = 0;
for (MyGame.Example.MonsterT _e : _o.getTestarrayoftables()) { __testarrayoftables[_j] = MyGame.Example.Monster.pack(builder, _e); _j++;}
_testarrayoftables = createTestarrayoftablesVector(builder, __testarrayoftables);
}
int _enemy = _o.getEnemy() == null ? 0 : MyGame.Example.Monster.pack(builder, _o.getEnemy());
int _testnestedflatbuffer = 0;
if (_o.getTestnestedflatbuffer() != null) {
byte[] __testnestedflatbuffer = new byte[_o.getTestnestedflatbuffer().length];
int _j = 0;
for (int _e : _o.getTestnestedflatbuffer()) { __testnestedflatbuffer[_j] = (byte) _e; _j++;}
_testnestedflatbuffer = createTestnestedflatbufferVector(builder, __testnestedflatbuffer);
}
int _testempty = _o.getTestempty() == null ? 0 : MyGame.Example.Stat.pack(builder, _o.getTestempty());
int _testarrayofbools = 0;
if (_o.getTestarrayofbools() != null) {
_testarrayofbools = createTestarrayofboolsVector(builder, _o.getTestarrayofbools());
}
int _testarrayofstring2 = 0;
if (_o.getTestarrayofstring2() != null) {
int[] __testarrayofstring2 = new int[_o.getTestarrayofstring2().length];
int _j = 0;
for (String _e : _o.getTestarrayofstring2()) { __testarrayofstring2[_j] = builder.createString(_e); _j++;}
_testarrayofstring2 = createTestarrayofstring2Vector(builder, __testarrayofstring2);
}
int _testarrayofsortedstruct = 0;
MyGame.Example.AbilityT[] _oTestarrayofsortedstruct = _o.getTestarrayofsortedstruct();
if (_oTestarrayofsortedstruct != null) {
startTestarrayofsortedstructVector(builder, _oTestarrayofsortedstruct.length);
for (int _j = _oTestarrayofsortedstruct.length - 1; _j >=0; _j--) { MyGame.Example.Ability.pack(builder, _oTestarrayofsortedstruct[_j]);}
_testarrayofsortedstruct = builder.endVector();
}
int _flex = 0;
if (_o.getFlex() != null) {
byte[] __flex = new byte[_o.getFlex().length];
int _j = 0;
for (int _e : _o.getFlex()) { __flex[_j] = (byte) _e; _j++;}
_flex = createFlexVector(builder, __flex);
}
int _test5 = 0;
MyGame.Example.TestT[] _oTest5 = _o.getTest5();
if (_oTest5 != null) {
startTest5Vector(builder, _oTest5.length);
for (int _j = _oTest5.length - 1; _j >=0; _j--) { MyGame.Example.Test.pack(builder, _oTest5[_j]);}
_test5 = builder.endVector();
}
int _vectorOfLongs = 0;
if (_o.getVectorOfLongs() != null) {
_vectorOfLongs = createVectorOfLongsVector(builder, _o.getVectorOfLongs());
}
int _vectorOfDoubles = 0;
if (_o.getVectorOfDoubles() != null) {
_vectorOfDoubles = createVectorOfDoublesVector(builder, _o.getVectorOfDoubles());
}
int _parent_namespace_test = _o.getParentNamespaceTest() == null ? 0 : MyGame.InParentNamespace.pack(builder, _o.getParentNamespaceTest());
int _vectorOfReferrables = 0;
if (_o.getVectorOfReferrables() != null) {
int[] __vectorOfReferrables = new int[_o.getVectorOfReferrables().length];
int _j = 0;
for (MyGame.Example.ReferrableT _e : _o.getVectorOfReferrables()) { __vectorOfReferrables[_j] = MyGame.Example.Referrable.pack(builder, _e); _j++;}
_vectorOfReferrables = createVectorOfReferrablesVector(builder, __vectorOfReferrables);
}
int _vectorOfWeakReferences = 0;
if (_o.getVectorOfWeakReferences() != null) {
_vectorOfWeakReferences = createVectorOfWeakReferencesVector(builder, _o.getVectorOfWeakReferences());
}
int _vectorOfStrongReferrables = 0;
if (_o.getVectorOfStrongReferrables() != null) {
int[] __vectorOfStrongReferrables = new int[_o.getVectorOfStrongReferrables().length];
int _j = 0;
for (MyGame.Example.ReferrableT _e : _o.getVectorOfStrongReferrables()) { __vectorOfStrongReferrables[_j] = MyGame.Example.Referrable.pack(builder, _e); _j++;}
_vectorOfStrongReferrables = createVectorOfStrongReferrablesVector(builder, __vectorOfStrongReferrables);
}
int _vectorOfCoOwningReferences = 0;
if (_o.getVectorOfCoOwningReferences() != null) {
_vectorOfCoOwningReferences = createVectorOfCoOwningReferencesVector(builder, _o.getVectorOfCoOwningReferences());
}
int _vectorOfNonOwningReferences = 0;
if (_o.getVectorOfNonOwningReferences() != null) {
_vectorOfNonOwningReferences = createVectorOfNonOwningReferencesVector(builder, _o.getVectorOfNonOwningReferences());
}
byte _anyUniqueType = _o.getAnyUnique() == null ? MyGame.Example.AnyUniqueAliases.NONE : _o.getAnyUnique().getType();
int _anyUnique = _o.getAnyUnique() == null ? 0 : MyGame.Example.AnyUniqueAliasesUnion.pack(builder, _o.getAnyUnique());
byte _anyAmbiguousType = _o.getAnyAmbiguous() == null ? MyGame.Example.AnyAmbiguousAliases.NONE : _o.getAnyAmbiguous().getType();
int _anyAmbiguous = _o.getAnyAmbiguous() == null ? 0 : MyGame.Example.AnyAmbiguousAliasesUnion.pack(builder, _o.getAnyAmbiguous());
int _vectorOfEnums = 0;
if (_o.getVectorOfEnums() != null) {
byte[] __vectorOfEnums = new byte[_o.getVectorOfEnums().length];
int _j = 0;
for (int _e : _o.getVectorOfEnums()) { __vectorOfEnums[_j] = (byte) _e; _j++;}
_vectorOfEnums = createVectorOfEnumsVector(builder, __vectorOfEnums);
}
int _testrequirednestedflatbuffer = 0;
if (_o.getTestrequirednestedflatbuffer() != null) {
byte[] __testrequirednestedflatbuffer = new byte[_o.getTestrequirednestedflatbuffer().length];
int _j = 0;
for (int _e : _o.getTestrequirednestedflatbuffer()) { __testrequirednestedflatbuffer[_j] = (byte) _e; _j++;}
_testrequirednestedflatbuffer = createTestrequirednestedflatbufferVector(builder, __testrequirednestedflatbuffer);
}
int _scalarKeySortedTables = 0;
if (_o.getScalarKeySortedTables() != null) {
int[] __scalarKeySortedTables = new int[_o.getScalarKeySortedTables().length];
int _j = 0;
for (MyGame.Example.StatT _e : _o.getScalarKeySortedTables()) { __scalarKeySortedTables[_j] = MyGame.Example.Stat.pack(builder, _e); _j++;}
_scalarKeySortedTables = createScalarKeySortedTablesVector(builder, __scalarKeySortedTables);
}
startMonster(builder);
addPos(builder, MyGame.Example.Vec3.pack(builder, _o.getPos()));
addMana(builder, _o.getMana());
addHp(builder, _o.getHp());
addName(builder, _name);
addInventory(builder, _inventory);
addColor(builder, _o.getColor());
addTestType(builder, _testType);
addTest(builder, _test);
addTest4(builder, _test4);
addTestarrayofstring(builder, _testarrayofstring);
addTestarrayoftables(builder, _testarrayoftables);
addEnemy(builder, _enemy);
addTestnestedflatbuffer(builder, _testnestedflatbuffer);
addTestempty(builder, _testempty);
addTestbool(builder, _o.getTestbool());
addTesthashs32Fnv1(builder, _o.getTesthashs32Fnv1());
addTesthashu32Fnv1(builder, _o.getTesthashu32Fnv1());
addTesthashs64Fnv1(builder, _o.getTesthashs64Fnv1());
addTesthashu64Fnv1(builder, _o.getTesthashu64Fnv1());
addTesthashs32Fnv1a(builder, _o.getTesthashs32Fnv1a());
addTesthashu32Fnv1a(builder, _o.getTesthashu32Fnv1a());
addTesthashs64Fnv1a(builder, _o.getTesthashs64Fnv1a());
addTesthashu64Fnv1a(builder, _o.getTesthashu64Fnv1a());
addTestarrayofbools(builder, _testarrayofbools);
addTestf(builder, _o.getTestf());
addTestf2(builder, _o.getTestf2());
addTestf3(builder, _o.getTestf3());
addTestarrayofstring2(builder, _testarrayofstring2);
addTestarrayofsortedstruct(builder, _testarrayofsortedstruct);
addFlex(builder, _flex);
addTest5(builder, _test5);
addVectorOfLongs(builder, _vectorOfLongs);
addVectorOfDoubles(builder, _vectorOfDoubles);
addParentNamespaceTest(builder, _parent_namespace_test);
addVectorOfReferrables(builder, _vectorOfReferrables);
addSingleWeakReference(builder, _o.getSingleWeakReference());
addVectorOfWeakReferences(builder, _vectorOfWeakReferences);
addVectorOfStrongReferrables(builder, _vectorOfStrongReferrables);
addCoOwningReference(builder, _o.getCoOwningReference());
addVectorOfCoOwningReferences(builder, _vectorOfCoOwningReferences);
addNonOwningReference(builder, _o.getNonOwningReference());
addVectorOfNonOwningReferences(builder, _vectorOfNonOwningReferences);
addAnyUniqueType(builder, _anyUniqueType);
addAnyUnique(builder, _anyUnique);
addAnyAmbiguousType(builder, _anyAmbiguousType);
addAnyAmbiguous(builder, _anyAmbiguous);
addVectorOfEnums(builder, _vectorOfEnums);
addSignedEnum(builder, _o.getSignedEnum());
addTestrequirednestedflatbuffer(builder, _testrequirednestedflatbuffer);
addScalarKeySortedTables(builder, _scalarKeySortedTables);
return endMonster(builder);
}
}

View File

@@ -0,0 +1,306 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class MonsterT {
private MyGame.Example.Vec3T pos;
private short mana;
private short hp;
private String name;
private int[] inventory;
private int color;
private MyGame.Example.AnyUnion test;
private MyGame.Example.TestT[] test4;
private String[] testarrayofstring;
private MyGame.Example.MonsterT[] testarrayoftables;
private MyGame.Example.MonsterT enemy;
private int[] testnestedflatbuffer;
private MyGame.Example.StatT testempty;
private boolean testbool;
private int testhashs32Fnv1;
private long testhashu32Fnv1;
private long testhashs64Fnv1;
private long testhashu64Fnv1;
private int testhashs32Fnv1a;
private long testhashu32Fnv1a;
private long testhashs64Fnv1a;
private long testhashu64Fnv1a;
private boolean[] testarrayofbools;
private float testf;
private float testf2;
private float testf3;
private String[] testarrayofstring2;
private MyGame.Example.AbilityT[] testarrayofsortedstruct;
private int[] flex;
private MyGame.Example.TestT[] test5;
private long[] vectorOfLongs;
private double[] vectorOfDoubles;
private MyGame.InParentNamespaceT parentNamespaceTest;
private MyGame.Example.ReferrableT[] vectorOfReferrables;
private long singleWeakReference;
private long[] vectorOfWeakReferences;
private MyGame.Example.ReferrableT[] vectorOfStrongReferrables;
private long coOwningReference;
private long[] vectorOfCoOwningReferences;
private long nonOwningReference;
private long[] vectorOfNonOwningReferences;
private MyGame.Example.AnyUniqueAliasesUnion anyUnique;
private MyGame.Example.AnyAmbiguousAliasesUnion anyAmbiguous;
private int[] vectorOfEnums;
private byte signedEnum;
private int[] testrequirednestedflatbuffer;
private MyGame.Example.StatT[] scalarKeySortedTables;
public MyGame.Example.Vec3T getPos() { return pos; }
public void setPos(MyGame.Example.Vec3T pos) { this.pos = pos; }
public short getMana() { return mana; }
public void setMana(short mana) { this.mana = mana; }
public short getHp() { return hp; }
public void setHp(short hp) { this.hp = hp; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public int[] getInventory() { return inventory; }
public void setInventory(int[] inventory) { this.inventory = inventory; }
public int getColor() { return color; }
public void setColor(int color) { this.color = color; }
public MyGame.Example.AnyUnion getTest() { return test; }
public void setTest(MyGame.Example.AnyUnion test) { this.test = test; }
public MyGame.Example.TestT[] getTest4() { return test4; }
public void setTest4(MyGame.Example.TestT[] test4) { this.test4 = test4; }
public String[] getTestarrayofstring() { return testarrayofstring; }
public void setTestarrayofstring(String[] testarrayofstring) { this.testarrayofstring = testarrayofstring; }
public MyGame.Example.MonsterT[] getTestarrayoftables() { return testarrayoftables; }
public void setTestarrayoftables(MyGame.Example.MonsterT[] testarrayoftables) { this.testarrayoftables = testarrayoftables; }
public MyGame.Example.MonsterT getEnemy() { return enemy; }
public void setEnemy(MyGame.Example.MonsterT enemy) { this.enemy = enemy; }
public int[] getTestnestedflatbuffer() { return testnestedflatbuffer; }
public void setTestnestedflatbuffer(int[] testnestedflatbuffer) { this.testnestedflatbuffer = testnestedflatbuffer; }
public MyGame.Example.StatT getTestempty() { return testempty; }
public void setTestempty(MyGame.Example.StatT testempty) { this.testempty = testempty; }
public boolean getTestbool() { return testbool; }
public void setTestbool(boolean testbool) { this.testbool = testbool; }
public int getTesthashs32Fnv1() { return testhashs32Fnv1; }
public void setTesthashs32Fnv1(int testhashs32Fnv1) { this.testhashs32Fnv1 = testhashs32Fnv1; }
public long getTesthashu32Fnv1() { return testhashu32Fnv1; }
public void setTesthashu32Fnv1(long testhashu32Fnv1) { this.testhashu32Fnv1 = testhashu32Fnv1; }
public long getTesthashs64Fnv1() { return testhashs64Fnv1; }
public void setTesthashs64Fnv1(long testhashs64Fnv1) { this.testhashs64Fnv1 = testhashs64Fnv1; }
public long getTesthashu64Fnv1() { return testhashu64Fnv1; }
public void setTesthashu64Fnv1(long testhashu64Fnv1) { this.testhashu64Fnv1 = testhashu64Fnv1; }
public int getTesthashs32Fnv1a() { return testhashs32Fnv1a; }
public void setTesthashs32Fnv1a(int testhashs32Fnv1a) { this.testhashs32Fnv1a = testhashs32Fnv1a; }
public long getTesthashu32Fnv1a() { return testhashu32Fnv1a; }
public void setTesthashu32Fnv1a(long testhashu32Fnv1a) { this.testhashu32Fnv1a = testhashu32Fnv1a; }
public long getTesthashs64Fnv1a() { return testhashs64Fnv1a; }
public void setTesthashs64Fnv1a(long testhashs64Fnv1a) { this.testhashs64Fnv1a = testhashs64Fnv1a; }
public long getTesthashu64Fnv1a() { return testhashu64Fnv1a; }
public void setTesthashu64Fnv1a(long testhashu64Fnv1a) { this.testhashu64Fnv1a = testhashu64Fnv1a; }
public boolean[] getTestarrayofbools() { return testarrayofbools; }
public void setTestarrayofbools(boolean[] testarrayofbools) { this.testarrayofbools = testarrayofbools; }
public float getTestf() { return testf; }
public void setTestf(float testf) { this.testf = testf; }
public float getTestf2() { return testf2; }
public void setTestf2(float testf2) { this.testf2 = testf2; }
public float getTestf3() { return testf3; }
public void setTestf3(float testf3) { this.testf3 = testf3; }
public String[] getTestarrayofstring2() { return testarrayofstring2; }
public void setTestarrayofstring2(String[] testarrayofstring2) { this.testarrayofstring2 = testarrayofstring2; }
public MyGame.Example.AbilityT[] getTestarrayofsortedstruct() { return testarrayofsortedstruct; }
public void setTestarrayofsortedstruct(MyGame.Example.AbilityT[] testarrayofsortedstruct) { this.testarrayofsortedstruct = testarrayofsortedstruct; }
public int[] getFlex() { return flex; }
public void setFlex(int[] flex) { this.flex = flex; }
public MyGame.Example.TestT[] getTest5() { return test5; }
public void setTest5(MyGame.Example.TestT[] test5) { this.test5 = test5; }
public long[] getVectorOfLongs() { return vectorOfLongs; }
public void setVectorOfLongs(long[] vectorOfLongs) { this.vectorOfLongs = vectorOfLongs; }
public double[] getVectorOfDoubles() { return vectorOfDoubles; }
public void setVectorOfDoubles(double[] vectorOfDoubles) { this.vectorOfDoubles = vectorOfDoubles; }
public MyGame.InParentNamespaceT getParentNamespaceTest() { return parentNamespaceTest; }
public void setParentNamespaceTest(MyGame.InParentNamespaceT parentNamespaceTest) { this.parentNamespaceTest = parentNamespaceTest; }
public MyGame.Example.ReferrableT[] getVectorOfReferrables() { return vectorOfReferrables; }
public void setVectorOfReferrables(MyGame.Example.ReferrableT[] vectorOfReferrables) { this.vectorOfReferrables = vectorOfReferrables; }
public long getSingleWeakReference() { return singleWeakReference; }
public void setSingleWeakReference(long singleWeakReference) { this.singleWeakReference = singleWeakReference; }
public long[] getVectorOfWeakReferences() { return vectorOfWeakReferences; }
public void setVectorOfWeakReferences(long[] vectorOfWeakReferences) { this.vectorOfWeakReferences = vectorOfWeakReferences; }
public MyGame.Example.ReferrableT[] getVectorOfStrongReferrables() { return vectorOfStrongReferrables; }
public void setVectorOfStrongReferrables(MyGame.Example.ReferrableT[] vectorOfStrongReferrables) { this.vectorOfStrongReferrables = vectorOfStrongReferrables; }
public long getCoOwningReference() { return coOwningReference; }
public void setCoOwningReference(long coOwningReference) { this.coOwningReference = coOwningReference; }
public long[] getVectorOfCoOwningReferences() { return vectorOfCoOwningReferences; }
public void setVectorOfCoOwningReferences(long[] vectorOfCoOwningReferences) { this.vectorOfCoOwningReferences = vectorOfCoOwningReferences; }
public long getNonOwningReference() { return nonOwningReference; }
public void setNonOwningReference(long nonOwningReference) { this.nonOwningReference = nonOwningReference; }
public long[] getVectorOfNonOwningReferences() { return vectorOfNonOwningReferences; }
public void setVectorOfNonOwningReferences(long[] vectorOfNonOwningReferences) { this.vectorOfNonOwningReferences = vectorOfNonOwningReferences; }
public MyGame.Example.AnyUniqueAliasesUnion getAnyUnique() { return anyUnique; }
public void setAnyUnique(MyGame.Example.AnyUniqueAliasesUnion anyUnique) { this.anyUnique = anyUnique; }
public MyGame.Example.AnyAmbiguousAliasesUnion getAnyAmbiguous() { return anyAmbiguous; }
public void setAnyAmbiguous(MyGame.Example.AnyAmbiguousAliasesUnion anyAmbiguous) { this.anyAmbiguous = anyAmbiguous; }
public int[] getVectorOfEnums() { return vectorOfEnums; }
public void setVectorOfEnums(int[] vectorOfEnums) { this.vectorOfEnums = vectorOfEnums; }
public byte getSignedEnum() { return signedEnum; }
public void setSignedEnum(byte signedEnum) { this.signedEnum = signedEnum; }
public int[] getTestrequirednestedflatbuffer() { return testrequirednestedflatbuffer; }
public void setTestrequirednestedflatbuffer(int[] testrequirednestedflatbuffer) { this.testrequirednestedflatbuffer = testrequirednestedflatbuffer; }
public MyGame.Example.StatT[] getScalarKeySortedTables() { return scalarKeySortedTables; }
public void setScalarKeySortedTables(MyGame.Example.StatT[] scalarKeySortedTables) { this.scalarKeySortedTables = scalarKeySortedTables; }
public MonsterT() {
this.pos = new MyGame.Example.Vec3T();
this.mana = 150;
this.hp = 100;
this.name = null;
this.inventory = null;
this.color = 8;
this.test = null;
this.test4 = null;
this.testarrayofstring = null;
this.testarrayoftables = null;
this.enemy = null;
this.testnestedflatbuffer = null;
this.testempty = null;
this.testbool = false;
this.testhashs32Fnv1 = 0;
this.testhashu32Fnv1 = 0L;
this.testhashs64Fnv1 = 0L;
this.testhashu64Fnv1 = 0L;
this.testhashs32Fnv1a = 0;
this.testhashu32Fnv1a = 0L;
this.testhashs64Fnv1a = 0L;
this.testhashu64Fnv1a = 0L;
this.testarrayofbools = null;
this.testf = 3.14159f;
this.testf2 = 3.0f;
this.testf3 = 0.0f;
this.testarrayofstring2 = null;
this.testarrayofsortedstruct = null;
this.flex = null;
this.test5 = null;
this.vectorOfLongs = null;
this.vectorOfDoubles = null;
this.parentNamespaceTest = null;
this.vectorOfReferrables = null;
this.singleWeakReference = 0L;
this.vectorOfWeakReferences = null;
this.vectorOfStrongReferrables = null;
this.coOwningReference = 0L;
this.vectorOfCoOwningReferences = null;
this.nonOwningReference = 0L;
this.vectorOfNonOwningReferences = null;
this.anyUnique = null;
this.anyAmbiguous = null;
this.vectorOfEnums = null;
this.signedEnum = -1;
this.testrequirednestedflatbuffer = null;
this.scalarKeySortedTables = null;
}
public static MonsterT deserializeFromBinary(byte[] fbBuffer) {
return Monster.getRootAsMonster(ByteBuffer.wrap(fbBuffer)).unpack();
}
public byte[] serializeToBinary() {
FlatBufferBuilder fbb = new FlatBufferBuilder();
Monster.finishMonsterBuffer(fbb, Monster.pack(fbb, this));
return fbb.sizedByteArray();
}
}

View File

@@ -43,5 +43,32 @@ public final class NestedStruct extends Struct {
public NestedStruct get(int j) { return get(new NestedStruct(), j); }
public NestedStruct get(NestedStruct obj, int j) { return obj.__assign(__element(j), bb); }
}
public NestedStructT unpack() {
NestedStructT _o = new NestedStructT();
unpackTo(_o);
return _o;
}
public void unpackTo(NestedStructT _o) {
int[] _oA = _o.getA();
for (int _j = 0; _j < 2; ++_j) { _oA[_j] = a(_j); }
byte _oB = b();
_o.setB(_oB);
byte[] _oC = _o.getC();
for (int _j = 0; _j < 2; ++_j) { _oC[_j] = c(_j); }
long[] _oD = _o.getD();
for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j); }
}
public static int pack(FlatBufferBuilder builder, NestedStructT _o) {
if (_o == null) return 0;
int[] _a = _o.getA();
byte[] _c = _o.getC();
long[] _d = _o.getD();
return createNestedStruct(
builder,
_a,
_o.getB(),
_c,
_d);
}
}

View File

@@ -0,0 +1,40 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class NestedStructT {
private int[] a;
private byte b;
private byte[] c;
private long[] d;
public int[] getA() { return a; }
public void setA(int[] a) { if (a != null && a.length == 2) this.a = a; }
public byte getB() { return b; }
public void setB(byte b) { this.b = b; }
public byte[] getC() { return c; }
public void setC(byte[] c) { if (c != null && c.length == 2) this.c = c; }
public long[] getD() { return d; }
public void setD(long[] d) { if (d != null && d.length == 2) this.d = d; }
public NestedStructT() {
this.a = new int[2];
this.b = 0;
this.c = new byte[2];
this.d = new long[2];
}
}

View File

@@ -2,6 +2,7 @@
package MyGame.Example;
@SuppressWarnings("unused")
public final class Race {
private Race() { }
public static final byte None = -1;

View File

@@ -68,5 +68,20 @@ public final class Referrable extends Table {
public Referrable getByKey(long key) { return __lookup_by_key(null, __vector(), key, bb); }
public Referrable getByKey(Referrable obj, long key) { return __lookup_by_key(obj, __vector(), key, bb); }
}
public ReferrableT unpack() {
ReferrableT _o = new ReferrableT();
unpackTo(_o);
return _o;
}
public void unpackTo(ReferrableT _o) {
long _oId = id();
_o.setId(_oId);
}
public static int pack(FlatBufferBuilder builder, ReferrableT _o) {
if (_o == null) return 0;
return createReferrable(
builder,
_o.getId());
}
}

View File

@@ -0,0 +1,22 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class ReferrableT {
private long id;
public long getId() { return id; }
public void setId(long id) { this.id = id; }
public ReferrableT() {
this.id = 0L;
}
}

View File

@@ -21,7 +21,7 @@ public final class Stat extends Table {
public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
public boolean mutateVal(long val) { int o = __offset(6); if (o != 0) { bb.putLong(o + bb_pos, val); return true; } else { return false; } }
public int count() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
public boolean mutateCount(int count) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, (short)count); return true; } else { return false; } }
public boolean mutateCount(int count) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, (short) count); return true; } else { return false; } }
public static int createStat(FlatBufferBuilder builder,
int idOffset,
@@ -37,7 +37,7 @@ public final class Stat extends Table {
public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); }
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short)count, (short)0); }
public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short) count, (short) 0); }
public static int endStat(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
@@ -79,5 +79,27 @@ public final class Stat extends Table {
public Stat getByKey(int key) { return __lookup_by_key(null, __vector(), key, bb); }
public Stat getByKey(Stat obj, int key) { return __lookup_by_key(obj, __vector(), key, bb); }
}
public StatT unpack() {
StatT _o = new StatT();
unpackTo(_o);
return _o;
}
public void unpackTo(StatT _o) {
String _oId = id();
_o.setId(_oId);
long _oVal = val();
_o.setVal(_oVal);
int _oCount = count();
_o.setCount(_oCount);
}
public static int pack(FlatBufferBuilder builder, StatT _o) {
if (_o == null) return 0;
int _id = _o.getId() == null ? 0 : builder.createString(_o.getId());
return createStat(
builder,
_id,
_o.getVal(),
_o.getCount());
}
}

View File

@@ -0,0 +1,34 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class StatT {
private String id;
private long val;
private int count;
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public long getVal() { return val; }
public void setVal(long val) { this.val = val; }
public int getCount() { return count; }
public void setCount(int count) { this.count = count; }
public StatT() {
this.id = null;
this.val = 0L;
this.count = 0;
}
}

View File

@@ -22,15 +22,15 @@ public final class StructOfStructs extends Struct {
public static int createStructOfStructs(FlatBufferBuilder builder, long a_id, long a_distance, short b_a, byte b_b, long c_id, long c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.putInt((int)c_distance);
builder.putInt((int)c_id);
builder.putInt((int) c_distance);
builder.putInt((int) c_id);
builder.prep(2, 4);
builder.pad(1);
builder.putByte(b_b);
builder.putShort(b_a);
builder.prep(4, 8);
builder.putInt((int)a_distance);
builder.putInt((int)a_id);
builder.putInt((int) a_distance);
builder.putInt((int) a_id);
return builder.offset();
}
@@ -40,5 +40,32 @@ public final class StructOfStructs extends Struct {
public StructOfStructs get(int j) { return get(new StructOfStructs(), j); }
public StructOfStructs get(StructOfStructs obj, int j) { return obj.__assign(__element(j), bb); }
}
public StructOfStructsT unpack() {
StructOfStructsT _o = new StructOfStructsT();
unpackTo(_o);
return _o;
}
public void unpackTo(StructOfStructsT _o) {
a().unpackTo(_o.getA());
b().unpackTo(_o.getB());
c().unpackTo(_o.getC());
}
public static int pack(FlatBufferBuilder builder, StructOfStructsT _o) {
if (_o == null) return 0;
int _a_id = _o.getA().getId();
int _a_distance = _o.getA().getDistance();
short _b_a = _o.getB().getA();
byte _b_b = _o.getB().getB();
int _c_id = _o.getC().getId();
int _c_distance = _o.getC().getDistance();
return createStructOfStructs(
builder,
_a_id,
_a_distance,
_b_a,
_b_b,
_c_id,
_c_distance);
}
}

View File

@@ -0,0 +1,34 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class StructOfStructsT {
private MyGame.Example.AbilityT a;
private MyGame.Example.TestT b;
private MyGame.Example.AbilityT c;
public MyGame.Example.AbilityT getA() { return a; }
public void setA(MyGame.Example.AbilityT a) { this.a = a; }
public MyGame.Example.TestT getB() { return b; }
public void setB(MyGame.Example.TestT b) { this.b = b; }
public MyGame.Example.AbilityT getC() { return c; }
public void setC(MyGame.Example.AbilityT c) { this.c = c; }
public StructOfStructsT() {
this.a = new MyGame.Example.AbilityT();
this.b = new MyGame.Example.TestT();
this.c = new MyGame.Example.AbilityT();
}
}

View File

@@ -31,5 +31,23 @@ public final class Test extends Struct {
public Test get(int j) { return get(new Test(), j); }
public Test get(Test obj, int j) { return obj.__assign(__element(j), bb); }
}
public TestT unpack() {
TestT _o = new TestT();
unpackTo(_o);
return _o;
}
public void unpackTo(TestT _o) {
short _oA = a();
_o.setA(_oA);
byte _oB = b();
_o.setB(_oB);
}
public static int pack(FlatBufferBuilder builder, TestT _o) {
if (_o == null) return 0;
return createTest(
builder,
_o.getA(),
_o.getB());
}
}

View File

@@ -2,6 +2,7 @@
package MyGame.Example;
@SuppressWarnings("unused")
public final class TestEnum {
private TestEnum() { }
public static final byte A = 0;

View File

@@ -16,7 +16,7 @@ final class TestSimpleTableWithEnum extends Table {
public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 2; }
public boolean mutateColor(int color) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, (byte)color); return true; } else { return false; } }
public boolean mutateColor(int color) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, (byte) color); return true; } else { return false; } }
public static int createTestSimpleTableWithEnum(FlatBufferBuilder builder,
int color) {
@@ -26,7 +26,7 @@ final class TestSimpleTableWithEnum extends Table {
}
public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startTable(1); }
public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(0, (byte)color, (byte)2); }
public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(0, (byte) color, (byte) 2); }
public static int endTestSimpleTableWithEnum(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
@@ -38,5 +38,20 @@ final class TestSimpleTableWithEnum extends Table {
public TestSimpleTableWithEnum get(int j) { return get(new TestSimpleTableWithEnum(), j); }
public TestSimpleTableWithEnum get(TestSimpleTableWithEnum obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public TestSimpleTableWithEnumT unpack() {
TestSimpleTableWithEnumT _o = new TestSimpleTableWithEnumT();
unpackTo(_o);
return _o;
}
public void unpackTo(TestSimpleTableWithEnumT _o) {
int _oColor = color();
_o.setColor(_oColor);
}
public static int pack(FlatBufferBuilder builder, TestSimpleTableWithEnumT _o) {
if (_o == null) return 0;
return createTestSimpleTableWithEnum(
builder,
_o.getColor());
}
}

View File

@@ -0,0 +1,22 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
class TestSimpleTableWithEnumT {
private int color;
public int getColor() { return color; }
public void setColor(int color) { this.color = color; }
public TestSimpleTableWithEnumT() {
this.color = 2;
}
}

View File

@@ -0,0 +1,28 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class TestT {
private short a;
private byte b;
public short getA() { return a; }
public void setA(short a) { this.a = a; }
public byte getB() { return b; }
public void setB(byte b) { this.b = b; }
public TestT() {
this.a = 0;
this.b = 0;
}
}

View File

@@ -18,15 +18,15 @@ public final class TypeAliases extends Table {
public byte i8() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
public boolean mutateI8(byte i8) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, i8); return true; } else { return false; } }
public int u8() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 0; }
public boolean mutateU8(int u8) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, (byte)u8); return true; } else { return false; } }
public boolean mutateU8(int u8) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, (byte) u8); return true; } else { return false; } }
public short i16() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 0; }
public boolean mutateI16(short i16) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, i16); return true; } else { return false; } }
public int u16() { int o = __offset(10); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
public boolean mutateU16(int u16) { int o = __offset(10); if (o != 0) { bb.putShort(o + bb_pos, (short)u16); return true; } else { return false; } }
public boolean mutateU16(int u16) { int o = __offset(10); if (o != 0) { bb.putShort(o + bb_pos, (short) u16); return true; } else { return false; } }
public int i32() { int o = __offset(12); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public boolean mutateI32(int i32) { int o = __offset(12); if (o != 0) { bb.putInt(o + bb_pos, i32); return true; } else { return false; } }
public long u32() { int o = __offset(14); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
public boolean mutateU32(long u32) { int o = __offset(14); if (o != 0) { bb.putInt(o + bb_pos, (int)u32); return true; } else { return false; } }
public boolean mutateU32(long u32) { int o = __offset(14); if (o != 0) { bb.putInt(o + bb_pos, (int) u32); return true; } else { return false; } }
public long i64() { int o = __offset(16); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
public boolean mutateI64(long i64) { int o = __offset(16); if (o != 0) { bb.putLong(o + bb_pos, i64); return true; } else { return false; } }
public long u64() { int o = __offset(18); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
@@ -81,11 +81,11 @@ public final class TypeAliases extends Table {
public static void startTypeAliases(FlatBufferBuilder builder) { builder.startTable(12); }
public static void addI8(FlatBufferBuilder builder, byte i8) { builder.addByte(0, i8, 0); }
public static void addU8(FlatBufferBuilder builder, int u8) { builder.addByte(1, (byte)u8, (byte)0); }
public static void addU8(FlatBufferBuilder builder, int u8) { builder.addByte(1, (byte) u8, (byte) 0); }
public static void addI16(FlatBufferBuilder builder, short i16) { builder.addShort(2, i16, 0); }
public static void addU16(FlatBufferBuilder builder, int u16) { builder.addShort(3, (short)u16, (short)0); }
public static void addU16(FlatBufferBuilder builder, int u16) { builder.addShort(3, (short) u16, (short) 0); }
public static void addI32(FlatBufferBuilder builder, int i32) { builder.addInt(4, i32, 0); }
public static void addU32(FlatBufferBuilder builder, long u32) { builder.addInt(5, (int)u32, (int)0L); }
public static void addU32(FlatBufferBuilder builder, long u32) { builder.addInt(5, (int) u32, (int) 0L); }
public static void addI64(FlatBufferBuilder builder, long i64) { builder.addLong(6, i64, 0L); }
public static void addU64(FlatBufferBuilder builder, long u64) { builder.addLong(7, u64, 0L); }
public static void addF32(FlatBufferBuilder builder, float f32) { builder.addFloat(8, f32, 0.0f); }
@@ -108,5 +108,63 @@ public final class TypeAliases extends Table {
public TypeAliases get(int j) { return get(new TypeAliases(), j); }
public TypeAliases get(TypeAliases obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public TypeAliasesT unpack() {
TypeAliasesT _o = new TypeAliasesT();
unpackTo(_o);
return _o;
}
public void unpackTo(TypeAliasesT _o) {
byte _oI8 = i8();
_o.setI8(_oI8);
int _oU8 = u8();
_o.setU8(_oU8);
short _oI16 = i16();
_o.setI16(_oI16);
int _oU16 = u16();
_o.setU16(_oU16);
int _oI32 = i32();
_o.setI32(_oI32);
long _oU32 = u32();
_o.setU32(_oU32);
long _oI64 = i64();
_o.setI64(_oI64);
long _oU64 = u64();
_o.setU64(_oU64);
float _oF32 = f32();
_o.setF32(_oF32);
double _oF64 = f64();
_o.setF64(_oF64);
byte[] _oV8 = new byte[v8Length()];
for (int _j = 0; _j < v8Length(); ++_j) {_oV8[_j] = v8(_j);}
_o.setV8(_oV8);
double[] _oVf64 = new double[vf64Length()];
for (int _j = 0; _j < vf64Length(); ++_j) {_oVf64[_j] = vf64(_j);}
_o.setVf64(_oVf64);
}
public static int pack(FlatBufferBuilder builder, TypeAliasesT _o) {
if (_o == null) return 0;
int _v8 = 0;
if (_o.getV8() != null) {
_v8 = createV8Vector(builder, _o.getV8());
}
int _vf64 = 0;
if (_o.getVf64() != null) {
_vf64 = createVf64Vector(builder, _o.getVf64());
}
return createTypeAliases(
builder,
_o.getI8(),
_o.getU8(),
_o.getI16(),
_o.getU16(),
_o.getI32(),
_o.getU32(),
_o.getI64(),
_o.getU64(),
_o.getF32(),
_o.getF64(),
_v8,
_vf64);
}
}

View File

@@ -0,0 +1,88 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class TypeAliasesT {
private byte i8;
private int u8;
private short i16;
private int u16;
private int i32;
private long u32;
private long i64;
private long u64;
private float f32;
private double f64;
private byte[] v8;
private double[] vf64;
public byte getI8() { return i8; }
public void setI8(byte i8) { this.i8 = i8; }
public int getU8() { return u8; }
public void setU8(int u8) { this.u8 = u8; }
public short getI16() { return i16; }
public void setI16(short i16) { this.i16 = i16; }
public int getU16() { return u16; }
public void setU16(int u16) { this.u16 = u16; }
public int getI32() { return i32; }
public void setI32(int i32) { this.i32 = i32; }
public long getU32() { return u32; }
public void setU32(long u32) { this.u32 = u32; }
public long getI64() { return i64; }
public void setI64(long i64) { this.i64 = i64; }
public long getU64() { return u64; }
public void setU64(long u64) { this.u64 = u64; }
public float getF32() { return f32; }
public void setF32(float f32) { this.f32 = f32; }
public double getF64() { return f64; }
public void setF64(double f64) { this.f64 = f64; }
public byte[] getV8() { return v8; }
public void setV8(byte[] v8) { this.v8 = v8; }
public double[] getVf64() { return vf64; }
public void setVf64(double[] vf64) { this.vf64 = vf64; }
public TypeAliasesT() {
this.i8 = 0;
this.u8 = 0;
this.i16 = 0;
this.u16 = 0;
this.i32 = 0;
this.u32 = 0L;
this.i64 = 0L;
this.u64 = 0L;
this.f32 = 0.0f;
this.f64 = 0.0;
this.v8 = null;
this.vf64 = null;
}
}

View File

@@ -21,7 +21,7 @@ public final class Vec3 extends Struct {
public double test1() { return bb.getDouble(bb_pos + 16); }
public void mutateTest1(double test1) { bb.putDouble(bb_pos + 16, test1); }
public int test2() { return bb.get(bb_pos + 24) & 0xFF; }
public void mutateTest2(int test2) { bb.put(bb_pos + 24, (byte)test2); }
public void mutateTest2(int test2) { bb.put(bb_pos + 24, (byte) test2); }
public MyGame.Example.Test test3() { return test3(new MyGame.Example.Test()); }
public MyGame.Example.Test test3(MyGame.Example.Test obj) { return obj.__assign(bb_pos + 26, bb); }
@@ -33,7 +33,7 @@ public final class Vec3 extends Struct {
builder.putByte(test3_b);
builder.putShort(test3_a);
builder.pad(1);
builder.putByte((byte)test2);
builder.putByte((byte) test2);
builder.putDouble(test1);
builder.pad(4);
builder.putFloat(z);
@@ -48,5 +48,37 @@ public final class Vec3 extends Struct {
public Vec3 get(int j) { return get(new Vec3(), j); }
public Vec3 get(Vec3 obj, int j) { return obj.__assign(__element(j), bb); }
}
public Vec3T unpack() {
Vec3T _o = new Vec3T();
unpackTo(_o);
return _o;
}
public void unpackTo(Vec3T _o) {
float _oX = x();
_o.setX(_oX);
float _oY = y();
_o.setY(_oY);
float _oZ = z();
_o.setZ(_oZ);
double _oTest1 = test1();
_o.setTest1(_oTest1);
int _oTest2 = test2();
_o.setTest2(_oTest2);
test3().unpackTo(_o.getTest3());
}
public static int pack(FlatBufferBuilder builder, Vec3T _o) {
if (_o == null) return 0;
short _test3_a = _o.getTest3().getA();
byte _test3_b = _o.getTest3().getB();
return createVec3(
builder,
_o.getX(),
_o.getY(),
_o.getZ(),
_o.getTest1(),
_o.getTest2(),
_test3_a,
_test3_b);
}
}

View File

@@ -0,0 +1,52 @@
// automatically generated by the FlatBuffers compiler, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public class Vec3T {
private float x;
private float y;
private float z;
private double test1;
private int test2;
private MyGame.Example.TestT test3;
public float getX() { return x; }
public void setX(float x) { this.x = x; }
public float getY() { return y; }
public void setY(float y) { this.y = y; }
public float getZ() { return z; }
public void setZ(float z) { this.z = z; }
public double getTest1() { return test1; }
public void setTest1(double test1) { this.test1 = test1; }
public int getTest2() { return test2; }
public void setTest2(int test2) { this.test2 = test2; }
public MyGame.Example.TestT getTest3() { return test3; }
public void setTest3(MyGame.Example.TestT test3) { this.test3 = test3; }
public Vec3T() {
this.x = 0.0f;
this.y = 0.0f;
this.z = 0.0f;
this.test1 = 0.0;
this.test2 = 0;
this.test3 = new MyGame.Example.TestT();
}
}