diff options
author | Ulas Kirazci <ulas@google.com> | 2013-04-01 11:29:43 -0700 |
---|---|---|
committer | Ulas Kirazci <ulas@google.com> | 2013-07-29 09:35:44 -0700 |
commit | 35d9fd84ff1d9ecdb91156b757cc9fdcc3f25249 (patch) | |
tree | bf47056d6c723ec8939717efb9a5f30cbe7783af /java/README.txt | |
parent | 021f8f1badf1c4db519e3f35d600dec4b5c52eff (diff) | |
download | external_protobuf-35d9fd84ff1d9ecdb91156b757cc9fdcc3f25249.zip external_protobuf-35d9fd84ff1d9ecdb91156b757cc9fdcc3f25249.tar.gz external_protobuf-35d9fd84ff1d9ecdb91156b757cc9fdcc3f25249.tar.bz2 |
Add an option to inspect "has" state upon parse.
If has is set, also always serialize.
Change-Id: I2c8450f7ab9e837d722123dd1042991c0258ede3
Diffstat (limited to 'java/README.txt')
-rw-r--r-- | java/README.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/java/README.txt b/java/README.txt index dac2e3c..58ccb88 100644 --- a/java/README.txt +++ b/java/README.txt @@ -301,6 +301,22 @@ message's constructor or clear() function is called, the default value penalty. This is not a problem if the field has no default or is an empty default. +Nano Generator options + +java_nano_generate_has: + If true, generates a public boolean variable has<fieldname> + accompanying the optional or required field (not present for + repeated fields, groups or messages). It is set to false initially + and upon clear(). If parseFrom(...) reads the field from the wire, + it is set to true. This is a way for clients to inspect the "has" + value upon parse. If it is set to true, writeTo(...) will ALWAYS + output that field (even if field value is equal to its + default). + + IMPORTANT: This option costs an extra 4 bytes per primitive field in + the message. Think carefully about whether you really need this. In + many cases reading the default works and determining whether the + field was received over the wire is irrelevant. To use nano protobufs: |