I think Gabor wants to avoid the overhead of implementing all that
additional bookkeeping as it'd slow down development. Something that
would effectively generate a protobuf descriptor so that it'd stay
consistent with changes in the Java code.
I would suggest looking at the protostuff project:
I think it has all that is needed to achieve the goals Gabor is looking for.
2011/6/16 Miguel Muñoz <swingguy1...@yahoo.com>:
> I agree with Marc. When things get complicated, it's a good idea to
> separate your tasks. It seems like your java class, which generates
> some of the data based on other data, is one issue, and your
> serialization is a separate issue. (I know it would be nice to just
> make that class serializable, but that may be where you make things
> When I want to serialize my classes with protobufs, I create a
> separate protobuf object to just handle serialization. Then I create a
> utility class that transfers data between my protobuf object and my
> java class. Then it's easy to add a constructor to my java class that
> takes a protobuf object and defers the work to the utility class.
> When I transfer data using protobufs, I don't convert to the protobuf
> format until the last possible moment before sending, and I
> immediately convert to the java class on receiving data. That lets me
> put my protobuf objects behind a facade, so I don't need to know the
> serialization details.
> -- Miguel Muñoz
> On Jun 15, 7:07 am, "gabor.dicso" <gabor.di...@gmail.com> wrote:
>> Hi all,
>> I would like to be able to serialize primitive types platform-
>> independently. I have hand-written Java data classes and I want to
>> serialize their primitive fields using a cross-platform framework.
>> These classes can not be generated, they must be written by hand,
>> additional code is generated based upon them. Also, serializing the
>> object as a whole isn't an option either, because the fields sometimes
>> have to be processed before serializing their values. I have to
>> serialize the fields separately. It must be made cross-platform
>> because the values will be stored in a database and they may be read
>> from other platforms. Creating wrapper PB-objects for each primitive
>> type is an overhead I must avoid because the operation will be done
>> very frequently and with large amounts of data.
>> I found that Protocol Buffers addresses cross-platform serialization
>> of objects, but I could not figure out how to use it as a
>> serialization framework for primitive types (without having
>> created .proto descriptors). Is it possible to use PB as a cross-
>> platform serializer-deserializer framework for primitive types?
>> Gabor Dicso
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to email@example.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
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