protocol-buffers

Protobuf-3: How to resolve missing method “getIdCase()” ? Classes generated with '--experimental_allow_proto3_optional '

Deadly 提交于 2020-12-13 02:59:16
问题 I used the proto3_optional, and getting this xxCase() method missing on field that are 'optional'. Is there a workaround for this? Generated message class "muni.model.Model$Person" missing method "getId Case " NoSuchMethodException: muni.model.Model$Person.getId Case() Note: I need to retain hasXX() method working for validating objects, and JsonFormat.printer(myproto) for deserializing. Proto object message Person{ //Output only optional string id = 3; // "muni.model.Model$Person" missing