Open GoogleCodeExporter opened 9 years ago
Of course, the deserializing equivalent:
/**
* Merges the {@code message} with the {@code ByteString} using the given {@code schema}.
*/
public static <T> void mergeFrom(ByteString data, T message, Schema<T> schema)
{
IOUtil.mergeFrom(data.getBytes(), 0, data.size(), message, schema, false);
}
Original comment by icruz...@gmail.com
on 2 Jan 2012 at 4:40
Was your messages generated by java_bean? (I can add an option for it to have
byte[] fields instead)
or do you prefer working with ByteString instead of byte[]?
The problem with adding that is, I have to add it to every single $FormatIOUtil
w/c adds unnecessary stuff for others (the api is uniform for all formats).
What I suggest doing is to create a utility class in the package of the
package-private stuff, and use it for my customization/optimization needs.
I do that all the time with other libs.
That is the precise reason why I left them package-private so that they can
still be accessed by 3rd-party devs who know what they're doing.
Original comment by david.yu...@gmail.com
on 3 Jan 2012 at 2:17
Yes, I'm using java_bean. An option to use byte[] fields would work too.
I can use an utility class in your package as well... A better option would be
to extend some classes, but almost all of them are final.
Finally, what are your thoughts on implementing equals/hashcode in the
generated beans? (probably worth another ticket though)
Original comment by icruz...@gmail.com
on 3 Jan 2012 at 9:19
All good points. When I've time, I'll try to add a compiler option to use
byte[] and generate equals/hashcode (feel free to create an issue for that).
Have you tried extending the java_bean template to generate your pojos?
You can checkout the wiki on howto, and here's a sample snip:
http://groups.google.com/group/protostuff/browse_thread/thread/30bf61334f559878/
c17bd69a849f8e69?q=#1007bae44786f114
If you're adding extra functionality and would like to make it a compiler
option for java_bean, I'll be glad to add it if it makes sense.
Original comment by david.yu...@gmail.com
on 3 Jan 2012 at 12:05
Original issue reported on code.google.com by
icruz...@gmail.com
on 2 Jan 2012 at 2:17