mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 22:28:28 +00:00
* [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:
@@ -2,6 +2,7 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class EnumInNestedNS {
|
||||
private EnumInNestedNS() { }
|
||||
public static final byte A = 0;
|
||||
|
||||
@@ -30,5 +30,23 @@ public final class StructInNestedNS extends Struct {
|
||||
public StructInNestedNS get(int j) { return get(new StructInNestedNS(), j); }
|
||||
public StructInNestedNS get(StructInNestedNS obj, int j) { return obj.__assign(__element(j), bb); }
|
||||
}
|
||||
public StructInNestedNST unpack() {
|
||||
StructInNestedNST _o = new StructInNestedNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(StructInNestedNST _o) {
|
||||
int _oA = a();
|
||||
_o.setA(_oA);
|
||||
int _oB = b();
|
||||
_o.setB(_oB);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, StructInNestedNST _o) {
|
||||
if (_o == null) return 0;
|
||||
return createStructInNestedNS(
|
||||
builder,
|
||||
_o.getA(),
|
||||
_o.getB());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class StructInNestedNST {
|
||||
private int a;
|
||||
private int b;
|
||||
|
||||
public int getA() { return a; }
|
||||
|
||||
public void setA(int a) { this.a = a; }
|
||||
|
||||
public int getB() { return b; }
|
||||
|
||||
public void setB(int b) { this.b = b; }
|
||||
|
||||
|
||||
public StructInNestedNST() {
|
||||
this.a = 0;
|
||||
this.b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,20 @@ public final class TableInNestedNS extends Table {
|
||||
public TableInNestedNS get(int j) { return get(new TableInNestedNS(), j); }
|
||||
public TableInNestedNS get(TableInNestedNS obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public TableInNestedNST unpack() {
|
||||
TableInNestedNST _o = new TableInNestedNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(TableInNestedNST _o) {
|
||||
int _oFoo = foo();
|
||||
_o.setFoo(_oFoo);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, TableInNestedNST _o) {
|
||||
if (_o == null) return 0;
|
||||
return createTableInNestedNS(
|
||||
builder,
|
||||
_o.getFoo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class TableInNestedNST {
|
||||
private int foo;
|
||||
|
||||
public int getFoo() { return foo; }
|
||||
|
||||
public void setFoo(int foo) { this.foo = foo; }
|
||||
|
||||
|
||||
public TableInNestedNST() {
|
||||
this.foo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UnionInNestedNS {
|
||||
private UnionInNestedNS() { }
|
||||
public static final byte NONE = 0;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA.NamespaceB;
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
public class UnionInNestedNSUnion {
|
||||
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 UnionInNestedNSUnion() {
|
||||
this.type = UnionInNestedNS.NONE;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNST asTableInNestedNS() { return (NamespaceA.NamespaceB.TableInNestedNST) value; }
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
|
||||
switch (_o.type) {
|
||||
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.asTableInNestedNS());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ public final class SecondTableInA extends Table {
|
||||
public NamespaceC.TableInC referToC(NamespaceC.TableInC obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static int createSecondTableInA(FlatBufferBuilder builder,
|
||||
int refer_to_cOffset) {
|
||||
int referToCOffset) {
|
||||
builder.startTable(1);
|
||||
SecondTableInA.addReferToC(builder, refer_to_cOffset);
|
||||
SecondTableInA.addReferToC(builder, referToCOffset);
|
||||
return SecondTableInA.endSecondTableInA(builder);
|
||||
}
|
||||
|
||||
@@ -38,5 +38,21 @@ public final class SecondTableInA extends Table {
|
||||
public SecondTableInA get(int j) { return get(new SecondTableInA(), j); }
|
||||
public SecondTableInA get(SecondTableInA obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public SecondTableInAT unpack() {
|
||||
SecondTableInAT _o = new SecondTableInAT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(SecondTableInAT _o) {
|
||||
if (referToC() != null) _o.setReferToC(referToC().unpack());
|
||||
else _o.setReferToC(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, SecondTableInAT _o) {
|
||||
if (_o == null) return 0;
|
||||
int _refer_to_c = _o.getReferToC() == null ? 0 : NamespaceC.TableInC.pack(builder, _o.getReferToC());
|
||||
return createSecondTableInA(
|
||||
builder,
|
||||
_refer_to_c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
tests/namespace_test/NamespaceA/SecondTableInAT.java
Normal file
22
tests/namespace_test/NamespaceA/SecondTableInAT.java
Normal file
@@ -0,0 +1,22 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class SecondTableInAT {
|
||||
private NamespaceC.TableInCT referToC;
|
||||
|
||||
public NamespaceC.TableInCT getReferToC() { return referToC; }
|
||||
|
||||
public void setReferToC(NamespaceC.TableInCT referToC) { this.referToC = referToC; }
|
||||
|
||||
|
||||
public SecondTableInAT() {
|
||||
this.referToC = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,5 +41,43 @@ public final class TableInFirstNS extends Table {
|
||||
public TableInFirstNS get(int j) { return get(new TableInFirstNS(), j); }
|
||||
public TableInFirstNS get(TableInFirstNS obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public TableInFirstNST unpack() {
|
||||
TableInFirstNST _o = new TableInFirstNST();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(TableInFirstNST _o) {
|
||||
if (fooTable() != null) _o.setFooTable(fooTable().unpack());
|
||||
else _o.setFooTable(null);
|
||||
byte _oFooEnum = fooEnum();
|
||||
_o.setFooEnum(_oFooEnum);
|
||||
NamespaceA.NamespaceB.UnionInNestedNSUnion _oFooUnion = new NamespaceA.NamespaceB.UnionInNestedNSUnion();
|
||||
byte _oFooUnionType = fooUnionType();
|
||||
_oFooUnion.setType(_oFooUnionType);
|
||||
Table _oFooUnionValue;
|
||||
switch (_oFooUnionType) {
|
||||
case NamespaceA.NamespaceB.UnionInNestedNS.TableInNestedNS:
|
||||
_oFooUnionValue = fooUnion(new NamespaceA.NamespaceB.TableInNestedNS());
|
||||
_oFooUnion.setValue(_oFooUnionValue != null ? ((NamespaceA.NamespaceB.TableInNestedNS) _oFooUnionValue).unpack() : null);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
_o.setFooUnion(_oFooUnion);
|
||||
if (fooStruct() != null) fooStruct().unpackTo(_o.getFooStruct());
|
||||
else _o.setFooStruct(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, TableInFirstNST _o) {
|
||||
if (_o == null) return 0;
|
||||
int _foo_table = _o.getFooTable() == null ? 0 : NamespaceA.NamespaceB.TableInNestedNS.pack(builder, _o.getFooTable());
|
||||
byte _fooUnionType = _o.getFooUnion() == null ? NamespaceA.NamespaceB.UnionInNestedNS.NONE : _o.getFooUnion().getType();
|
||||
int _fooUnion = _o.getFooUnion() == null ? 0 : NamespaceA.NamespaceB.UnionInNestedNSUnion.pack(builder, _o.getFooUnion());
|
||||
startTableInFirstNS(builder);
|
||||
addFooTable(builder, _foo_table);
|
||||
addFooEnum(builder, _o.getFooEnum());
|
||||
addFooUnionType(builder, _fooUnionType);
|
||||
addFooUnion(builder, _fooUnion);
|
||||
addFooStruct(builder, NamespaceA.NamespaceB.StructInNestedNS.pack(builder, _o.getFooStruct()));
|
||||
return endTableInFirstNS(builder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
40
tests/namespace_test/NamespaceA/TableInFirstNST.java
Normal file
40
tests/namespace_test/NamespaceA/TableInFirstNST.java
Normal file
@@ -0,0 +1,40 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package NamespaceA;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
public class TableInFirstNST {
|
||||
private NamespaceA.NamespaceB.TableInNestedNST fooTable;
|
||||
private byte fooEnum;
|
||||
private NamespaceA.NamespaceB.UnionInNestedNSUnion fooUnion;
|
||||
private NamespaceA.NamespaceB.StructInNestedNST fooStruct;
|
||||
|
||||
public NamespaceA.NamespaceB.TableInNestedNST getFooTable() { return fooTable; }
|
||||
|
||||
public void setFooTable(NamespaceA.NamespaceB.TableInNestedNST fooTable) { this.fooTable = fooTable; }
|
||||
|
||||
public byte getFooEnum() { return fooEnum; }
|
||||
|
||||
public void setFooEnum(byte fooEnum) { this.fooEnum = fooEnum; }
|
||||
|
||||
public NamespaceA.NamespaceB.UnionInNestedNSUnion getFooUnion() { return fooUnion; }
|
||||
|
||||
public void setFooUnion(NamespaceA.NamespaceB.UnionInNestedNSUnion fooUnion) { this.fooUnion = fooUnion; }
|
||||
|
||||
public NamespaceA.NamespaceB.StructInNestedNST getFooStruct() { return fooStruct; }
|
||||
|
||||
public void setFooStruct(NamespaceA.NamespaceB.StructInNestedNST fooStruct) { this.fooStruct = fooStruct; }
|
||||
|
||||
|
||||
public TableInFirstNST() {
|
||||
this.fooTable = null;
|
||||
this.fooEnum = 0;
|
||||
this.fooUnion = null;
|
||||
this.fooStruct = new NamespaceA.NamespaceB.StructInNestedNST();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user