deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [2/2] deltaspike git commit: DELTASPIKE-851 added some javadoc
Date Mon, 04 May 2015 20:15:22 GMT
DELTASPIKE-851 added some javadoc

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

Branch: refs/heads/master
Commit: 38b1fa25261fff29bd36f78d389686d4ff0e55b7
Parents: e3c9caa
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon May 4 22:14:13 2015 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon May 4 22:14:13 2015 +0200

----------------------------------------------------------------------
 .../proxy/util/AsmProxyClassGenerator.java      | 32 ++++++++++----------
 .../deltaspike/proxy/util/DeltaSpikeProxy.java  |  2 +-
 .../proxy/util/DeltaSpikeProxyFactory.java      | 11 ++++---
 3 files changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/38b1fa25/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/AsmProxyClassGenerator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/AsmProxyClassGenerator.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/AsmProxyClassGenerator.java
index 437ec8f..d7c8671 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/AsmProxyClassGenerator.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/AsmProxyClassGenerator.java
@@ -52,7 +52,7 @@ public abstract class AsmProxyClassGenerator
 
     public static <T> Class<T> generateProxyClass(ClassLoader classLoader,
             Class<T> targetClass,
-            Class<? extends InvocationHandler> invocationHandlerClass,
+            Class<? extends InvocationHandler> delegateInvocationHandlerClass,
             String suffix,
             String superAccessorMethodSuffix,
             Class<?>[] additionalInterfaces,
@@ -62,7 +62,7 @@ public abstract class AsmProxyClassGenerator
         String proxyName = targetClass.getCanonicalName() + suffix;
         String classFileName = proxyName.replace('.', '/');
 
-        byte[] proxyBytes = generateProxyClassBytes(targetClass, invocationHandlerClass,
+        byte[] proxyBytes = generateProxyClassBytes(targetClass, delegateInvocationHandlerClass,
                 classFileName, superAccessorMethodSuffix, additionalInterfaces, delegateMethods,
interceptMethods);
 
         Class<T> proxyClass = (Class<T>) loadClass(classLoader, proxyName, proxyBytes,
@@ -72,7 +72,7 @@ public abstract class AsmProxyClassGenerator
     }
 
     private static byte[] generateProxyClassBytes(Class<?> targetClass,
-            Class<? extends InvocationHandler> invocationHandlerClass,
+            Class<? extends InvocationHandler> delegateInvocationHandlerClass,
             String proxyName,
             String superAccessorMethodSuffix,
             Class<?>[] additionalInterfaces,
@@ -103,7 +103,7 @@ public abstract class AsmProxyClassGenerator
 
         Type superType = Type.getType(superClass);
         Type proxyType = Type.getObjectType(proxyName);
-        Type invocationHandlerType = Type.getType(invocationHandlerClass);
+        Type delegateInvocationHandlerType = Type.getType(delegateInvocationHandlerClass);
 
         ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
         cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, proxyType.getInternalName(),
null,
@@ -115,10 +115,10 @@ public abstract class AsmProxyClassGenerator
             cw.visitAnnotation(Type.getDescriptor(annotation.annotationType()), true).visitEnd();
         }
 
-        defineInvocationHandlerField(cw, invocationHandlerType);
+        defineInvocationHandlerField(cw, delegateInvocationHandlerType);
         defineDefaultConstructor(cw, proxyType, superType);
-        defineDelegateInvocationHandlerConstructor(cw, proxyType, superType, invocationHandlerType);
-        defineDeltaSpikeProxyMethods(cw, proxyType, invocationHandlerType);
+        defineDelegateInvocationHandlerConstructor(cw, proxyType, superType, delegateInvocationHandlerType);
+        defineDeltaSpikeProxyMethods(cw, proxyType, delegateInvocationHandlerType);
 
         for (java.lang.reflect.Method method : delegateMethods)
         {
@@ -134,12 +134,12 @@ public abstract class AsmProxyClassGenerator
         return cw.toByteArray();
     }
 
-    private static void defineInvocationHandlerField(ClassWriter cw, Type invocationHandlerType)
+    private static void defineInvocationHandlerField(ClassWriter cw, Type delegateInvocationHandlerType)
     {
         // generates
         // private MyInvocationHandler delegateInvocationHandler;
         cw.visitField(Opcodes.ACC_PRIVATE, FIELDNAME_DELEGATE_INVOCATION_HANDLER,
-                invocationHandlerType.getDescriptor(), null, null).visitEnd();
+                delegateInvocationHandlerType.getDescriptor(), null, null).visitEnd();
     }
 
     private static void defineDefaultConstructor(ClassWriter cw, Type proxyType, Type superType)
@@ -162,10 +162,10 @@ public abstract class AsmProxyClassGenerator
     }
     
     private static void defineDelegateInvocationHandlerConstructor(ClassWriter cw, Type proxyType,
Type superType,
-            Type invocationHandlerType)
+            Type delegateInvocationHandlerType)
     {
         GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC,
-                new Method("<init>", Type.VOID_TYPE, new Type[] { invocationHandlerType
}),
+                new Method("<init>", Type.VOID_TYPE, new Type[] { delegateInvocationHandlerType
}),
                 null,
                 null,
                 cw);
@@ -179,7 +179,7 @@ public abstract class AsmProxyClassGenerator
         // set invocation handler
         mg.loadThis();
         mg.loadArg(0);
-        mg.putField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, invocationHandlerType);
+        mg.putField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, delegateInvocationHandlerType);
         
         mg.returnValue();
         mg.endMethod();
@@ -187,7 +187,7 @@ public abstract class AsmProxyClassGenerator
         mg.visitEnd();
     }
 
-    private static void defineDeltaSpikeProxyMethods(ClassWriter cw, Type proxyType, Type
invocationHandlerType)
+    private static void defineDeltaSpikeProxyMethods(ClassWriter cw, Type proxyType, Type
delegateInvocationHandlerType)
     {
         try
         {
@@ -200,8 +200,8 @@ public abstract class AsmProxyClassGenerator
 
             mg.loadThis();
             mg.loadArg(0);
-            mg.checkCast(invocationHandlerType);
-            mg.putField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, invocationHandlerType);
+            mg.checkCast(delegateInvocationHandlerType);
+            mg.putField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, delegateInvocationHandlerType);
             mg.returnValue();
 
             mg.visitMaxs(2, 1);
@@ -215,7 +215,7 @@ public abstract class AsmProxyClassGenerator
             mg.visitCode();
 
             mg.loadThis();
-            mg.getField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, invocationHandlerType);
+            mg.getField(proxyType, FIELDNAME_DELEGATE_INVOCATION_HANDLER, delegateInvocationHandlerType);
             mg.returnValue();
 
             mg.visitMaxs(2, 1);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/38b1fa25/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
index cc3ed09..e4830e7 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
@@ -25,7 +25,7 @@ import java.lang.reflect.InvocationHandler;
  */
 public interface DeltaSpikeProxy
 {
-    void setDelegateInvocationHandler(InvocationHandler redirectInvocationHandler);
+    void setDelegateInvocationHandler(InvocationHandler delegateInvocationHandler);
 
     InvocationHandler getDelegateInvocationHandler();
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/38b1fa25/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
index 7a8ae2f..73d966b 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
@@ -34,20 +34,20 @@ public abstract class DeltaSpikeProxyFactory
     private static final String SUPER_ACCESSOR_METHOD_SUFFIX = "$super";
     
     public <T> Class<T> getProxyClass(Class<T> targetClass,
-            Class<? extends InvocationHandler> invocationHandlerClass)
+            Class<? extends InvocationHandler> delegateInvocationHandlerClass)
     {
         // check if a proxy is already defined for this class
         Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass),
targetClass);
         if (proxyClass == null)
         {
-            proxyClass = createProxyClass(targetClass.getClassLoader(), targetClass, invocationHandlerClass);
+            proxyClass = createProxyClass(targetClass.getClassLoader(), targetClass, delegateInvocationHandlerClass);
         }
 
         return proxyClass;
     }
 
     private synchronized <T> Class<T> createProxyClass(ClassLoader classLoader,
Class<T> targetClass,
-            Class<? extends InvocationHandler> invocationHandlerClass)
+            Class<? extends InvocationHandler> delegateInvocationHandlerClass)
     {
         Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass),
targetClass);
         if (proxyClass == null)
@@ -61,7 +61,8 @@ public abstract class DeltaSpikeProxyFactory
                     && interceptMethods.size() > 0
                     && !containsInterceptorBinding(targetClass.getDeclaredAnnotations()))
             {
-                // loop every method and check if a interceptor is defined on the method
-> otherwise don't proxy
+                // loop every method and check if a interceptor is defined on the method
-> otherwise don't overwrite
+                // interceptMethods
                 Iterator<Method> iterator = interceptMethods.iterator();
                 while (iterator.hasNext())
                 {
@@ -75,7 +76,7 @@ public abstract class DeltaSpikeProxyFactory
             
             proxyClass = AsmProxyClassGenerator.generateProxyClass(classLoader,
                     targetClass,
-                    invocationHandlerClass,
+                    delegateInvocationHandlerClass,
                     getProxyClassSuffix(),
                     SUPER_ACCESSOR_METHOD_SUFFIX,
                     getAdditionalInterfacesToImplement(targetClass),


Mime
View raw message