Re: list member containing sub classes

2009-08-05 Thread Kenton Varda
Why do your protocol message types have to map 1:1 with your legacy classes? Generally, attempting to map inheritance onto Protocol Buffers doesn't work very well. You are right that you can use extensions, but unless you have a large number of subclasses of OParameter, this isn't helpful. If the

Re: list member containing sub classes

2009-08-05 Thread Tai
Hi Kenton, Sorry the parameter classes are legacy code and persisted to the DB as well. So I have to figure out what's the best approach defining my proto classes. What I see is that there is the way of using extensions in the proto files. As far as I understand it is an extension of members (an

Re: list member containing sub classes

2009-08-04 Thread Kenton Varda
Can you just have the OParameter message contain optional fields of type string and int64, where only one of the two is ever set? Then don't have specific types corresponding to OStringParameter and OLongParameter. On Tue, Aug 4, 2009 at 5:07 PM, Tai wrote: > > Hi, > > I have an (abstract) clas

list member containing sub classes

2009-08-04 Thread Tai
Hi, I have an (abstract) class: - OParameter with a member String key Now there are also two subclasses of OParameter: - OStringParameter with a member String value - OLongParameter with a member long value By using Protocol Buffers I define the proto files: - OParameterMessage.proto - OStringP