【发布时间】:2022-10-18 15:01:10
【问题描述】:
我有一个名为“key”的字段,类型为google.protobuf.Any。我知道这是一个字符串,所以我想使用unpack() 方法“转换”它。
然而,当我写request.getKey().unpack(String.class) 时,我得到一个编译错误:
Required type: Class<T>
Provided: Class<String>
reason: no instance(s) of type variable(s) exist so that String conforms to Message
我真的不明白这到底是什么意思。
这是我的原型文件:
message SearchCriteria{
google.protobuf.Any key = 1;
string storeName = 2;
}
【问题讨论】:
标签: java protocol-buffers grpc-java