[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: finding method efficiently
From: |
Robert Schuster |
Subject: |
Re: finding method efficiently |
Date: |
Tue, 28 Sep 2004 19:54:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.2) Gecko/20040819 |
Thanks for all the replies.
I have rewritten the code that searches the methods using
isAssignableFrom() (and feeling much better about it now).
Archie Cobbs wrote:
For an almost-example, look at Classpath's java.lang.Class.internalGetMethod().
Unfortunately it works exactly like Class.getMethod() which means
finding put(Object, Object) is
not possible when having something else.
So it would be nice if we could write this algorithm once and for all
and make it public somewhere :-)
This may be a nice idea at first but for the XMLDecoder one special
requirement spoils it. The XML
data knows no primitives but wraps them always in their respective
class. When testing whether a given argument
type T can be assigned to a method's parameter type P I have to do
something like this:
if (P.isAssignableFrom(T)) -> good one, check next parameter
else if(T.isPrimitiveWrapperClass() &&
P.isAssignableFrom(getPrimitiveTypeFor(T)) --> good one, check next
parameter
else -> bail out, method signature is unsuitable
This is what it makes IMHO incompatible with a general solution. :-(
cu
Robert
- finding method efficiently, Robert Schuster, 2004/09/27
- Re: finding method efficiently, Tom Tromey, 2004/09/28
- RE: finding method efficiently, David Holmes, 2004/09/28
- Re: finding method efficiently, Tom Tromey, 2004/09/28
- RE: finding method efficiently, David Holmes, 2004/09/28
- Re: finding method efficiently, Archie Cobbs, 2004/09/28
- Re: finding method efficiently, Tom Tromey, 2004/09/28
- Re: finding method efficiently,
Robert Schuster <=
- Re: finding method efficiently, Artur Biesiadowski, 2004/09/28