commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brennan Spies (JIRA)" <>
Subject [jira] Created: (PROXY-10) Introducing interfaces for ProxyFactory
Date Fri, 07 Mar 2008 05:41:02 GMT
Introducing interfaces for ProxyFactory

                 Key: PROXY-10
             Project: Commons Proxy
          Issue Type: Improvement
    Affects Versions: 1.0
            Reporter: Brennan Spies
            Priority: Minor

As per my conversation with James Carman, I am creating an enhancement request for Apache
Commons Proxy (any version).

I think that forcing all proxy factories to extend a concrete implementation, ProxyFactory,
is not an optimal design choice. The obvious disadvantages are that all subclasses would inherit
shared state, as well as potentially undesired behavior. Extending a concrete class also makes
it much easier to break subclasses if ProxyFactory code changes.

Given that the public API of this class could change, I am proposing that 3 new interfaces
be introduced: DelegatorProxyFactory, InterceptorProxyFactory, and InvokerProxyFactory. This
would give flexibility to add new interfaces to the library (to define new proxy types) without
necessarily having to change existing interfaces and break potential implementations in "the
wild". Existing implementations would, of course, implement all three interfaces.

public interface DelegatorProxyFactory {
     public Object createDelegatorProxy(ObjectProvider delegateProvider, Class[] proxyClasses)
     public Object createDelegatorProxy(ClassLoader classLoader, ObjectProvider delegateProvider,
Class[] proxyClasses) ; 

public interface InterceptorProxyFactory {
     public Object createInterceptorProxy(Object target, Interceptor interceptor, Class[]
     public Object createInterceptorProxy(ClassLoader classLoader, Object target, Interceptor
interceptor, Class[] proxyClasses) ;

public interface InvokerProxyFactory {
     public Object createInvokerProxy(ClassLoader classLoader, Invoker invoker, Class[] proxyClasses)
     public Object createInvokerProxy(Invoker invoker, Class[] proxyClasses) ;

Depending on the timing of the move to Java 5 (version 2.0?), a type-safe genericized method
could be introduced with a non-array Class parameter.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message