You should have the message type's Descriptors.Descriptor in order to have gotten a DynamicMessage in the first place. That class is the equivalent of the C++ Descriptor class and has a findFieldByName method<https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Descriptors.Descriptor.html#findFieldByName(java.lang.String)> .
On Wed, May 9, 2012 at 3:44 PM, Vinay Bansal <[email protected]> wrote: > Hey, > > I have generated DynamicMessage from available FileDescriptorSet, now > I want to be able to get fields from this message. Based on the > typename I know what kind of message this is, but I don't know how to > get the value of any particular field. > > Available getter functions available in java library like > getField(Descriptors.FieldDescriptor field) need a FieldDescriptor for > the field, which I don't know how to generate. In C++ library there is > a func called FindFieldByName(String) which returns the corresponding > FieldDescriptor but I couldn't find a similar function for java > library. > > Please help > > -- > 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. > > -- 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.
