Re: [protobuf] Getting fields from a generated Dynamic Message

2012-05-15 Thread Jason Hsueh
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
methodhttps://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 vinsalw...@gmail.com 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 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.



-- 
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.



[protobuf] Getting fields from a generated Dynamic Message

2012-05-09 Thread Vinay Bansal
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 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.