You would need to list out all the message types you want to use, and
maintain a map from their Descriptor to their default instance (accessible
with getDefaultInstance()). You can then call newBuilder or other
construction methods.

If you are ok with using a dynamic rather than generated message
implementation, you can use the DynamicMessage class.


On Sun, Sep 2, 2012 at 2:40 AM, qtom zheng <zhfnj...@gmail.com> wrote:

> public static Message createMessage(String messageName) {
>   FileDescriptor dps = Addressbook.getDescriptor();
>
  System.out.println(dps.getPackage());
>  Descriptor dp = dps.findMessageTypeByName(messageName);
>
>                 .......
>  return null;
>
> }
>
>
> by the messageName   I have got the Descriptor dp;
> then i want to generated message by Descriptor dp;
> but i don't know how to do, any one can tell me?
>
> thanks!!!
>
> --
> 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/-/sPMJ6uPundUJ.
> 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.

Reply via email to