Uploaded image for project: 'Commons Proxy'
  1. Commons Proxy
  2. PROXY-10

Introducing interfaces for ProxyFactory

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.0
    • 2.0
    • None

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            brmspies Brennan Spies
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment