commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Cowan <>
Subject Re: [proxy] Proxy & Generics...
Date Mon, 07 Apr 2008 18:33:36 GMT
Hi James,

James Carman wrote:
> public Object createDelegatorProxy( ObjectProvider delegateProvider,
> Class... proxyClasses );
> However, I also want to add in a nice helper method like this:
> public <T> T createDelegatorProxy( ObjectProvider<T> delegateProvider,
> Class<T> proxyClass );

I'm not overly familiar with proxy, but will this work?

public <T> T createDelegatorProxy(ObjectProvider<T> delegateProvider, 
Class<T> primaryProxyClass, Class... otherProxyClasses);

That combines the generic version and the non-generic version into one 
method, with generics for people who pass one Class and beyond that no 
generics are used. It's not QUITE the same as your two methods... 
firstly you have to commit to passing an ObjectProvider of the same <T> 
type as the first class (which may make for a confusing API? not sure) 
and it also means you HAVE to pass at least one proxy class, you can't 
just call
which your varargs methods let you do. I don't know if that's a good 
thing or a bad thing in this case?

Just an idea, anyway.



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

View raw message