I'm using Protocol Buffers from Google in my Java projects.
When I define message like that:
message Event {
int32 action = 1;
}
and save value zero as an action, then value zero won't be saved. It's able to save all integer values except for zero.
I even found it in my decompiled code generated by Protocol Buffers:
...
public void writeTo(CodedOutputStream output) throws IOException {
if (this.action_ != 0) {
output.writeInt32(1, this.action_);
}
...
}
Do you know, how can I force saving zeros? Or it's not possible and simply forbidden by Protocol Buffers design?