Files
flatbuffers/tests/MyGame/Example/TestSimpleTableWithEnum.java
Mormegil 25c99273d3 [Issue 252] Add type cast for default enum values in C#
When creating a “CreateXxx(...)” method for a “simple table” type,
enum-type fields with a non-zero default must have an explicit
cast for the respective argument default value, because in C#,
there is an implicit cast from int to an enum only for 0.

Also, added an example of such type into the example monster_test
type, so that we test this feature.
2015-08-11 18:07:38 +02:00

32 lines
1.4 KiB
Java

// automatically generated, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public final class TestSimpleTableWithEnum extends Table {
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TestSimpleTableWithEnum __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public byte color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 2; }
public static int createTestSimpleTableWithEnum(FlatBufferBuilder builder,
byte color) {
builder.startObject(1);
TestSimpleTableWithEnum.addColor(builder, color);
return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
}
public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startObject(1); }
public static void addColor(FlatBufferBuilder builder, byte color) { builder.addByte(0, color, 2); }
public static int endTestSimpleTableWithEnum(FlatBufferBuilder builder) {
int o = builder.endObject();
return o;
}
};