No official runtimes provide a way to do this. Messages do not have
backlinks to containers if they are nested inside another message.
To do what you are trying to do would require a recursive traversal that
starts at the top (a) and then accumulates the names into a path with each
recursive
Thanks for the answers.
I am using Kotlin.
I will modify my sequence to yield on a pair.
* the current path
* the current object
It should be a minor change.
Currently, the yield is on the current object only.
On Tuesday, November 22, 2022 at 11:16:29 AM UTC-6 thes...@gmail.com wrote:
> Hi
Hi Fred, you haven't mentioned a specific language you use, but in all the
standard implementations I am familiar with (Java, Python, C++) an instance
of a message doesn't hold a reference to its container. The opposite is
true, you can find all the fields if you start working from the root. To
Given a message (b of type B), nested in another (a of type A); how does
one get ‘a’?
I was hoping for something like ‘b.getParent()’.
message B { optional string name = 1; repeated B b = 2; }
message A { optional string name = 1; repeated B b = 1; }
Here is an example instance of an ‘a’ with