On 12/09/2009 09:00 PM, Kenton Varda wrote: > Actually I don't think we need DescriptorPool in Java. DescriptorPool > was primarily written for the purpose of memory management, but Java > handles that for us. If all you need is the mapping aspect, just build > a Map<String, ServiceDescriptor> yourself and use it.
This is close to what I do now. Next question is : can I get hold of the java class that is associated with a Descriptor. From the service descriptor, I can get to the MethodDescriptor I am interested in, and then I can get the Descriptor of the input type of the method, but at that point I would like to create a builder for the input message. Should I also maintain a Map<String,Descriptor> One thing I thought of would be to go back to the file descriptor associated with the input message type descriptor, check the two java options, and use java reflection. would this work ? It is a shame the java class name is not the same as the message type full name. > True, in C++ there is the "global pool" which is automatically populated > with everything compiled into the binary. This wouldn't work in Java > because classes are not loaded until they are first accessed, so there > is no way to populate this pool. Besides, singletons are evil. I > honestly wish that I'd never introduced the global pool in C++; it has > lead to too many subtle singleton problems. > > 2009/12/9 Jason Hsueh <[email protected] <mailto:[email protected]>> > > No, there isn't an equivalent to the DescriptorPool in Java. If you > know the types that you want you can build a mapping yourself. Or if > you'd be interested in porting the C++ DescriptorPool to java that > would be great! > > 2009/12/9 Romain François <[email protected] > <mailto:[email protected]>> > > Hello, > > Given a service/method full name, I'd like to get hold of the > ServiceDescriptor, or MethodDescriptor. In C++ I would use the > DescriptorPool, but I don't see this in the java api. > > Is there a way ? > > Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/Gq7i : ohloh |- http://tr.im/FtUu : new package : highlight `- http://tr.im/EAD5 : LondonR slides -- 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.
