From e83bbbbe4213e9b7bcc0529c305b821da8d7a136 Mon Sep 17 00:00:00 2001 From: Ulas Kirazci Date: Mon, 1 Apr 2013 11:29:43 -0700 Subject: Add an option to inspect "has" state upon parse. If has is set, also always serialize. Change-Id: I2c8450f7ab9e837d722123dd1042991c0258ede3 --- java/README.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'java/README.txt') diff --git a/java/README.txt b/java/README.txt index dac2e3c9..58ccb88e 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 + 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: -- cgit v1.2.3