commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lambrou <>
Subject Re: [collections] InvokerClosure
Date Thu, 02 Dec 2004 21:47:47 GMT
Emmanuel Bourg wrote:

> Also the Class[] and Object[] are quite cumbersome, that would be nice 
> to add methods/constructors to invoke simple methods with only one or 
> two parameters. Thus my example could look like this:
> CollectionUtils.forAllDo(configList, new 
> InvokerClosure("clearProperty", String.class, key));
> which is much more readable.
> What do you think ?

I think that we could go further.  How about being able to write the 

new InvokerClosure("clearProperty", key);

Since we've already sacrificed type-safety and runtime performance by 
using reflection, why not go a little further with this and use some 
algorithm to infer the most appropriate method to invoke at runtime. If 
there's ambiguity over which method to invoke at runtime, just have the 
InvokerClosure throw a FunctorException.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message