No, default values for a message are not supported. Field defaults must be defined directly within the enclosing message - otherwise you'd need different versions of the generated class depending on the context.
On Sun, Sep 16, 2012 at 9:50 PM, JP <[email protected]> wrote: > Hi Everyone, > I have looked around the documentation. But I could not find anything > that implies If I can specify a set of default values for a message if all > its fields are optional. As an example > > message Class { > optional uint32 aaa; > optional uint32 bbb; > optional uint32 ccc; > } > > message Instance { > message Class instance1 [default.aaa=11; default.bbb=22; > default.ccc=33] > message Class instance2 [default.aaa=77; default.bbb=88; > default.ccc=99] > } > > Here I want to treat the "message Class" as a template/Class for > declaring default values for each instance of the template. > If it is not possible to declare default values like above, can anyone > please suggest a way to achieve the same. > > > Hope I am clear in my explanation. > Thanks in advance. > JP > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/protobuf/-/mPFhrqDiCrQJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
