[protobuf] how to createmessage by messagename

2012-09-10 Thread qtom zheng
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

Re: [protobuf] how to createmessage by messagename

2012-09-10 Thread Jason Hsueh
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