deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-1170 Proxy should be invocationHandler class independent
Date Tue, 07 Jun 2016 20:25:46 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 6c5f4d21c -> 857c932be


DELTASPIKE-1170 Proxy should be invocationHandler class independent

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/b3430a40
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/b3430a40
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/b3430a40

Branch: refs/heads/master
Commit: b3430a40764ff836d6350bd089e3584d1b82b479
Parents: 6c5f4d2
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Tue Jun 7 22:25:29 2016 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Tue Jun 7 22:25:29 2016 +0200

----------------------------------------------------------------------
 .../proxy/api/DeltaSpikeProxyContextualLifecycle.java |  4 ++--
 .../deltaspike/proxy/api/DeltaSpikeProxyFactory.java  | 14 +++-----------
 .../deltaspike/proxy/spi/ProxyClassGenerator.java     |  4 ----
 .../proxy/util/EnableInterceptorsProxyFactory.java    |  4 ++--
 4 files changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b3430a40/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyContextualLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyContextualLifecycle.java
b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyContextualLifecycle.java
index e550b88..a58e2e7 100644
--- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyContextualLifecycle.java
+++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyContextualLifecycle.java
@@ -59,7 +59,7 @@ public class DeltaSpikeProxyContextualLifecycle<T, H extends InvocationHandler>
     {
         this.targetClass = targetClass;
         this.delegateInvocationHandlerClass = delegateInvocationHandlerClass;
-        this.proxyClass = proxyFactory.getProxyClass(beanManager, targetClass, delegateInvocationHandlerClass);
+        this.proxyClass = proxyFactory.getProxyClass(beanManager, targetClass);
 
         if (!targetClass.isInterface())
         {
@@ -82,7 +82,7 @@ public class DeltaSpikeProxyContextualLifecycle<T, H extends InvocationHandler>
             else
             {
                 H delegateInvocationHandler = instantiateDelegateInvocationHandler();
-                Constructor<T> constructor = proxyClass.getConstructor(delegateInvocationHandlerClass);
+                Constructor<T> constructor = proxyClass.getConstructor(InvocationHandler.class);
                 instance = constructor.newInstance(delegateInvocationHandler);
             }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b3430a40/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
index 7721166..ce6bfc0 100644
--- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
+++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
@@ -96,27 +96,20 @@ public abstract class DeltaSpikeProxyFactory
         return proxyClass;
     }
     
-    public <T> Class<T> getProxyClass(BeanManager beanManager, Class<T>
targetClass,
-            Class<? extends InvocationHandler> delegateInvocationHandlerClass)
+    public <T> Class<T> getProxyClass(BeanManager beanManager, Class<T>
targetClass)
     {
         // check if a proxy is already defined for this class
         Class<T> proxyClass = resolveAlreadyDefinedProxyClass(targetClass);
         if (proxyClass == null)
         {
-            proxyClass = createProxyClass(beanManager, targetClass.getClassLoader(), targetClass,
-                    delegateInvocationHandlerClass);
+            proxyClass = createProxyClass(beanManager, targetClass.getClassLoader(), targetClass);
         }
 
         return proxyClass;
     }
-    
-    public <T> Class<T> getProxyClass(BeanManager beanManager, Class<T>
targetClass)
-    {
-        return getProxyClass(beanManager, targetClass, DummyInvocationHandler.class);
-    }
 
     private synchronized <T> Class<T> createProxyClass(BeanManager beanManager,
ClassLoader classLoader,
-            Class<T> targetClass, Class<? extends InvocationHandler> delegateInvocationHandlerClass)
+            Class<T> targetClass)
     {
         Class<T> proxyClass = resolveAlreadyDefinedProxyClass(targetClass);
         if (proxyClass == null)
@@ -147,7 +140,6 @@ public abstract class DeltaSpikeProxyFactory
 
             proxyClass = proxyClassGenerator.generateProxyClass(classLoader,
                     targetClass,
-                    delegateInvocationHandlerClass,
                     getProxyClassSuffix(),
                     SUPER_ACCESSOR_METHOD_SUFFIX,
                     getAdditionalInterfacesToImplement(targetClass),

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b3430a40/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/ProxyClassGenerator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/ProxyClassGenerator.java
b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/ProxyClassGenerator.java
index 355168f..cc9ffa6 100644
--- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/ProxyClassGenerator.java
+++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/ProxyClassGenerator.java
@@ -18,8 +18,6 @@
  */
 package org.apache.deltaspike.proxy.spi;
 
-import java.lang.reflect.InvocationHandler;
-
 public interface ProxyClassGenerator
 {
     /**
@@ -30,7 +28,6 @@ public interface ProxyClassGenerator
      * @param <T> The target class.
      * @param classLoader The {@link ClassLoader} to be used to define the proxy class.
      * @param targetClass The class to proxy.
-     * @param delegateInvocationHandlerClass The {@link InvocationHandler} which will be
used for the delegateMethods.
      * @param suffix The classname suffix.
      * @param superAccessorMethodSuffix It's required to generate methods which just invokes
the original method.
      *                                  We generate them with the same name as the original
method
@@ -44,7 +41,6 @@ public interface ProxyClassGenerator
      */
     <T> Class<T> generateProxyClass(ClassLoader classLoader,
                                     Class<T> targetClass,
-                                    Class<? extends InvocationHandler> delegateInvocationHandlerClass,
                                     String suffix,
                                     String superAccessorMethodSuffix,
                                     Class<?>[] additionalInterfaces,

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b3430a40/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java
b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java
index c39f95c..5bae19b 100644
--- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java
+++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsProxyFactory.java
@@ -43,7 +43,7 @@ public class EnableInterceptorsProxyFactory extends DeltaSpikeProxyFactory
         }
         
         // generate proxy
-        Class proxyClass = INSTANCE.getProxyClass(beanManager, obj.getClass(), EnableInterceptorsDelegate.class);
+        Class proxyClass = INSTANCE.getProxyClass(beanManager, obj.getClass());
 
         // delegate method calls to our original instance from the wrapped producer method
         EnableInterceptorsDelegate delegate = new EnableInterceptorsDelegate(obj);
@@ -51,7 +51,7 @@ public class EnableInterceptorsProxyFactory extends DeltaSpikeProxyFactory
         try
         {
             // instantiate proxy
-            Constructor constructor = proxyClass.getConstructor(EnableInterceptorsDelegate.class);
+            Constructor constructor = proxyClass.getConstructor(InvocationHandler.class);
             return (T) constructor.newInstance(delegate);
         }
         catch (Exception e)


Mime
View raw message