You can't use the same field descriptors for the four classes. But, note
that one thing you *can* do is define a "base" type that just contains the
shared fields, and then parse any of the other types as this type in order
to access the common fields. Since the field numbers match, they are
compa
I thought about these options and settled on multiple classes that all
share a few fields. So indeed duplicate every shared field.
On Jan 28, 2:28 pm, TJ Rothwell wrote:
> Is there a best practice for this use case?
>
> Here are some options.
>
> // Duplicate every field (sounds like you're doing
i have dozens of message classes that all have exactly the same first
few fields (the first 4 to be precise). And prototypes for all my
message classes are loaded by introspection. So all the prototypes are
simply of class Message and i need to use FieldDescriptors to get/set
fields on messages. He