[protobuf] how make an DynamicMessage to known message?
i do like following, and id does success; ListFieldDescriptor fieldlist = dynamicmsg.getDescriptorForType().getFields(); Protocal.Builder buildermsg = Protocal.newBuilder(); for(FieldDescriptor fieldDp : fieldlist){ buildermsg.setField(fieldDp, dynamicmsg .getField(fieldDp)); } Protocal head = buildermsg.build(); -- 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/-/tIhWP_d4DiMJ. 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] how to createmessage by messagename
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.