I have a class I'd like to submit to the protocol buffer code base.
It's a class called GeneratedMessageParser, and it parses messages
from generic parameters. Here's why:
I have a glass called MessageTranceiver<M extends Message>. This class
needs to call the parseFrom() method of whatever message we specify
when we instantiate the class. But if you have this instance:
you can't say this:
because you don't have an instance of message, and you can't say
M.parseFrom(buf) either, because it's a static message. So I wrote
my parser class, which lets me say this:
= new GeneratedMessageParser(Requests.LoginRequest.class);
message = parser.parseFrom(buf);
I've used protocol buffers on two projects, and this parser class has
been useful to both, so others may find it useful as well. It has
static methods that parallel all the standard parse methods, with
exactly the same signatures, including the declared exceptions. If
you'd like to see it, where do I send it?
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at