On one machine, serialized a Message2, which has been extended from
Message1.

The parameters in Mesage2 were set using setExtension API. Did
writeDelimitedTo to write to a byte outpurstream.

Then ran protoc --include_imports --descriptor_set_out=message2.desc --
java_out=message2.proto

On the other machine:

Got the .desc file here, create a inputstream from it.

DescriptorProtos.FileDescriptorSet fileDescriptorSet =
DescriptorProtos.FileDescriptorSet.parseFrom(inputStream);

Created a descripter map and created the dynamic message:
DynamicMessage dynamicMessage = DynamicMessage.parseFrom(descriptor,
message);

when trying to print

System.out.println(" allFields.size =
"+dynamicMessage.getAllFields().size()); System.out.println("
unknownFields.tostring = "+dynamicMessage.getUnknownFields());

The fields in the Message2 are coming as the unknown fields, tried to
provide the extension registry, but not sure how to do that.

How can we dynamically parse the names and values of the fields in the
extended message2, with the .desc file. or is there other way to do
this?

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