Thanks! for some reason i didnt see mention of that method on the general protobuffer guide.
On Mar 14, 5:04 pm, Jason Hsueh <jas...@google.com> wrote: > On Mon, Mar 14, 2011 at 1:12 PM, steph <preston....@gmail.com> wrote: > > given the following: > > > message ClassA { > > required int value1 = 1; > > required int value2 = 2; > > optional ClassB value3 = 3; > > } > > > message ClassB { > > required int value1 = 1; > > required int value2 = 2; > > } > > > It states in the googleprotocol guide that an optional parameter is > > given a default value if it is not set, if it is a primative type it > > is that primitive types default state. However it does not specify > > what is the default state of a custom message. > > > So my question is in my code I want to be able to tell if the my > > ClassA object had value3 set or not. Will it be set to null? > > No, getting value3 will return an instance of ClassB in its default state. > To determine if value3 has been explicitly set, use has_value3(). > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Protocol Buffers" group. > > To post to this group, send email to protobuf@googlegroups.com. > > To unsubscribe from this group, send email to > > protobuf+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text - > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.