Thanks, that was the missing part, got it working with the desc file,
without the need for the MyMessage class.

on the way with the above code I got error:
java.lang.IllegalArgumentException: ExtensionRegistry.add() must be
provided a default instance when adding an embedded message extension.

Looked in the and saw the if check for the
so for now just added the if check like below:

        for(FieldDescriptor extension : fileDescriptor.getExtensions()) {
                if(extension.getJavaType() != FieldDescriptor.JavaType.MESSAGE)

What is the correct way to do it?

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to