commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r645232 - in /commons/proper/proxy/branches/version-2.0-work: ./ src/main/java/org/apache/commons/proxy/ src/main/java/org/apache/commons/proxy/factory/cglib/ src/main/java/org/apache/commons/proxy/factory/javassist/ src/main/java/org/apach...
Date Sun, 06 Apr 2008 12:35:33 GMT
Author: jcarman
Date: Sun Apr  6 05:35:32 2008
New Revision: 645232

URL: http://svn.apache.org/viewvc?rev=645232&view=rev
Log:
Genericizing Proxy.

Modified:
    commons/proper/proxy/branches/version-2.0-work/pom.xml
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ObjectProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ConstantProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/NullProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/SingletonProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/BurlapProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/HessianProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/JaxRpcProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/RmiProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/SessionBeanProvider.java
    commons/proper/proxy/branches/version-2.0-work/src/test/java/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java

Modified: commons/proper/proxy/branches/version-2.0-work/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/pom.xml?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/pom.xml (original)
+++ commons/proper/proxy/branches/version-2.0-work/pom.xml Sun Apr  6 05:35:32 2008
@@ -26,7 +26,7 @@
         <version>9</version>
     </parent>
     <artifactId>commons-proxy</artifactId>
-    <version>1.1-SNAPSHOT</version>
+    <version>2.0-SNAPSHOT</version>
     <name>Commons Proxy</name>
     <description>Java library for dynamic proxying</description>
     <url>http://commons.apache.org/proxy/</url>
@@ -241,8 +241,8 @@
     </distributionManagement>
 
     <properties>
-        <maven.compile.source>1.4</maven.compile.source>
-        <maven.compile.target>1.4</maven.compile.target>
+        <maven.compile.source>1.5</maven.compile.source>
+        <maven.compile.target>1.5</maven.compile.target>
         <commons.componentid>proxy</commons.componentid>
         <commons.release.version>1.0</commons.release.version>
         <commons.binary.suffix></commons.binary.suffix>

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ObjectProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ObjectProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ObjectProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ObjectProvider.java Sun Apr  6 05:35:32 2008
@@ -23,7 +23,7 @@
  * @author James Carman
  * @since 1.0
  */
-public interface ObjectProvider
+public interface ObjectProvider<T>
 {
 //**********************************************************************************************************************
 // Other Methods
@@ -36,6 +36,6 @@
      *
      * @return the object on which the method should be called
      */
-    public Object getObject();
+    public T getObject();
 }
 

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ProxyFactory.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ProxyFactory.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/ProxyFactory.java Sun Apr  6 05:35:32 2008
@@ -58,12 +58,11 @@
      * @param proxyClasses the proxy classes
      * @return true if all <code>proxyClasses</code> are interfaces
      */
-    public boolean canProxy(Class[] proxyClasses)
+    public boolean canProxy( Class... proxyClasses )
     {
-        for (int i = 0; i < proxyClasses.length; i++)
+        for( Class proxyClass : proxyClasses )
         {
-            Class proxyClass = proxyClasses[i];
-            if (!proxyClass.isInterface())
+            if( !proxyClass.isInterface() )
             {
                 return false;
             }
@@ -79,12 +78,26 @@
      * @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[] proxyClasses)
+    public Object createDelegatorProxy( ObjectProvider delegateProvider, Class... proxyClasses )
     {
         return createDelegatorProxy(Thread.currentThread().getContextClassLoader(), delegateProvider, proxyClasses);
     }
 
     /**
+     * Creates a proxy which delegates to the object provided by <code>delegateProvider</code>.  The proxy will be
+     * generated using the current thread's "context class loader."
+     *
+     * @param delegateProvider the delegate provider
+     * @param proxyClass     the class/interface that the proxy should implement
+     * @return a proxy which delegates to the object provided by the target object provider
+     */
+    @SuppressWarnings("unchecked")
+    public <T> T createDelegatorProxy( ObjectProvider<T> delegateProvider, Class<T> proxyClass )
+    {
+        return (T)createDelegatorProxy(delegateProvider, new Class[] {proxyClass});
+    }
+
+    /**
      * Creates a proxy which delegates to the object provided by <code>delegateProvider</code>.
      *
      * @param classLoader      the class loader to use when generating the proxy
@@ -92,11 +105,26 @@
      * @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[] proxyClasses)
+    public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider delegateProvider,
+                                        Class... proxyClasses )
     {
         return Proxy.newProxyInstance(classLoader, proxyClasses,
-                new DelegatorInvocationHandler(delegateProvider));
+                                      new DelegatorInvocationHandler(delegateProvider));
+    }
+
+    /**
+     * 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 proxyClass     the class/interface that the proxy should implement
+     * @return a proxy which delegates to the object provided by the target <code>delegateProvider>
+     */
+    @SuppressWarnings( "unchecked" )
+    public <T> T createDelegatorProxy( ClassLoader classLoader, ObjectProvider<T> delegateProvider,
+                                       Class<T> proxyClass )
+    {
+        return ( T ) createDelegatorProxy(classLoader, delegateProvider, new Class[] {proxyClass});
     }
 
     /**
@@ -109,11 +137,28 @@
      * @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
      *         <code>target</code> object.
      */
-    public Object createInterceptorProxy(Object target, Interceptor interceptor,
-                                         Class[] proxyClasses)
+    public Object createInterceptorProxy( Object target, Interceptor interceptor,
+                                          Class... proxyClasses )
     {
         return createInterceptorProxy(Thread.currentThread().getContextClassLoader(), target, interceptor,
-                proxyClasses);
+                                      proxyClasses);
+    }
+
+    /**
+     * Creates a proxy which passes through a {@link Interceptor 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 proxyClass the class/interface that the proxy should implement
+     * @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
+     *         <code>target</code> object.
+     */
+    @SuppressWarnings( "unchecked" )
+    public <T> T createInterceptorProxy( Object target, Interceptor interceptor,
+                                         Class<T> proxyClass )
+    {
+        return ( T ) createInterceptorProxy(target, interceptor, new Class[] {proxyClass});
     }
 
     /**
@@ -127,14 +172,34 @@
      * @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
      *         <code>target</code> object.
      */
-    public Object createInterceptorProxy(ClassLoader classLoader, Object target, Interceptor interceptor,
-                                         Class[] proxyClasses)
+    public Object createInterceptorProxy( ClassLoader classLoader, Object target, Interceptor interceptor,
+                                          Class... proxyClasses )
     {
         return Proxy
                 .newProxyInstance(classLoader, proxyClasses, new InterceptorInvocationHandler(target, interceptor));
     }
 
     /**
+     * Creates a proxy which passes through a {@link Interceptor 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 proxyClass the class/interface that the proxy should implement.
+     * @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
+     *         <code>target</code> object.
+     */
+    @SuppressWarnings( "unchecked" )
+    public <T> T createInterceptorProxy( ClassLoader classLoader,
+                                         Object target,
+                                         Interceptor interceptor,
+                                         Class<T> proxyClass )
+    {
+        return ( T ) createInterceptorProxy(classLoader, target, interceptor, new Class[] {proxyClass});
+    }
+
+    /**
      * Creates a proxy which uses the provided {@link Invoker} to handle all method invocations.  The proxy will be
      * generated using the current thread's "context class loader."
      *
@@ -142,10 +207,24 @@
      * @param proxyClasses the interfaces that the proxy should implement
      * @return a proxy which uses the provided {@link Invoker} to handle all method invocations
      */
-    public Object createInvokerProxy(Invoker invoker, Class[] proxyClasses)
+    public Object createInvokerProxy( Invoker invoker, Class... proxyClasses )
     {
         return createInvokerProxy(Thread.currentThread().getContextClassLoader(), invoker,
-                proxyClasses);
+                                  proxyClasses);
+    }
+
+    /**
+     * Creates a proxy which uses the provided {@link Invoker} to handle all method invocations.  The proxy will be
+     * generated using the current thread's "context class loader."
+     *
+     * @param invoker      the invoker
+     * @param proxyClass the class/interface that the proxy should implement
+     * @return a proxy which uses the provided {@link Invoker} to handle all method invocations
+     */
+    @SuppressWarnings( "unchecked" )
+    public <T> T createInvokerProxy( Invoker invoker, Class<T> proxyClass )
+    {
+        return ( T ) createInvokerProxy(invoker, new Class[] {proxyClass});
     }
 
     /**
@@ -156,12 +235,27 @@
      * @param proxyClasses the interfaces that the proxy should implement
      * @return a proxy which uses the provided {@link Invoker} to handle all method invocations
      */
-    public Object createInvokerProxy(ClassLoader classLoader, Invoker invoker,
-                                     Class[] proxyClasses)
+    public Object createInvokerProxy( ClassLoader classLoader, Invoker invoker,
+                                      Class... proxyClasses )
     {
         return Proxy.newProxyInstance(classLoader, proxyClasses, new InvokerInvocationHandler(invoker));
     }
 
+    /**
+     * Creates a proxy which uses the provided {@link Invoker} to handle all method invocations.
+     *
+     * @param classLoader  the class loader to use when generating the proxy
+     * @param invoker      the invoker
+     * @param proxyClass the class/interface that the proxy should implement
+     * @return a proxy which uses the provided {@link Invoker} to handle all method invocations
+     */
+    @SuppressWarnings( "unchecked" )
+    public <T> T createInvokerProxy( ClassLoader classLoader, Invoker invoker,
+                                     Class<T> proxyClass )
+    {
+        return ( T ) createInvokerProxy(classLoader, invoker, new Class[] {proxyClass});
+    }
+
 //**********************************************************************************************************************
 // Inner Classes
 //**********************************************************************************************************************
@@ -170,18 +264,18 @@
     {
         private final ObjectProvider delegateProvider;
 
-        protected DelegatorInvocationHandler(ObjectProvider delegateProvider)
+        protected DelegatorInvocationHandler( ObjectProvider delegateProvider )
         {
             this.delegateProvider = delegateProvider;
         }
 
-        public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable
+        public Object invokeImpl( Object proxy, Method method, Object[] args ) throws Throwable
         {
             try
             {
                 return method.invoke(delegateProvider.getObject(), args);
             }
-            catch (InvocationTargetException e)
+            catch( InvocationTargetException e )
             {
                 throw e.getTargetException();
             }
@@ -193,13 +287,13 @@
         private final Object target;
         private final Interceptor methodInterceptor;
 
-        public InterceptorInvocationHandler(Object target, Interceptor methodInterceptor)
+        public InterceptorInvocationHandler( Object target, Interceptor methodInterceptor )
         {
             this.target = target;
             this.methodInterceptor = methodInterceptor;
         }
 
-        public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable
+        public Object invokeImpl( Object proxy, Method method, Object[] args ) throws Throwable
         {
             final ReflectionInvocation invocation = new ReflectionInvocation(target, method, args);
             return methodInterceptor.intercept(invocation);
@@ -208,15 +302,15 @@
 
     private abstract static class AbstractInvocationHandler implements InvocationHandler, Serializable
     {
-        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+        public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
         {
-            if (isHashCode(method))
+            if( isHashCode(method) )
             {
-                return new Integer(System.identityHashCode(proxy));
+                return System.identityHashCode(proxy);
             }
-            else if (isEqualsMethod(method))
+            else if( isEqualsMethod(method) )
             {
-                return Boolean.valueOf(proxy == args[0]);
+                return proxy == args[0];
             }
             else
             {
@@ -224,32 +318,32 @@
             }
         }
 
-        protected abstract Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable;
+        protected abstract Object invokeImpl( Object proxy, Method method, Object[] args ) throws Throwable;
     }
 
     private static class InvokerInvocationHandler extends AbstractInvocationHandler
     {
         private final Invoker invoker;
 
-        public InvokerInvocationHandler(Invoker invoker)
+        public InvokerInvocationHandler( Invoker invoker )
         {
             this.invoker = invoker;
         }
 
-        public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable
+        public Object invokeImpl( Object proxy, Method method, Object[] args ) throws Throwable
         {
             return invoker.invoke(proxy, method, args);
         }
     }
 
-    protected static boolean isHashCode(Method method)
+    protected static boolean isHashCode( Method method )
     {
         return "hashCode".equals(method.getName()) &&
                 Integer.TYPE.equals(method.getReturnType()) &&
                 method.getParameterTypes().length == 0;
     }
 
-    protected static boolean isEqualsMethod(Method method)
+    protected static boolean isEqualsMethod( Method method )
     {
         return "equals".equals(method.getName()) &&
                 Boolean.TYPE.equals(method.getReturnType()) &&
@@ -263,10 +357,10 @@
         private final Object[] arguments;
         private final Object target;
 
-        public ReflectionInvocation(Object target, Method method, Object[] arguments)
+        public ReflectionInvocation( Object target, Method method, Object[] arguments )
         {
             this.method = method;
-            this.arguments = (arguments == null ? ProxyUtils.EMPTY_ARGUMENTS : arguments);
+            this.arguments = ( arguments == null ? ProxyUtils.EMPTY_ARGUMENTS : arguments );
             this.target = target;
         }
 
@@ -291,7 +385,7 @@
             {
                 return method.invoke(target, arguments);
             }
-            catch (InvocationTargetException e)
+            catch( InvocationTargetException e )
             {
                 throw e.getTargetException();
             }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/CglibProxyFactory.java Sun Apr  6 05:35:32 2008
@@ -55,7 +55,7 @@
 //**********************************************************************************************************************
 
     public Object createDelegatorProxy(ClassLoader classLoader, ObjectProvider targetProvider,
-                                       Class[] proxyClasses)
+                                       Class... proxyClasses)
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader(classLoader);
@@ -67,7 +67,7 @@
     }
 
     public Object createInterceptorProxy(ClassLoader classLoader, Object target, Interceptor interceptor,
-                                         Class[] proxyClasses)
+                                         Class... proxyClasses)
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader(classLoader);
@@ -79,7 +79,7 @@
     }
 
     public Object createInvokerProxy(ClassLoader classLoader, Invoker invoker,
-                                     Class[] proxyClasses)
+                                     Class... proxyClasses)
     {
         final Enhancer enhancer = new Enhancer();
         enhancer.setClassLoader(classLoader);
@@ -115,7 +115,7 @@
     {
         public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable
         {
-            return new Integer(System.identityHashCode(o));
+            return System.identityHashCode(o);
         }
     }
 
@@ -123,7 +123,7 @@
     {
         public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable
         {
-            return Boolean.valueOf(o == objects[0]);
+            return o == objects[0];
         }
     }
 

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java Sun Apr  6 05:35:32 2008
@@ -74,13 +74,13 @@
 //**********************************************************************************************************************
 
     public Object createDelegatorProxy(ClassLoader classLoader, ObjectProvider targetProvider,
-                                       Class[] proxyClasses)
+                                       Class... proxyClasses)
     {
         try
         {
             final Class clazz = delegatingProxyClassCache.getProxyClass(classLoader, proxyClasses);
-            return clazz.getConstructor(new Class[]{ObjectProvider.class})
-                    .newInstance(new Object[]{targetProvider});
+            return clazz.getConstructor(ObjectProvider.class)
+                    .newInstance(targetProvider);
         }
         catch (Exception e)
         {
@@ -89,13 +89,13 @@
     }
 
     public Object createInterceptorProxy(ClassLoader classLoader, Object target, Interceptor interceptor,
-                                         Class[] proxyClasses)
+                                         Class... proxyClasses)
     {
         try
         {
             final Class clazz = interceptorProxyClassCache.getProxyClass(classLoader, proxyClasses);
-            return clazz.getConstructor(new Class[]{Object.class, Interceptor.class})
-                    .newInstance(new Object[]{target, interceptor});
+            return clazz.getConstructor(Object.class, Interceptor.class)
+                    .newInstance(target, interceptor);
         }
         catch (Exception e)
         {
@@ -104,13 +104,13 @@
     }
 
     public Object createInvokerProxy(ClassLoader classLoader, Invoker invoker,
-                                     Class[] proxyClasses)
+                                     Class... proxyClasses)
     {
         try
         {
             final Class clazz = invocationHandlerProxyClassCache.getProxyClass(classLoader, proxyClasses);
-            return clazz.getConstructor(new Class[]{Invoker.class})
-                    .newInstance(new Object[]{invoker});
+            return clazz.getConstructor(Invoker.class)
+                    .newInstance(invoker);
         }
         catch (Exception e)
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java Sun Apr  6 05:35:32 2008
@@ -153,7 +153,7 @@
      * @param proxyClasses the proxy classes
      * @return true if a suitable superclass can be found, given the desired <code>proxyClasses</code>
      */
-    public boolean canProxy( Class[] proxyClasses )
+    public boolean canProxy( Class... proxyClasses )
     {
         try
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java Sun Apr  6 05:35:32 2008
@@ -28,13 +28,13 @@
  * @author James Carman
  * @since 1.0
  */
-public class BeanProvider implements ObjectProvider, Serializable
+public class BeanProvider<T> implements ObjectProvider<T>, Serializable
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private Class beanClass;
+    private Class<T> beanClass;
 
 //**********************************************************************************************************************
 // Constructors
@@ -49,7 +49,7 @@
      *
      * @param beanClass the bean class
      */
-    public BeanProvider( Class beanClass )
+    public BeanProvider( Class<T> beanClass )
     {
         this.beanClass = beanClass;
     }
@@ -58,7 +58,7 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    public T getObject()
     {
         try
         {
@@ -83,7 +83,7 @@
 // Getter/Setter Methods
 //**********************************************************************************************************************
 
-    public void setBeanClass( Class beanClass )
+    public void setBeanClass( Class<T> beanClass )
     {
         this.beanClass = beanClass;
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java Sun Apr  6 05:35:32 2008
@@ -31,13 +31,13 @@
  * @author James Carman
  * @since 1.0
  */
-public class CloningProvider implements ObjectProvider, Serializable
+public class CloningProvider<T extends Cloneable> implements ObjectProvider<T>, Serializable
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private final Cloneable cloneable;
+    private final T cloneable;
     private Method cloneMethod;
 
 //**********************************************************************************************************************
@@ -50,7 +50,7 @@
      *
      * @param cloneable the object to clone
      */
-    public CloningProvider( Cloneable cloneable )
+    public CloningProvider( T cloneable )
     {
         this.cloneable = cloneable;
     }
@@ -59,12 +59,12 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-
-    public Object getObject()
+    @SuppressWarnings("unchecked")
+    public T getObject()
     {
         try
         {
-            return getCloneMethod().invoke(cloneable, ProxyUtils.EMPTY_ARGUMENTS);
+            return (T)getCloneMethod().invoke(cloneable, ProxyUtils.EMPTY_ARGUMENTS);
         }
         catch( IllegalAccessException e )
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ConstantProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ConstantProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ConstantProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ConstantProvider.java Sun Apr  6 05:35:32 2008
@@ -27,19 +27,19 @@
  * @author James Carman
  * @since 1.0
  */
-public class ConstantProvider implements ObjectProvider, Serializable
+public class ConstantProvider<T> implements ObjectProvider<T>, Serializable
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private final Object constant;
+    private final T constant;
 
 //**********************************************************************************************************************
 // Constructors
 //**********************************************************************************************************************
 
-    public ConstantProvider( Object constant )
+    public ConstantProvider( T constant )
     {
         this.constant = constant;
     }
@@ -48,7 +48,7 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    public T getObject()
     {
         return constant;
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/NullProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/NullProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/NullProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/NullProvider.java Sun Apr  6 05:35:32 2008
@@ -23,7 +23,7 @@
  * @author James Carman
  * @since 1.0
  */
-public class NullProvider extends ConstantProvider
+public class NullProvider<T> extends ConstantProvider<T>
 {
 //**********************************************************************************************************************
 // Constructors

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java Sun Apr  6 05:35:32 2008
@@ -27,19 +27,19 @@
  * @author James Carman
  * @since 1.0
  */
-public class ProviderDecorator implements ObjectProvider
+public class ProviderDecorator<T> implements ObjectProvider<T>
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    protected ObjectProvider inner;
+    protected ObjectProvider<T> inner;
 
 //**********************************************************************************************************************
 // Constructors
 //**********************************************************************************************************************
 
-    public ProviderDecorator( ObjectProvider inner )
+    public ProviderDecorator( ObjectProvider<T> inner )
     {
         this.inner = inner;
     }
@@ -48,7 +48,7 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    public T getObject()
     {
         return inner.getObject();
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/SingletonProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/SingletonProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/SingletonProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/SingletonProvider.java Sun Apr  6 05:35:32 2008
@@ -26,19 +26,19 @@
  * @author James Carman
  * @since 1.0
  */
-public class SingletonProvider extends ProviderDecorator
+public class SingletonProvider<T> extends ProviderDecorator<T>
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private Object instance;
+    private T instance;
 
 //**********************************************************************************************************************
 // Constructors
 //**********************************************************************************************************************
 
-    public SingletonProvider( ObjectProvider inner )
+    public SingletonProvider( ObjectProvider<T> inner )
     {
         super(inner);
     }
@@ -47,7 +47,7 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    public T getObject()
     {
         synchronized( this )
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/BurlapProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/BurlapProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/BurlapProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/BurlapProvider.java Sun Apr  6 05:35:32 2008
@@ -37,13 +37,13 @@
  * @author James Carman
  * @since 1.0
  */
-public class BurlapProvider implements ObjectProvider, Serializable
+public class BurlapProvider<T> implements ObjectProvider<T>, Serializable
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private Class serviceInterface;
+    private Class<T> serviceInterface;
     private String url;
 
 //**********************************************************************************************************************
@@ -54,7 +54,7 @@
     {
     }
 
-    public BurlapProvider( Class serviceInterface, String url )
+    public BurlapProvider( Class<T> serviceInterface, String url )
     {
         this.serviceInterface = serviceInterface;
         this.url = url;
@@ -64,11 +64,12 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    @SuppressWarnings("unchecked")
+    public T getObject()
     {
         try
         {
-            return new BurlapProxyFactory().create(serviceInterface, url);
+            return (T)new BurlapProxyFactory().create(serviceInterface, url);
         }
         catch( MalformedURLException e )
         {
@@ -80,7 +81,7 @@
 // Getter/Setter Methods
 //**********************************************************************************************************************
 
-    public void setServiceInterface( Class serviceInterface )
+    public void setServiceInterface( Class<T> serviceInterface )
     {
         this.serviceInterface = serviceInterface;
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/HessianProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/HessianProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/HessianProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/HessianProvider.java Sun Apr  6 05:35:32 2008
@@ -37,13 +37,13 @@
  * @author James Carman
  * @since 1.0
  */
-public class HessianProvider implements ObjectProvider, Serializable
+public class HessianProvider<T> implements ObjectProvider<T>, Serializable
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private Class serviceInterface;
+    private Class<T> serviceInterface;
     private String url;
 
 //**********************************************************************************************************************
@@ -54,7 +54,7 @@
     {
     }
 
-    public HessianProvider( Class serviceInterface, String url )
+    public HessianProvider( Class<T> serviceInterface, String url )
     {
         this.serviceInterface = serviceInterface;
         this.url = url;
@@ -64,11 +64,12 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    @SuppressWarnings("unchecked")
+    public T getObject()
     {
         try
         {
-            return new HessianProxyFactory().create(serviceInterface, url);
+            return (T)new HessianProxyFactory().create(serviceInterface, url);
         }
         catch( MalformedURLException e )
         {
@@ -80,7 +81,7 @@
 // Getter/Setter Methods
 //**********************************************************************************************************************
 
-    public void setServiceInterface( Class serviceInterface )
+    public void setServiceInterface( Class<T> serviceInterface )
     {
         this.serviceInterface = serviceInterface;
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/JaxRpcProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/JaxRpcProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/JaxRpcProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/JaxRpcProvider.java Sun Apr  6 05:35:32 2008
@@ -40,13 +40,13 @@
  * @author James Carman
  * @since 1.0
  */
-public class JaxRpcProvider implements ObjectProvider
+public class JaxRpcProvider<T> implements ObjectProvider<T>
 {
 //**********************************************************************************************************************
 // Fields
 //**********************************************************************************************************************
 
-    private Class serviceInterface;
+    private Class<T> serviceInterface;
     private String wsdlUrl;
     private String serviceNamespaceUri;
     private String serviceLocalPart;
@@ -63,7 +63,7 @@
     {
     }
 
-    public JaxRpcProvider( Class serviceInterface )
+    public JaxRpcProvider( Class<T> serviceInterface )
     {
         this.serviceInterface = serviceInterface;
     }
@@ -72,7 +72,7 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    public T getObject()
     {
         try
         {
@@ -80,8 +80,8 @@
                     ServiceFactory.newInstance().createService(getServiceQName()) : ServiceFactory
                     .newInstance().createService(new URL(wsdlUrl), getServiceQName()) );
             final QName portQName = getPortQName();
-            return portQName == null ? service.getPort(serviceInterface) :
-                    service.getPort(portQName, serviceInterface);
+            return serviceInterface.cast(portQName == null ? service.getPort(serviceInterface) :
+                    service.getPort(portQName, serviceInterface));
         }
         catch( ServiceException e )
         {
@@ -112,7 +112,7 @@
         this.portPrefix = portPrefix;
     }
 
-    public void setServiceInterface( Class serviceInterface )
+    public void setServiceInterface( Class<T> serviceInterface )
     {
         this.serviceInterface = serviceInterface;
     }

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/RmiProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/RmiProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/RmiProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/RmiProvider.java Sun Apr  6 05:35:32 2008
@@ -32,7 +32,7 @@
  * @author James Carman
  * @since 1.0
  */
-public class RmiProvider implements ObjectProvider
+public class RmiProvider<T> implements ObjectProvider<T>
 {
 //**********************************************************************************************************************
 // Fields
@@ -81,13 +81,14 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    @SuppressWarnings("unchecked")
+    public T getObject()
     {
-        Registry reg = null;
+        Registry reg;
         try
         {
             reg = getRegistry();
-            return reg.lookup(name);
+            return (T)reg.lookup(name);
         }
         catch( NotBoundException e )
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/SessionBeanProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/SessionBeanProvider.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/SessionBeanProvider.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/SessionBeanProvider.java Sun Apr  6 05:35:32 2008
@@ -35,7 +35,7 @@
  * @author James Carman
  * @since 1.0
  */
-public class SessionBeanProvider implements ObjectProvider
+public class SessionBeanProvider<T> implements ObjectProvider<T>
 {
 //**********************************************************************************************************************
 // Fields
@@ -67,7 +67,8 @@
 // ObjectProvider Implementation
 //**********************************************************************************************************************
 
-    public Object getObject()
+    @SuppressWarnings("unchecked")
+    public T getObject()
     {
         try
         {
@@ -75,7 +76,7 @@
                     new InitialContext(properties);
             Object homeObject = PortableRemoteObject.narrow(initialContext.lookup(jndiName), homeInterface);
             final Method createMethod = homeObject.getClass().getMethod("create", ProxyUtils.EMPTY_ARGUMENT_TYPES);
-            return createMethod.invoke(homeObject, ProxyUtils.EMPTY_ARGUMENTS);
+            return (T)createMethod.invoke(homeObject, ProxyUtils.EMPTY_ARGUMENTS);
         }
         catch( NoSuchMethodException e )
         {

Modified: commons/proper/proxy/branches/version-2.0-work/src/test/java/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/src/test/java/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java?rev=645232&r1=645231&r2=645232&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/src/test/java/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/src/test/java/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java Sun Apr  6 05:35:32 2008
@@ -35,11 +35,11 @@
 import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.util.Date;
 
 /**
  * @author James Carman
@@ -87,7 +87,7 @@
 
     public void testDelegatorHashCode() throws Exception
     {
-        final Echo proxy = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
+        final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
         assertEquals(proxy.hashCode(), System.identityHashCode(proxy));
     }
 
@@ -116,9 +116,9 @@
     public void testDelegatorEquals() throws Exception
     {
         final Date date = new Date();
-        final Comparable proxy1 = (Comparable) factory.createDelegatorProxy(new ConstantProvider(date),
+        final Comparable proxy1 = (Comparable) factory.createDelegatorProxy(new ConstantProvider<Date>(date),
                 COMPARABLE_ONLY);
-        final Comparable proxy2 = (Comparable) factory.createDelegatorProxy(new ConstantProvider(date),
+        final Comparable proxy2 = (Comparable) factory.createDelegatorProxy(new ConstantProvider<Date>(date),
                 COMPARABLE_ONLY);
         assertEquals(proxy1, proxy1);
         assertFalse(proxy1.equals(proxy2));
@@ -134,8 +134,8 @@
 
     public void testCanProxy()
     {
-        assertTrue(factory.canProxy(ECHO_ONLY));
-        assertFalse(factory.canProxy(new Class[]{EchoImpl.class}));
+        assertTrue(factory.canProxy(Echo.class));
+        assertFalse(factory.canProxy(EchoImpl.class));
     }
 
     public void testChangingArguments()
@@ -162,24 +162,24 @@
 
     public void testDelegatingProxyClassCaching() throws Exception
     {
-        final Echo proxy1 = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
-        final Echo proxy2 = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
+        final Echo proxy1 = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
+        final Echo proxy2 = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
         assertNotSame(proxy1, proxy2);
         assertSame(proxy1.getClass(), proxy2.getClass());
     }
 
     public void testDelegatingProxyInterfaceOrder()
     {
-        final Echo echo = (Echo) factory.createDelegatorProxy(createSingletonEcho(), new Class[]{Echo.class, DuplicateEcho.class});
-        final List expected = new LinkedList(Arrays.asList(new Class[]{Echo.class, DuplicateEcho.class}));
-        final List actual = new LinkedList(Arrays.asList(echo.getClass().getInterfaces()));
+        final Echo echo = (Echo) factory.createDelegatorProxy(createSingletonEcho(), Echo.class, DuplicateEcho.class);
+        final List<Class> expected = new LinkedList<Class>(Arrays.asList(Echo.class, DuplicateEcho.class));
+        final List<Class> actual = new LinkedList<Class>(Arrays.asList(echo.getClass().getInterfaces()));
         actual.retainAll(expected);  // Doesn't alter order!
         assertEquals(expected, actual);
     }
 
     public void testDelegatingProxySerializable() throws Exception
     {
-        final Echo proxy = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
+        final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
         assertSerializable(proxy);
     }
 
@@ -223,9 +223,10 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testInterfaceHierarchies()
     {
-        final SortedSet set = (SortedSet) factory.createDelegatorProxy(new ConstantProvider(new TreeSet()), new Class[]{SortedSet.class});
+        final SortedSet set = factory.createDelegatorProxy(new ConstantProvider<SortedSet>(new TreeSet()), SortedSet.class);
         set.add("Hello");
     }
 
@@ -234,7 +235,7 @@
         final InvokerTester tester = new InvokerTester();
         final Echo echo = (Echo) factory.createInvokerProxy(tester, ECHO_ONLY);
         echo.echoBack("hello");
-        assertEquals(Echo.class.getMethod("echoBack", new Class[]{String.class}), tester.method);
+        assertEquals(Echo.class.getMethod("echoBack", String.class), tester.method);
         assertSame(echo, tester.proxy);
         assertNotNull(tester.args);
         assertEquals(1, tester.args.length);
@@ -260,7 +261,7 @@
         final InterceptorTester tester = new InterceptorTester();
         final EchoImpl target = new EchoImpl();
         final Echo proxy1 = (Echo) factory.createInterceptorProxy(target, tester, ECHO_ONLY);
-        final Echo proxy2 = (Echo) factory.createInterceptorProxy(target, tester, new Class[]{Echo.class, DuplicateEcho.class});
+        final Echo proxy2 = (Echo) factory.createInterceptorProxy(target, tester, Echo.class, DuplicateEcho.class);
         proxy1.echoBack("hello1");
         final Class invocationClass1 = tester.invocationClass;
         proxy2.echoBack("hello2");
@@ -271,9 +272,9 @@
     {
         final InterceptorTester tester = new InterceptorTester();
         final EchoImpl target = new EchoImpl();
-        final Echo proxy = (Echo) factory.createInterceptorProxy(target, tester, new Class[]{Echo.class, DuplicateEcho.class});
+        final Echo proxy = (Echo) factory.createInterceptorProxy(target, tester, Echo.class, DuplicateEcho.class);
         proxy.echoBack("hello");
-        assertEquals(Echo.class.getMethod("echoBack", new Class[]{String.class}), tester.method);
+        assertEquals(Echo.class.getMethod("echoBack", String.class), tester.method);
     }
 
     public void testMethodInvocationImplementation() throws Exception
@@ -284,19 +285,19 @@
         proxy.echo();
         assertNotNull(tester.arguments);
         assertEquals(0, tester.arguments.length);
-        assertEquals(Echo.class.getMethod("echo", new Class[]{}), tester.method);
+        assertEquals(Echo.class.getMethod("echo"), tester.method);
         assertEquals(target, tester.proxy);
         proxy.echoBack("Hello");
         assertNotNull(tester.arguments);
         assertEquals(1, tester.arguments.length);
         assertEquals("Hello", tester.arguments[0]);
-        assertEquals(Echo.class.getMethod("echoBack", new Class[]{String.class}), tester.method);
+        assertEquals(Echo.class.getMethod("echoBack", String.class), tester.method);
         proxy.echoBack("Hello", "World");
         assertNotNull(tester.arguments);
         assertEquals(2, tester.arguments.length);
         assertEquals("Hello", tester.arguments[0]);
         assertEquals("World", tester.arguments[1]);
-        assertEquals(Echo.class.getMethod("echoBack", new Class[]{String.class, String.class}), tester.method);
+        assertEquals(Echo.class.getMethod("echoBack", String.class, String.class), tester.method);
     }
 
     public void testPrimitiveParameter()
@@ -307,7 +308,7 @@
 
     public void testProxyWithCheckedException() throws Exception
     {
-        final Echo proxy = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
+        final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
         try
         {
             proxy.ioException();
@@ -320,7 +321,7 @@
 
     public void testProxyWithUncheckedException() throws Exception
     {
-        final Echo proxy = (Echo) factory.createDelegatorProxy(new ConstantProvider(new EchoImpl()), ECHO_ONLY);
+        final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class);
         try
         {
             proxy.illegalArgument();



Mime
View raw message