cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianugo Rabellino <gian...@gmail.com>
Subject fb:insert-bean & class hierarchies
Date Fri, 07 Jan 2005 10:54:16 GMT
Pardon me if this has been discussed already... I did some quick
search and was unable to find anything relevant.

We are currently being severely bitten by a limitation in the Java
reflection API that hits on fb:insert-bean. If class B extends A, and
you have a method in your binding base such as

void addA(A a)

you cannot bind it using a B instance since Java will complain about
not finding a

void addA(B b)

method.

Now, apart from this being quite silly from the reflection POV, is
there anything we're missing of is that a confirmed limitation? And,
if, so, would anyone here be interested in a fix? I can see three
solutions for that:

1. brute force approach: try to call the method with every possible
superclass of the parameter giving an error;

2. lookup: get all the methods, grab the one that needs to be called,
find out which is the correct superclass to use;

3. insert a "cast" semantic to the binding instruction and then cast
(using a Proxy?) to the correct implementation the class is expecting.

Of course the 4th solution still applies:

4. I'm a moron and I'm overlooking how this has been discussed at
lenght and solved long ago.

Ciao,

-- 
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance: http://www.orixo.com

Mime
View raw message