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 <
jas...@google.com <mailto:
jas...@google.com>>
>
> 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 <
francoi...@free.fr
> <mailto:
francoi...@free.fr>>