commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@Elsag-Solutions.com>
Subject RE: [proxy] sfl4j-like discovery for ProxyFactory...
Date Mon, 10 Mar 2008 08:05:07 GMT
Torsten Curdt wrote:
> On 08.03.2008, at 15:25, James Carman wrote:
> 
>> On 3/8/08, Torsten Curdt <tcurdt@apache.org> wrote:
>>> 
>>>  On 08.03.2008, at 13:44, James Carman wrote:
>>> 
>>>> All,
>>>> 
>>>> The wicket folks are investigating using Commons Proxy and they
>>>> don't want to have to decide which implementation (jdk, cglib,
>>>> javassist) to use themselves.  They would like us to split up
>>>> Commons Proxy into 3 jars, commons-proxy, commons-proxy-cglib,
>>>> commons-proxy-javassist. Any thoughts?
>>> 
>>> 
>>> Is the discovery such a big problem with proxy? ...in general I
>>>  prefer the static discovery type. But someone has to do it.
>> 
>> Well, Johan makes a good case.  He's writing some code that he wants
>> to use Proxy, but he doesn't want to have to figure out what
>> implementation to use himself.  He'd rather it be done automatically
>> for him, by doing something like ProxyFactory.getInstance().  I
>> thought about this at one time.  I guess we could say, instantiate
>> your class that's based on Proxy by passing in whatever
>> implementation the client wants.  So, he could have something like:
>> 
>> public class MyFrameworkClass
>> {
>>   public MyFrameworkClass(ProxyFactory proxyFactory)   {
>>     this.proxyFactory = proxyFactory;
>>   }
>> 
>>   public Object createSomeKindOfProxy(SomeArgument arg)   {
>>     return proxyFactory.create...
>>   }
>> }
> 
> Well, one could just try and see what classes are available in the
> classpath. This could be easily be done in a wrapper class as you
> suggested. 

Shrug. And suddenly someone adds a new library that introduces new deps (e.g. Hibernate to
CGLIB). Why not simply use JDK proxy as default and use a system property to override the
default selection? If a project is dependend on a more powerful proxy implementation they
have to select one themselves or document this fact for their users (e.g. they have to use
CGLIB- or JavaAssist-based proxies).

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message