1. I'm compiling valid .proto file into .desc file
2. The original proto file contains few message declarations with dozen
fields per message.
I have to read from JVM code the list of allowed fields per message, I do
it via Scala:
val uri = this.getClass.getClassLoader.getResource("protoDescFile.desc").toURI
val data = Files.readAllBytes(Paths.get(uri))
val descriptorProto: DescriptorProtos.FileDescriptorProto =
DescriptorProtos.FileDescriptorProto.parseFrom(data)
val descriptor: Descriptors.FileDescriptor =
Descriptors.FileDescriptor.buildFrom(descriptorProto, Array.empty)
the code builds well descriptor - but when I call the
descriptor.getMessageTypes.size()
it always returns 0 - despite the expected value is 3
Apparently all the fields are empty including
descriptor.getPackage
that is set to
package com.prototest.pacakge;
but the only one field in descriptor aren't empty :
descriptor.getSyntax
descriptor.getName
getName returns me the full String representation of data(byte[]) were
passed to FileDescriptorProto.parseFrom during it's initialization.
What is the way to get the list of available messages and the get the list
of fields per message?
Stas
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.