Hi Itay, I am not aware of a straightforward way, but I can think of two
ways to accomplish that. I've used the first one for testing purposes.

1. Create a new message definition that is identical to the original, but
where the optional field is changed to repeated. Thanks to binary
representation compatibility, all messages that conform to the original
schema, will be accepted by the new schema, and you'll get all the repeated
fields instead of only the last value.
2. If the field is a top level field, you can use CodedInputStream to parse
the bytes and look for a tag number that repeats twice.

-Nadav

On Tue, Nov 10, 2020 at 11:36 PM itay perry <[email protected]>
wrote:

> I understand that using parsefromArray or parseFromString, and the field
> is not duplicated I get only the last value.
> is there a way to get all values, or at least know that multiple values
> were sent ?
>
> 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/a0bed358-3d16-4f28-806c-b2e82091fb21n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/a0bed358-3d16-4f28-806c-b2e82091fb21n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
-Nadav

-- 
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/CANZcNErKvv9Rnkt1sSkxf%2B36tDH5p0uyo%2B4v5U%2Bp2LwmE4ggBA%40mail.gmail.com.

Reply via email to