commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r278781 - in /jakarta/commons/sandbox/proxy/trunk/src: java/org/apache/commons/proxy/ java/org/apache/commons/proxy/factory/cglib/ java/org/apache/commons/proxy/factory/javassist/ java/org/apache/commons/proxy/factory/reflect/ java/org/apac...
Date Mon, 05 Sep 2005 15:39:11 GMT
Author: jcarman
Date: Mon Sep  5 08:39:02 2005
New Revision: 278781

URL: http://svn.apache.org/viewcvs?rev=278781&view=rev
Log:
Implementing subclass proxy support.

Added:
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java   (with props)
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java   (with props)
Modified:
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyUtils.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyClassGenerator.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -39,66 +39,77 @@
      * generated using the current thread's "context class loader."
      *
      * @param delegateProvider the delegate provider
-     * @param proxyInterfaces  the interfaces that the proxy should implement
+     * @param proxyClasses     the interfaces that the proxy should implement
      * @return a proxy which delegates to the object provided by the target object provider
      */
-    public Object createDelegatorProxy( ObjectProvider delegateProvider, Class... proxyInterfaces );
+    public Object createDelegatorProxy( ObjectProvider delegateProvider, Class... proxyClasses );
 
     /**
      * Creates a proxy which delegates to the object provided by <code>delegateProvider</code>.
      *
      * @param classLoader      the class loader to use when generating the proxy
      * @param delegateProvider the delegate provider
-     * @param proxyInterfaces  the interfaces that the proxy should implement
+     * @param proxyClasses     the interfaces that the proxy should implement
      * @return a proxy which delegates to the object provided by the target <code>delegateProvider>
      */
     public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider delegateProvider,
-                                        Class... proxyInterfaces );
+                                        Class... proxyClasses );
 
     /**
      * Creates a proxy which passes through a {@link MethodInterceptor method interceptor} before eventually reaching
      * the <code>target</code> object.  The proxy will be generated using the current thread's "context class loader."
      *
-     * @param target          the target object
-     * @param interceptor     the method interceptor
-     * @param proxyInterfaces the interfaces that the proxy should implement
+     * @param target       the target object
+     * @param interceptor  the method interceptor
+     * @param proxyClasses the interfaces that the proxy should implement
      * @return a proxy which passes through a {@link MethodInterceptor method interceptor} before eventually reaching
      *         the <code>target</code> object.
      */
-    public Object createInterceptorProxy( Object target, MethodInterceptor interceptor, Class... proxyInterfaces );
+    public Object createInterceptorProxy( Object target, MethodInterceptor interceptor, Class... proxyClasses );
+
     /**
      * Creates a proxy which passes through a {@link org.aopalliance.intercept.MethodInterceptor method interceptor}
      * before eventually reaching the <code>target</code> object.
      *
-     * @param classLoader     the class loader to use when generating the proxy
-     * @param target          the target object
-     * @param interceptor     the method interceptor
-     * @param proxyInterfaces the interfaces that the proxy should implement.
+     * @param classLoader  the class loader to use when generating the proxy
+     * @param target       the target object
+     * @param interceptor  the method interceptor
+     * @param proxyClasses the interfaces that the proxy should implement.
      * @return a proxy which passes through a {@link org.aopalliance.intercept.MethodInterceptor method interceptor}
      *         before eventually reaching the <code>target</code> object.
      */
     public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor,
-                                          Class... proxyInterfaces );
+                                          Class... proxyClasses );
 
     /**
      * Creates a proxy which uses the provided {@link InvocationHandler} to handle all method invocations.  The proxy
      * will be generated using the current thread's "context class loader."
      *
      * @param invocationHandler the invocation handler
-     * @param proxyInterfaces   the interfaces that the proxy should implement
+     * @param proxyClasses      the interfaces that the proxy should implement
      * @return a proxy which uses the provided {@link InvocationHandler} to handle all method invocations
      */
-    public Object createInvocationHandlerProxy( InvocationHandler invocationHandler, Class... proxyInterfaces );
+    public Object createInvocationHandlerProxy( InvocationHandler invocationHandler, Class... proxyClasses );
 
     /**
      * Creates a proxy which uses the provided {@link InvocationHandler} to handle all method invocations.
      *
      * @param classLoader       the class loader to use when generating the proxy
      * @param invocationHandler the invocation handler
-     * @param proxyInterfaces   the interfaces that the proxy should implement
+     * @param proxyClasses      the interfaces that the proxy should implement
      * @return a proxy which uses the provided {@link InvocationHandler} to handle all method invocations
      */
     public Object createInvocationHandlerProxy( ClassLoader classLoader, InvocationHandler invocationHandler,
-                                                Class... proxyInterfaces );
+                                                Class... proxyClasses );
+
+    /**
+     * Returns true if this proxy factory can generate a proxy class which extends/implements
+     * the <code>proxyClasses</code>.
+     *
+     * @param proxyClasses the desired proxy classes
+     * @return true if this proxy factory can generate a proxy class which extends/implements
+     *         the <code>proxyClasses</code>.
+     */
+    public boolean canProxy( Class... proxyClasses );
 }
 

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyUtils.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyUtils.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/ProxyUtils.java Mon Sep  5 08:39:02 2005
@@ -25,25 +25,25 @@
 public class ProxyUtils
 {
     /**
-     * Creates a "null object" which implements the <code>proxyInterfaces</code>.
+     * Creates a "null object" which implements the <code>proxyClasses</code>.
      * @param proxyFactory the proxy factory to be used to create the proxy object
-     * @param proxyInterfaces the proxy interfaces
-     * @return a "null object" which implements the <code>proxyInterfaces</code>.
+     * @param proxyClasses the proxy interfaces
+     * @return a "null object" which implements the <code>proxyClasses</code>.
      */
-    public static Object createNullObject( ProxyFactory proxyFactory, Class... proxyInterfaces )
+    public static Object createNullObject( ProxyFactory proxyFactory, Class... proxyClasses )
     {
-        return proxyFactory.createInvocationHandlerProxy( new NullInvocationHandler(), proxyInterfaces );
+        return proxyFactory.createInvocationHandlerProxy( new NullInvocationHandler(), proxyClasses );
     }
 
     /**
-     * Creates a "null object" which implements the <code>proxyInterfaces</code>.
+     * Creates a "null object" which implements the <code>proxyClasses</code>.
      * @param proxyFactory the proxy factory to be used to create the proxy object
      * @param classLoader the class loader to be used by the proxy factory to create the proxy object
-     * @param proxyInterfaces the proxy interfaces
-     * @return a "null object" which implements the <code>proxyInterfaces</code>.
+     * @param proxyClasses the proxy interfaces
+     * @return a "null object" which implements the <code>proxyClasses</code>.
      */
-    public static Object createNullObject( ProxyFactory proxyFactory, ClassLoader classLoader, Class... proxyInterfaces )
+    public static Object createNullObject( ProxyFactory proxyFactory, ClassLoader classLoader, Class... proxyClasses )
     {
-        return proxyFactory.createInvocationHandlerProxy( classLoader, new NullInvocationHandler(), proxyInterfaces );
+        return proxyFactory.createInvocationHandlerProxy( classLoader, new NullInvocationHandler(), proxyClasses );
     }
 }

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -22,7 +22,7 @@
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
 import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.factory.util.AbstractProxyFactory;
+import org.apache.commons.proxy.factory.util.AbstractSubclassingProxyFactory;
 
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.InvocationHandler;
@@ -35,38 +35,41 @@
  * @author James Carman
  * @version 1.0
  */
-public class CglibProxyFactory extends AbstractProxyFactory
+public class CglibProxyFactory extends AbstractSubclassingProxyFactory
 {
 //----------------------------------------------------------------------------------------------------------------------
 // ProxyFactory Implementation
 //----------------------------------------------------------------------------------------------------------------------
 
     public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider targetProvider,
-                                        Class... proxyInterfaces )
+                                        Class... proxyClasses )
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader( classLoader );
-        enhancer.setInterfaces( proxyInterfaces );
+        enhancer.setInterfaces( toInterfaces( proxyClasses ) );
+        enhancer.setSuperclass( getSuperclass( proxyClasses ) );
         enhancer.setCallback( new ObjectProviderDispatcher( targetProvider ) );
         return enhancer.create();
     }
 
     public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor,
-                                          Class... proxyInterfaces )
+                                          Class... proxyClasses )
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader( classLoader );
-        enhancer.setInterfaces( proxyInterfaces );
+        enhancer.setInterfaces( toInterfaces( proxyClasses ) );
+        enhancer.setSuperclass( getSuperclass( proxyClasses ) );
         enhancer.setCallback( new InterceptorBridge( target, interceptor ) );
         return enhancer.create();
     }
 
     public Object createInvocationHandlerProxy( ClassLoader classLoader, InvocationHandler invocationHandler,
-                                                Class... proxyInterfaces )
+                                                Class... proxyClasses )
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader( classLoader );
-        enhancer.setInterfaces( proxyInterfaces );
+        enhancer.setInterfaces( toInterfaces( proxyClasses ) );
+        enhancer.setSuperclass( getSuperclass( proxyClasses ) );
         enhancer.setCallback( new InvocationHandlerBridge( invocationHandler ) );
         return enhancer.create();
     }

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -21,11 +21,12 @@
 import javassist.CtConstructor;
 import javassist.CtMethod;
 import org.aopalliance.intercept.MethodInterceptor;
+import org.apache.commons.logging.LogFactory;
 import org.apache.commons.proxy.ObjectProvider;
 import org.apache.commons.proxy.exception.ProxyFactoryException;
 import org.apache.commons.proxy.factory.util.AbstractProxyClassGenerator;
-import org.apache.commons.proxy.factory.util.AbstractProxyFactory;
 import org.apache.commons.proxy.factory.util.ProxyClassCache;
+import org.apache.commons.proxy.factory.util.AbstractSubclassingProxyFactory;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -37,12 +38,11 @@
  * @author James Carman
  * @version 1.0
  */
-public class JavassistProxyFactory extends AbstractProxyFactory
+public class JavassistProxyFactory extends AbstractSubclassingProxyFactory
 {
 //----------------------------------------------------------------------------------------------------------------------
 // Fields
 //----------------------------------------------------------------------------------------------------------------------
-
     private static final ProxyClassCache delegatingProxyClassCache = new ProxyClassCache(
             new DelegatingProxyClassGenerator() );
     private static final ProxyClassCache interceptingProxyClassCache = new ProxyClassCache(
@@ -55,11 +55,11 @@
 //----------------------------------------------------------------------------------------------------------------------
 
     public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider targetProvider,
-                                        Class... proxyInterfaces )
+                                        Class... proxyClasses )
     {
         try
         {
-            final Class clazz = delegatingProxyClassCache.getProxyClass( classLoader, proxyInterfaces );
+            final Class clazz = delegatingProxyClassCache.getProxyClass( classLoader, proxyClasses );
             return clazz.getConstructor( ObjectProvider.class ).newInstance( targetProvider );
         }
         catch( Exception e )
@@ -69,12 +69,12 @@
     }
 
     public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor,
-                                          Class... proxyInterfaces )
+                                          Class... proxyClasses )
     {
         try
         {
-            final Class clazz = interceptingProxyClassCache.getProxyClass( classLoader, proxyInterfaces );
-            final Method[] methods = AbstractProxyClassGenerator.getImplementationMethods( proxyInterfaces );
+            final Class clazz = interceptingProxyClassCache.getProxyClass( classLoader, proxyClasses );
+            final Method[] methods = AbstractProxyClassGenerator.getImplementationMethods( proxyClasses );
             return clazz.getConstructor( Method[].class, Object.class, MethodInterceptor.class )
                     .newInstance( methods, target, interceptor );
         }
@@ -85,12 +85,12 @@
     }
 
     public Object createInvocationHandlerProxy( ClassLoader classLoader, InvocationHandler invocationHandler,
-                                                Class... proxyInterfaces )
+                                                Class... proxyClasses )
     {
         try
         {
-            final Class clazz = invocationHandlerProxyClassCache.getProxyClass( classLoader, proxyInterfaces );
-            final Method[] methods = AbstractProxyClassGenerator.getImplementationMethods( proxyInterfaces );
+            final Class clazz = invocationHandlerProxyClassCache.getProxyClass( classLoader, proxyClasses );
+            final Method[] methods = AbstractProxyClassGenerator.getImplementationMethods( proxyClasses );
             return clazz.getConstructor( Method[].class, InvocationHandler.class )
                     .newInstance( methods, invocationHandler );
         }
@@ -106,13 +106,13 @@
 
     private static class InvocationHandlerProxyClassGenerator extends AbstractProxyClassGenerator
     {
-        public Class generateProxyClass( ClassLoader classLoader, Class... proxyInterfaces )
+        public Class generateProxyClass( ClassLoader classLoader, Class... proxyClasses )
         {
             try
             {
-                final CtClass proxyClass = JavassistUtils.createClass();
-                final Method[] methods = getImplementationMethods( proxyInterfaces );
-                JavassistUtils.addInterfaces( proxyClass, proxyInterfaces );
+                final CtClass proxyClass = JavassistUtils.createClass( getSuperclass( proxyClasses ) );
+                final Method[] methods = getImplementationMethods( proxyClasses );
+                JavassistUtils.addInterfaces( proxyClass, toInterfaces( proxyClasses ) );
                 JavassistUtils.addField( Method[].class, "methods", proxyClass );
                 JavassistUtils.addField( InvocationHandler.class, "invocationHandler", proxyClass );
                 final CtConstructor proxyConstructor = new CtConstructor(
@@ -124,6 +124,8 @@
                 proxyClass.addConstructor( proxyConstructor );
                 for( int i = 0; i < methods.length; ++i )
                 {
+                    LogFactory.getLog( getClass() )
+                            .debug( "Adding method " + methods[i] + " to delegating proxy class..." );
                     final CtMethod method = new CtMethod( JavassistUtils.resolve( methods[i].getReturnType() ),
                                                           methods[i].getName(),
                                                           JavassistUtils.resolve( methods[i].getParameterTypes() ),
@@ -144,13 +146,13 @@
 
     private static class InterceptingProxyClassGenerator extends AbstractProxyClassGenerator
     {
-        public Class generateProxyClass( ClassLoader classLoader, Class... proxyInterfaces )
+        public Class generateProxyClass( ClassLoader classLoader, Class... proxyClasses )
         {
             try
             {
-                final CtClass proxyClass = JavassistUtils.createClass();
-                final Method[] methods = getImplementationMethods( proxyInterfaces );
-                JavassistUtils.addInterfaces( proxyClass, proxyInterfaces );
+                final CtClass proxyClass = JavassistUtils.createClass( getSuperclass( proxyClasses ) );
+                final Method[] methods = getImplementationMethods( proxyClasses );
+                JavassistUtils.addInterfaces( proxyClass, toInterfaces( proxyClasses ) );
                 JavassistUtils.addField( Method[].class, "methods", proxyClass );
                 JavassistUtils.addField( Object.class, "target", proxyClass );
                 JavassistUtils.addField( MethodInterceptor.class, "interceptor", proxyClass );
@@ -185,19 +187,19 @@
 
     private static class DelegatingProxyClassGenerator extends AbstractProxyClassGenerator
     {
-        public Class generateProxyClass( ClassLoader classLoader, Class... proxyInterfaces )
+        public Class generateProxyClass( ClassLoader classLoader, Class... proxyClasses )
         {
             try
             {
-                final CtClass proxyClass = JavassistUtils.createClass();
+                final CtClass proxyClass = JavassistUtils.createClass( getSuperclass( proxyClasses ) );
                 JavassistUtils.addField( ObjectProvider.class, "provider", proxyClass );
                 final CtConstructor proxyConstructor = new CtConstructor(
                         JavassistUtils.resolve( new Class[]{ObjectProvider.class} ),
                         proxyClass );
                 proxyConstructor.setBody( "{ this.provider = $1; }" );
                 proxyClass.addConstructor( proxyConstructor );
-                JavassistUtils.addInterfaces( proxyClass, proxyInterfaces );
-                final Method[] methods = getImplementationMethods( proxyInterfaces );
+                JavassistUtils.addInterfaces( proxyClass, toInterfaces( proxyClasses ) );
+                final Method[] methods = getImplementationMethods( proxyClasses );
                 for( int i = 0; i < methods.length; ++i )
                 {
                     final Method method = methods[i];
@@ -209,6 +211,7 @@
                                       " )provider.getObject() )." +
                                       method.getName() + "($$); }" );
                     proxyClass.addMethod( ctMethod );
+
                 }
                 return proxyClass.toClass( classLoader );
             }

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java Mon Sep  5 08:39:02 2005
@@ -69,11 +69,11 @@
         return inputClass.getName();
     }
 
-    public static void addInterfaces( CtClass ctClass, Class... proxyInterfaces )
+    public static void addInterfaces( CtClass ctClass, Class... proxyClasses )
     {
-        for( int i = 0; i < proxyInterfaces.length; i++ )
+        for( int i = 0; i < proxyClasses.length; i++ )
         {
-            Class proxyInterface = proxyInterfaces[i];
+            Class proxyInterface = proxyClasses[i];
             ctClass.addInterface( resolve( proxyInterface ) );
         }
     }

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java Mon Sep  5 08:39:02 2005
@@ -34,24 +34,24 @@
     /**
      * Creates a proxy object which implements the specified proxy interfaces.
      *
-     * @param proxyInterfaces the proxy interfaces
+     * @param proxyClasses the proxy interfaces
      * @return a proxy object which implements the specified proxy interfaces
      */
-    public Object createProxy( Class... proxyInterfaces )
+    public Object createProxy( Class... proxyClasses )
     {
-        return createProxy( Thread.currentThread().getContextClassLoader(), proxyInterfaces );
+        return createProxy( Thread.currentThread().getContextClassLoader(), proxyClasses );
     }
 
     /**
      * Creates a proxy object which implements the specified proxy interfaces, using the specified class loader.
      *
      * @param classLoader     the class loader
-     * @param proxyInterfaces the proxy interfaces
+     * @param proxyClasses the proxy interfaces
      * @return a proxy object which implements the specified proxy interfaces, using the specified class loader.
      */
-    public Object createProxy( ClassLoader classLoader, Class... proxyInterfaces )
+    public Object createProxy( ClassLoader classLoader, Class... proxyClasses )
     {
-        return Proxy.newProxyInstance( classLoader, proxyInterfaces, this );
+        return Proxy.newProxyInstance( classLoader, proxyClasses, this );
     }
 }
 

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -36,23 +36,23 @@
 //----------------------------------------------------------------------------------------------------------------------
 
     public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider targetProvider,
-                                        Class... proxyInterfaces )
+                                        Class... proxyClasses )
     {
-        return Proxy.newProxyInstance( classLoader, proxyInterfaces,
+        return Proxy.newProxyInstance( classLoader, proxyClasses,
                                        new DelegateProviderInvocationHandler( targetProvider ) );
     }
 
     public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor,
-                                          Class... proxyInterfaces )
+                                          Class... proxyClasses )
     {
         return new MethodInterceptorInvocationHandler( target, interceptor )
-                .createProxy( classLoader, proxyInterfaces );
+                .createProxy( classLoader, proxyClasses );
     }
 
     public Object createInvocationHandlerProxy( ClassLoader classLoader, InvocationHandler invocationHandler,
-                                                Class... proxyInterfaces )
+                                                Class... proxyClasses )
     {
-        return Proxy.newProxyInstance( classLoader, proxyInterfaces, invocationHandler );
+        return Proxy.newProxyInstance( classLoader, proxyClasses, invocationHandler );
     }
 }
 

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyClassGenerator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyClassGenerator.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyClassGenerator.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyClassGenerator.java Mon Sep  5 08:39:02 2005
@@ -17,6 +17,7 @@
 package org.apache.commons.proxy.factory.util;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -39,21 +40,21 @@
      * are no method signature clashes. For methods with the same signature (name and parameter types), the one
      * encountered first will be returned in the result.
      *
-     * @param proxyInterfaces the interfaces the proxy class must implement
+     * @param proxyClasses the interfaces the proxy class must implement
      * @return all methods that the proxy class must implement
      */
-    public static Method[] getImplementationMethods( Class... proxyInterfaces )
+    public static Method[] getImplementationMethods( Class... proxyClasses )
     {
         final Set<MethodSignature> signatures = new HashSet<MethodSignature>();
         final List<Method> resultingMethods = new LinkedList<Method>();
-        for( int i = 0; i < proxyInterfaces.length; i++ )
+        for( int i = 0; i < proxyClasses.length; i++ )
         {
-            Class proxyInterface = proxyInterfaces[i];
+            Class proxyInterface = proxyClasses[i];
             final Method[] methods = proxyInterface.getMethods();
             for( int j = 0; j < methods.length; j++ )
             {
                 final MethodSignature signature = new MethodSignature( methods[j] );
-                if( !signatures.contains( signature ) )
+                if( !signatures.contains( signature ) && !Modifier.isFinal( methods[j].getModifiers() ) )
                 {
                     signatures.add( signature );
                     resultingMethods.add( methods[j] );

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -21,8 +21,12 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.proxy.ObjectProvider;
 import org.apache.commons.proxy.ProxyFactory;
+import org.apache.commons.proxy.exception.ProxyFactoryException;
 
 import java.lang.reflect.InvocationHandler;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Collection;
 
 /**
  * A helpful superclass for {@link org.apache.commons.proxy.ProxyFactory} implementations.
@@ -56,21 +60,34 @@
 // ProxyFactory Implementation
 //----------------------------------------------------------------------------------------------------------------------
 
-    public final Object createDelegatorProxy( ObjectProvider targetProvider, Class... proxyInterfaces )
+    public final Object createDelegatorProxy( ObjectProvider targetProvider, Class... proxyClasses )
     {
-        return createDelegatorProxy( Thread.currentThread().getContextClassLoader(), targetProvider, proxyInterfaces );
+        return createDelegatorProxy( Thread.currentThread().getContextClassLoader(), targetProvider, proxyClasses );
     }
 
     public final Object createInterceptorProxy( Object target, MethodInterceptor interceptor,
-                                                Class... proxyInterfaces )
+                                                Class... proxyClasses )
     {
         return createInterceptorProxy( Thread.currentThread().getContextClassLoader(), target, interceptor,
-                                       proxyInterfaces );
+                                       proxyClasses );
     }
 
-    public final Object createInvocationHandlerProxy( InvocationHandler invocationHandler, Class... proxyInterfaces )
+    public final Object createInvocationHandlerProxy( InvocationHandler invocationHandler, Class... proxyClasses )
     {
         return createInvocationHandlerProxy( Thread.currentThread().getContextClassLoader(), invocationHandler,
-                                             proxyInterfaces );
+                                             proxyClasses );
+    }
+
+    public boolean canProxy( Class... proxyClasses )
+    {
+        for( int i = 0; i < proxyClasses.length; i++ )
+        {
+            Class proxyClass = proxyClasses[i];
+            if( !proxyClass.isInterface() )
+            {
+                return false;
+            }
+        }
+        return true;
     }
 }

Added: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java?rev=278781&view=auto
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java (added)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -0,0 +1,128 @@
+/* $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.proxy.factory.util;
+
+import org.apache.commons.proxy.exception.ProxyFactoryException;
+
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class AbstractSubclassingProxyFactory extends AbstractProxyFactory
+{
+    /**
+     * Returns either {@link Object} if all of the <code>proxyClasses</code> are interfaces or the single non-interface
+     * class from <code>proxyClasses</code>.
+     *
+     * @param proxyClasses the proxy classes
+     * @return either {@link Object} if all of the <code>proxyClasses</code> are interfaces or the single non-interface
+     *         class from <code>proxyClasses</code>
+     * @throws ProxyFactoryException if multiple non-interface classes are contained in <code>proxyClasses</code> or any
+     *                               of the non-interface classes are final
+     */
+    protected static Class getSuperclass( Class... proxyClasses )
+    {
+        final Class[] superclasses = toNonInterfaces( proxyClasses );
+        switch( superclasses.length )
+        {
+            case 0:
+                return Object.class;
+            case 1:
+                final Class superclass = superclasses[0];
+                if( Modifier.isFinal( superclass.getModifiers() ) )
+                {
+                    throw new ProxyFactoryException(
+                            "Proxy class cannot extend " + superclass.getName() + " as it is final." );
+                }
+                try
+                {
+                    superclass.getConstructor();
+                }
+                catch( NoSuchMethodException e )
+                {
+                    throw new ProxyFactoryException( "Proxy class cannot extend " + superclass.getName() + ", because it has no \"default\" constructor.", e );
+                }
+                return superclass;
+            default:
+                final StringBuffer errorMessage = new StringBuffer( "Proxy class cannot extend " );
+                for( int i = 0; i < superclasses.length; i++ )
+                {
+                    Class c = superclasses[i];
+                    errorMessage.append( c.getName() );
+                    if( i != superclasses.length - 1 )
+                    {
+                        errorMessage.append( ", " );
+                    }
+                }
+                errorMessage.append( "; multiple inheritance not allowed." );
+                throw new ProxyFactoryException( errorMessage.toString() );
+        }
+    }
+
+    /**
+     * Returns the <code>proxyClasses</code> transformed into an array of only the interface classes.
+     *
+     * @param proxyClasses the proxy classes
+     * @return the <code>proxyClasses</code> transformed into an array of only the interface classes
+     */
+    protected static Class[] toInterfaces( Class... proxyClasses )
+    {
+        final Collection<Class> interfaces = new LinkedList<Class>();
+        for( int i = 0; i < proxyClasses.length; i++ )
+        {
+            Class proxyInterface = proxyClasses[i];
+            if( proxyInterface.isInterface() )
+            {
+                interfaces.add( proxyInterface );
+            }
+        }
+        return ( Class[] ) interfaces.toArray( new Class[interfaces.size()] );
+    }
+
+    public boolean canProxy( Class... proxyClasses )
+    {
+        try
+        {
+            getSuperclass( proxyClasses );
+            return true;
+        }
+        catch( ProxyFactoryException e )
+        {
+            return false;
+        }
+    }
+
+    private static Class[] toNonInterfaces( Class... proxyClasses )
+    {
+        final List<Class> superclasses = new LinkedList<Class>();
+        for( int i = 0; i < proxyClasses.length; i++ )
+        {
+            Class proxyClass = proxyClasses[i];
+            if( !proxyClass.isInterface() )
+            {
+                superclasses.add( proxyClass );
+            }
+        }
+        return ( Class[] ) superclasses.toArray( new Class[superclasses.size()] );
+
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java Mon Sep  5 08:39:02 2005
@@ -47,15 +47,15 @@
 // Other Methods
 //----------------------------------------------------------------------------------------------------------------------
 
-    public synchronized Class getProxyClass( ClassLoader classLoader, Class... proxyInterfaces )
+    public synchronized Class getProxyClass( ClassLoader classLoader, Class... proxyClasses )
     {
         final Map<String, WeakReference<Class>> classCache = getClassCache( classLoader );
-        final String key = toClassCacheKey( proxyInterfaces );
+        final String key = toClassCacheKey( proxyClasses );
         Class proxyClass;
         WeakReference<Class> proxyClassReference = classCache.get( key );
         if( proxyClassReference == null )
         {
-            proxyClass = proxyClassGenerator.generateProxyClass( classLoader, proxyInterfaces );
+            proxyClass = proxyClassGenerator.generateProxyClass( classLoader, proxyClasses );
             classCache.put( key, new WeakReference<Class>( proxyClass ) );
         }
         else
@@ -65,7 +65,7 @@
                 proxyClass = proxyClassReference.get();
                 if( proxyClass == null )
                 {
-                    proxyClass = proxyClassGenerator.generateProxyClass( classLoader, proxyInterfaces );
+                    proxyClass = proxyClassGenerator.generateProxyClass( classLoader, proxyClasses );
                     classCache.put( key, new WeakReference<Class>( proxyClass ) );
                 }
             }
@@ -84,14 +84,14 @@
         return cache;
     }
 
-    private String toClassCacheKey( Class... proxyInterfaces )
+    private String toClassCacheKey( Class... proxyClasses )
     {
         final StringBuffer sb = new StringBuffer();
-        for( int i = 0; i < proxyInterfaces.length; i++ )
+        for( int i = 0; i < proxyClasses.length; i++ )
         {
-            Class proxyInterface = proxyInterfaces[i];
+            Class proxyInterface = proxyClasses[i];
             sb.append( proxyInterface.getName() );
-            if( i != proxyInterfaces.length - 1 )
+            if( i != proxyClasses.length - 1 )
             {
                 sb.append( "," );
             }

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java Mon Sep  5 08:39:02 2005
@@ -26,6 +26,6 @@
 // Other Methods
 //----------------------------------------------------------------------------------------------------------------------
 
-    public Class generateProxyClass( ClassLoader classLoader, Class... proxyInterfaces );
+    public Class generateProxyClass( ClassLoader classLoader, Class... proxyClasses );
 }
 

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java Mon Sep  5 08:39:02 2005
@@ -50,31 +50,31 @@
 //----------------------------------------------------------------------------------------------------------------------
 
     private Object createProxy( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus,
-                                Class... proxyInterfaces )
+                                Class... proxyClasses )
     {
         Object currentTarget = terminus;
         for( int i = interceptors.length - 1; i >= 0; --i )
         {
             currentTarget = proxyFactory
-                    .createInterceptorProxy( classLoader, currentTarget, interceptors[i], proxyInterfaces );
+                    .createInterceptorProxy( classLoader, currentTarget, interceptors[i], proxyClasses );
         }
         return currentTarget;
     }
 
-    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus, Class... proxyInterfaces )
+    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus, Class... proxyClasses )
     {
         return createProxyProvider( proxyFactory, Thread.currentThread().getContextClassLoader(), terminus,
-                                    proxyInterfaces );
+                                    proxyClasses );
     }
 
     public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus,
-                                               Class... proxyInterfaces )
+                                               Class... proxyClasses )
     {
-        if( proxyInterfaces.length == 0 )
+        if( proxyClasses.length == 0 )
         {
-            proxyInterfaces = terminus.getClass().getInterfaces();
+            proxyClasses = terminus.getClass().getInterfaces();
         }
-        return new ProxyObjectProvider( proxyFactory, classLoader, terminus, proxyInterfaces );
+        return new ProxyObjectProvider( proxyFactory, classLoader, terminus, proxyClasses );
     }
 
 //----------------------------------------------------------------------------------------------------------------------
@@ -84,22 +84,22 @@
     private class ProxyObjectProvider extends AbstractObjectProvider
     {
         private final ClassLoader classLoader;
-        private final Class[] proxyInterfaces;
+        private final Class[] proxyClasses;
         private final Object terminus;
         private final ProxyFactory proxyFactory;
 
         public ProxyObjectProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus,
-                                    Class[] proxyInterfaces )
+                                    Class[] proxyClasses )
         {
             this.classLoader = classLoader;
-            this.proxyInterfaces = proxyInterfaces;
+            this.proxyClasses = proxyClasses;
             this.terminus = terminus;
             this.proxyFactory = proxyFactory;
         }
 
         public Object getObject()
         {
-            return createProxy( proxyFactory, classLoader, terminus, proxyInterfaces );
+            return createProxy( proxyFactory, classLoader, terminus, proxyClasses );
         }
     }
 }

Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java Mon Sep  5 08:39:02 2005
@@ -48,6 +48,12 @@
         this.factory = factory;
     }
 
+    public void testCanProxy()
+    {
+        assertTrue( factory.canProxy( Echo.class ) );
+        assertFalse( factory.canProxy( EchoImpl.class ) );
+    }
+
     public void testInterfaceHierarchies()
     {
         final SortedSet<String> set = ( SortedSet<String> ) factory.createDelegatorProxy( constantProvider( new TreeSet<String>() ), SortedSet.class );
@@ -234,7 +240,7 @@
         }
     }
 
-    private static class NoOpMethodInterceptor implements MethodInterceptor
+    protected static class NoOpMethodInterceptor implements MethodInterceptor
     {
         public Object invoke( MethodInvocation methodInvocation ) throws Throwable
         {

Added: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java?rev=278781&view=auto
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java (added)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java Mon Sep  5 08:39:02 2005
@@ -0,0 +1,59 @@
+/* $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.proxy.factory;
+
+import org.apache.commons.proxy.ProxyFactory;
+import org.apache.commons.proxy.handler.NullInvocationHandler;
+import org.apache.commons.proxy.provider.ConstantProvider;
+import org.apache.commons.proxy.util.Echo;
+import org.apache.commons.proxy.util.EchoImpl;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class AbstractSubclassingProxyFactoryTestCase extends AbstractProxyFactoryTestCase
+{
+    protected AbstractSubclassingProxyFactoryTestCase( ProxyFactory factory )
+    {
+        super( factory );
+    }
+
+    public void testCanProxy()
+    {
+        assertTrue( factory.canProxy( Echo.class ) );
+        assertTrue( factory.canProxy( EchoImpl.class ) );
+    }
+
+    public void testDelegatorWithSuperclass()
+    {
+        final Echo echo = ( Echo )factory.createDelegatorProxy( new ConstantProvider( new EchoImpl() ), Echo.class, EchoImpl.class );
+        assertTrue( echo instanceof EchoImpl );
+    }
+
+    public void testInterceptorWithSuperclass()
+    {
+        final Echo echo = ( Echo )factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), Echo.class, EchoImpl.class );
+        assertTrue( echo instanceof EchoImpl );
+    }
+
+    public void testInvocationHandlerWithSuperclass()
+    {
+        final Echo echo = ( Echo )factory.createInvocationHandlerProxy( new NullInvocationHandler(), Echo.class, EchoImpl.class );
+        assertTrue( echo instanceof EchoImpl );
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractSubclassingProxyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -16,12 +16,13 @@
 package org.apache.commons.proxy.factory.cglib;
 
 import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
+import org.apache.commons.proxy.factory.AbstractSubclassingProxyFactoryTestCase;
 
 /**
  * @author James Carman
  * @version 1.0
  */
-public class TestCglibProxyFactory extends AbstractProxyFactoryTestCase
+public class TestCglibProxyFactory extends AbstractSubclassingProxyFactoryTestCase
 {
     public TestCglibProxyFactory()
     {

Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java?rev=278781&r1=278780&r2=278781&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java Mon Sep  5 08:39:02 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.proxy.factory.javassist;
 
 import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
+import org.apache.commons.proxy.factory.AbstractSubclassingProxyFactoryTestCase;
 import org.apache.commons.proxy.util.Echo;
 import org.apache.commons.proxy.util.DuplicateEcho;
 
@@ -27,7 +28,7 @@
  * @author James Carman
  * @version 1.0
  */
-public class TestJavassistProxyFactory extends AbstractProxyFactoryTestCase
+public class TestJavassistProxyFactory extends AbstractSubclassingProxyFactoryTestCase
 {
     public TestJavassistProxyFactory()
     {



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


Mime
View raw message