diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2014-09-18 16:05:41 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2014-09-19 13:51:33 -0700 |
commit | d6ed127cf4e2d60b8cff06ea976db46770b5e637 (patch) | |
tree | 3ffc43ea87401fef4e6c70a0822ce5a3bbb7b417 /docs | |
parent | bdaedebef99fc5d06cb6e5312a48bacecdb60f70 (diff) | |
download | flatbuffers-d6ed127cf4e2d60b8cff06ea976db46770b5e637.tar.gz |
Added convenient create functions for Java/C#.
Bug: 15777857
Tested: on Linux and Windows.
Change-Id: I25db724349e2c801bb0e41137540507acd57cd03
Diffstat (limited to 'docs')
-rw-r--r-- | docs/html/md__java_usage.html | 2 | ||||
-rwxr-xr-x | docs/source/JavaUsage.md | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/docs/html/md__java_usage.html b/docs/html/md__java_usage.html index 06f4678a..5ba73424 100644 --- a/docs/html/md__java_usage.html +++ b/docs/html/md__java_usage.html @@ -77,7 +77,7 @@ Monster.addTest_type(fbb, (byte)1); Monster.addTest(fbb, mon2); Monster.addTest4(fbb, test4s); int mon = Monster.endMonster(fbb); -</pre><p>As you can see, the Java code for tables does not use a convenient <code>createMonster</code> call like the C++ code. This is to create the buffer without using temporary object allocation.</p> +</pre><p>For some simpler types, you can use a convenient <code>create</code> function call that allows you to construct tables in one function call. This example definition however contains an inline struct field, so we have to create the table manually. This is to create the buffer without using temporary object allocation.</p> <p>It's important to understand that fields that are structs are inline (like <code>Vec3</code> above), and MUST thus be created between the start and end calls of a table. Everything else (other tables, strings, vectors) MUST be created before the start of the table they are referenced in.</p> <p>Structs do have convenient methods that even have arguments for nested structs.</p> <p>As you can see, references to other objects (e.g. the string above) are simple ints, and thus do not have the type-safety of the Offset type in C++. Extra case must thus be taken that you set the right offset on the right field.</p> diff --git a/docs/source/JavaUsage.md b/docs/source/JavaUsage.md index 2c8c10ce..7b0af0cf 100755 --- a/docs/source/JavaUsage.md +++ b/docs/source/JavaUsage.md @@ -75,9 +75,11 @@ Create a table with a struct contained therein: Monster.addTest4(fbb, test4s); int mon = Monster.endMonster(fbb); -As you can see, the Java code for tables does not use a convenient -`createMonster` call like the C++ code. This is to create the buffer without -using temporary object allocation. +For some simpler types, you can use a convenient `create` function call that +allows you to construct tables in one function call. This example definition +however contains an inline struct field, so we have to create the table +manually. +This is to create the buffer without using temporary object allocation. It's important to understand that fields that are structs are inline (like `Vec3` above), and MUST thus be created between the start and end calls of |