I solved the problem by passing in a list of MapEntry. For instantiating MapEntry, use descriptor from the map field.
On Monday, June 8, 2020 at 5:05:40 PM UTC+8, Jin Sun wrote: > > I have a map<string, string> field in a message. When I try to use > setField(Descriptors.FieldDescriptor field, Object value) API on > Message.Builder and pass in a descriptor with a Java map, it complains map > cannot be converted to a list. > I want to replace the existing map with the new map. Just wondering what > should I pass in for value argument. > Thanks. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/0b80278f-7b6f-4cd4-bb47-ce0514571a97o%40googlegroups.com.
