[jira] [Commented] (PROXY-10) Introducing interfaces for ProxyFactory

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (PROXY-10) Introducing interfaces for ProxyFactory

David Costanzo (Jira)

    [ https://issues.apache.org/jira/browse/PROXY-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459185#comment-13459185 ]

Matt Benson commented on PROXY-10:
----------------------------------

In the 2.0 branch {{ProxyFactory}} is in fact an interface.
               

> Introducing interfaces for ProxyFactory
> ---------------------------------------
>
>                 Key: PROXY-10
>                 URL: https://issues.apache.org/jira/browse/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[] proxyClasses);
>      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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira