ProtocolBuffers and existing classes

917 views
Skip to first unread message

Marco@worldcorp

unread,
Jan 25, 2011, 9:39:42 AM1/25/11
to Protocol Buffers
Hello
i was wondering if protobuffer supports having an already existing
class embedded in the message.
What i mean: from example i have seen, use writes a .proto buffer and
protobuffer generates all related java classes.

However, i have already existing classe which i'd like to embed in
a .proto file.

Is that supported?

I guess if protobuffer generates interfaces, i can get away with it
and 'rewrite' my code .. but if it has the functionality to use
existing classes, that would be appreciated

any constraints on existing classes? i guess they all have to
implement Serializable

thanks and regarsd
marco

Jason Hsueh

unread,
Jan 25, 2011, 8:00:07 PM1/25/11
to Marco@worldcorp, Protocol Buffers
No, you cannot refer to arbitrary classes. Doing so would be difficult to support across languages, and significantly complicates features like reflection.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.


David Yu

unread,
Jan 25, 2011, 9:47:45 PM1/25/11
to Marco@worldcorp, Protocol Buffers
Have you looked at http://code.google.com/p/protostuff?
It allows you to skip all the code generation and simply use your existing classes (support for cyclic references too)

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.




--
When the cat is away, the mouse is alone.
- David Yu
Reply all
Reply to author
Forward
0 new messages