Java – in the new Use the compiled protobuf classes in the proto file
•
Java
I imported a library containing classes generated by protobuf
I want to send this kind of object as part of other protobuf messages But protocol (obviously?) Complaint lack of definition:
Of course I can copy existing from the source code of the library Proto source code, but later I suspected that protoc would generate two versions of this class, which would be very annoying
Any idea how to solve this problem?
Solution
You need to import the existing proto class
import "somepath/existing_protobuf_library_class.proto"
Protocol will not generate additional code, and the generated java code will only import other assumed classes
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码