Hm. Can you send the code snippet you are using to try to access your custom option? You should just be accessing the options proto from FieldDescriptor::options(), and calling GetExtension() on that.
Also, UnknownFields doesn't have anything to do with options extensions. Did you mean UninterpretedOptions instead? UnknownFields store data that exists in the serialization that the message definition doesn't know what to do with. FieldOptions don't exist in the serialization - they're just properties of the message definition. On Mon, Jun 7, 2010 at 5:40 AM, Constanine Verutin <[email protected]>wrote: > Hello, > > I'm curious is there any way to access extension fields for > FieldOptions(or MessageOptions) in DynamicMessage? > > i.e. > > We define message and option, like this: > > extend google.protobuf.FieldOptions { > optional string my_opt = 50001; > } > > message MyMessage { > required string my_field [(my_opt) = "opt"]; > } > > Then we load this .proto in runtime via Importer, get the Message > object from DynamicMessageFactory, then parse encoded message. Now, > using Reflection/Descriptor I want to get all options for > my_field(including extensions), but only standard options are > accessible, all extensions go to UnknownFields, so I can get only > their values but not names. My question: is there any way to get all > options(with extensions) of field/message, if message/option > definitions were loaded in runtime? > > -- > 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]<protobuf%[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.
