ProtoBuf in the way of [multiple] inheritance

60 views
Skip to first unread message

callatis

unread,
Jul 14, 2011, 10:15:32 PM7/14/11
to prot...@googlegroups.com
I have a use-case where I get an object of a different nature, which I cannot change. I need to serialize this object to the wire as a ProtoBuf object. I have a mirror ProtoBuf object structure, all defined and working fine. However, I currently need to deep-clone my original object into the PB object and then call writeTo() on it, and this deep-cloning is too expensive for my perf goals. Any ideas how I could get around this cloning? I was thinking about customizing the ProtoC code generation to generate the objects as extending my hierarchy (but I don't like the idea of rewriting ProtoC), or to use an external writeTo() that takes my original object (rather than the gen'ed ProtoBuf one), but none of them seem feasible all the way thru...

BTW, I'm using all Java.

Thanks in advance!

Joshua Foster

unread,
Jul 16, 2011, 9:02:11 AM7/16/11
to prot...@googlegroups.com
You may want to look into using protostuff. It already has its own implementation of the proto compiler and it may be a little easier for you to extend for creating customized code.

Joshua
Reply all
Reply to author
Forward
0 new messages