[protobuf] Re: Serialization of primitive types
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 complicated.) 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? Thanks, 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 protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Re: Serialization of primitive types
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: http://code.google.com/p/protostuff/ I think it has all that is needed to achieve the goals Gabor is looking for. --Chris 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 complicated.) 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? Thanks, 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 protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- Chris -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Issue 296 in protobuf: Deploy protobuf-java 2.4.1 JAR to Maven Repository
Comment #9 on issue 296 by jhuxh...@googlemail.com: Deploy protobuf-java 2.4.1 JAR to Maven Repository http://code.google.com/p/protobuf/issues/detail?id=296 Any news on this issue? The currently available version in the central maven repository is 2.4.0a. I couldn't find any information about this specific release, i.e. the 0a, in http://protobuf.googlecode.com/svn/trunk/CHANGES.txt This version is still Java6-only, right? -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Maps in protobuf / 2
HI all sorry i hijacked a previous thread .. Is it possibel to define Maps in protobuff? i have some serverside code which returns a MapString, Double, and i was wondering if there was a way in protobuf to define a Map could anyone help ? w/kindest regards marco -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Maps in protobuf / 2
Haven't found a direct way to create a map, but, we use the following to serialize map like data structures. - message KeyValue{ required string key = 1; required string value = 2; } message Map { repeated KeyValue items = 1; } message Foo { required string id = 1; optional Map map = 2; } Alok On 06/16/2011 01:26 PM, Marco Mistroni wrote: HI all sorry i hijacked a previous thread .. Is it possibel to define Maps in protobuff? i have some serverside code which returns a MapString, Double, and i was wondering if there was a way in protobuf to define a Map could anyone help ? w/kindest regards marco -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.