In the C++ API, given a message one can ask for Descriptor()->full_name().  
We use this in a framing header to support multi-typed message stream.
Also in C++, I can do this to recreate the message given its name:

   MessageFactory* factory = MessageFactory::generated_factory();
   const Descriptor *descriptor = DescriptorPool::generated_pool()->
FindMessageTypeByName(messageName);
   Message *message = factory->GetPrototype(descriptor)->New();
   message->ParseFromArray(buffer, size);

However I am struggling to find the equivalent to generated_pool() in Java.
I think I need to do something like this:
Descriptors.FileDescriptor descriptor = // how do I get this?
Builder builder = descriptor.findMessageTypeByName().toProto().
newBuilderForType();
builder.mergeFrom(buffer);
Message message = builder.build();


Please fill in the blank and comment on this approach?

Thanks
john


-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to