You could treat the protobuf classes as private implemnetation helpers.
Your public interface would have methods like you describe, and internally
they'd just copy the object's state into a protocol buffer and then
On Fri, Mar 27, 2009 at 2:32 AM, Paul Runyan <paul_run...@hotmail.com>wrote:
> Hi Kenton -
> Thanks for your help. Obviously defining message types in proto files is
> crucial for being able to exchange messages between different languages.
> However, as a substitute for Java serialisation having to specify message
> types in separate files from the source files seems less than ideal.
> What I was thinking of was more along the lines of adding methods to each
> object to be serialised via PB that look like the methods on the classes the
> PB compiler generates --- writeTo() and parseFrom(). These would work
> analogously to the way that writeObject() and readObject() for normal
> serialisation, but by trading away the unrestricted polymorhism that this
> type of application doesn't need it allow it to write ints rather than class
> names to distinguish types and would hopefully also gain from the extra
> efficiencies of CodedInputStream and CodedOutputStream.
> Best regards,
> Find car news, reviews and more Looking to change your car this
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at