映射键值的集合

时间:2020-07-16 05:47:13

标签: java collections protocol-buffers grpc

我正在使用protobuf,在其中一个模型中,结构是这样的-

public class Model{
   int id;
   Map<Integer,Collection<Details>> details;
}

相应的原始消息-

message ModelMsg{
     sint32 id;
     map<sint32,DetailsMsg> details;
}

如何以protobuf格式表示上述模型? 我看到protobufs中有“地图”结构-https://developers.google.com/protocol-buffers/docs/proto#maps

但是它支持键值的收集吗? 如果我必须支持protobuf格式的此类值收集,有什么解决方案吗?

0 个答案:

没有答案