have to create java pojo for the existing proto includes Map
I have tried converting proto to java pojo . But got the error
[Stderr] Order.proto:12:18: Expected "required", "optional", or "repeated". [Stderr] Order.proto:12:21: Expected field name.
optional int32 orderID = 1;
optional int32 quantity = 2;
map<string,string> map_field = 4;
repeated string product = 3;
Please help me what needs to be changed. i searched on google protobuf developer site https://developers.google.com/protocol-buffers/docs/proto#maps It says that Map fields cannot be repeated, optional, or required
Please help me to resolve the issue.
Maps are a new feature in protobuf 3.0 (aka "proto3"), which is still in alpha. You are probably using 2.x, in which case there are no maps. Your best bet is to use a repeated field:
repeated MyMap map_field = 4;
message MyMap {
optional string key = 1;
optional string value = 2;
}
链接地址: http://www.djcxy.com/p/64788.html
上一篇: Windows中的Protoc错误