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
- OStringParameterMessage.proto
- OLongParameterMessage.proto

The files are independent from each other (no extension is used). As
far as I understand this is how Protocol Buffers should be used. All
classes (OParameter, OStringParameter and OLongParameter) then
implements the writeObject() and readObject() and each class just uses
their Protocol message and sets their members. Like:
- Class OStringParameter.writeObject() builds a message and sets only
its member (value)
- The superclass OParameter.writeObject() builds a message and sets
only its member (key)

The same goes for the readObject().

Okay. So far so good. But now I have a class called OListParameter and
its member (value) is a list of OParameter containing instances of
both types: OStringParameter and OLongParameter.

How do I describe this in a proto file?

Thanks Tai
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to