Thanks for the quick answer! :)

Cheers,
Trustin

On Dec 2, 3:33 pm, Kenton Varda <[EMAIL PROTECTED]> wrote:
> An instance of a message can be used like a factory:
>
> Message prototype = Person.getDefaultInstance();
> Message message = prototype.newBuilderForType().mergeFrom(data).build();
> It doesn't have the generics-based type-safety, though.
>
> On Mon, Dec 1, 2008 at 10:11 PM, Trustin Lee <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm currently trying to integrate protobuf into Netty -
> >http://www.jboss.org/netty/
> > I took a look into the Javadoc, but I couldn't find a clearly
> > documented way to get a parser for a certain message type.
>
> > For example, let's say that I have generated a Java message type
> > 'Person' from a .proto file.  I can convert it into a byte array by
> > calling Message.toByteArray(), because the generated class 'Person'
> > implements Message.  In contrast, I can't find a way to call parseFrom
> > () without using Java reflection API.  It would be nice if I can do
> > something like this:
>
> >    Parser<Person> p = ParserFactory.getParser(Person.class);
> >    Person person = p.parseFrom(...);
>
> > Is this feature already available?  Or, at least it would be nice if I
> > can reduce the usage of reflection API.  For example, I could get the
> > parser using the reflection API and keep its reference.
>
> > Thanks in advance,
> > Trustin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to