You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ta...@apache.org on 2015/09/14 22:25:26 UTC

deltaspike git commit: DELTASPIKE-952 Document Proxy Module

Repository: deltaspike
Updated Branches:
  refs/heads/master 6d89d1dc8 -> 08dd95a31


DELTASPIKE-952 Document Proxy Module

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

Branch: refs/heads/master
Commit: 08dd95a3122a98cfc15dfab97efb2529d8a5cdf1
Parents: 6d89d1d
Author: Thomas Andraschko <ta...@apache.org>
Authored: Mon Sep 14 22:25:17 2015 +0200
Committer: Thomas Andraschko <ta...@apache.org>
Committed: Mon Sep 14 22:25:17 2015 +0200

----------------------------------------------------------------------
 .../proxy/spi/ProxyClassGenerator.java          | 20 ++++++++++++++++++++
 .../proxy/impl/AsmProxyClassGenerator.java      |  1 +
 documentation/src/main/asciidoc/proxy.adoc      |  4 +++-
 3 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/08dd95a3/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 5898e7a..355168f 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
@@ -22,6 +22,26 @@ import java.lang.reflect.InvocationHandler;
 
 public interface ProxyClassGenerator
 {
+    /**
+     * Generates a proxy class from the given source class.
+     * The proxy class will be generated in the same package as the original class
+     * and the suffix will be appended to the name of the class.
+     * 
+     * @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
+     *                                  and append the suffix.
+     * @param additionalInterfaces Additional interfaces which should be implemented.
+     * @param delegateMethods Methods which should be delegated to the {@code delegateInvocationHandlerClass}
+     *                        instead of invoking the original method.
+     * @param interceptMethods Methods which should be intercepted (to call interceptors or decorators)
+     *                         before invoking the original method.
+     * @return The generated proxy class.
+     */
     <T> Class<T> generateProxyClass(ClassLoader classLoader,
                                     Class<T> targetClass,
                                     Class<? extends InvocationHandler> delegateInvocationHandlerClass,

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/08dd95a3/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java b/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java
index c33d11c..59860e4 100644
--- a/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java
+++ b/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java
@@ -47,6 +47,7 @@ public class AsmProxyClassGenerator implements ProxyClassGenerator
     private static final Type TYPE_CLASS = Type.getType(Class.class);
     private static final Type TYPE_OBJECT = Type.getType(Object.class);
 
+    @Override
     public <T> Class<T> generateProxyClass(ClassLoader classLoader,
             Class<T> targetClass,
             Class<? extends InvocationHandler> delegateInvocationHandlerClass,

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/08dd95a3/documentation/src/main/asciidoc/proxy.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/proxy.adoc b/documentation/src/main/asciidoc/proxy.adoc
index 7db0c11..e2d1c04 100644
--- a/documentation/src/main/asciidoc/proxy.adoc
+++ b/documentation/src/main/asciidoc/proxy.adoc
@@ -5,7 +5,9 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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.
 
 == Overview
-The Proxy Module provides a simple CDI based wrapper for creating dynamic proxies that can be used within other extensions.
+The Proxy Module provides a simple CDI based wrapper for creating dynamic proxies that can be used within other extensions. +
+The benefit of the DeltaSpike Proxy Module (compared to Javassist or any library) is that the DeltaSpike proxies will execute CDI interceptors. +
+The Proxy Module also provides the 'DeltaSpikeProxyContextualLifecycle', which enables you to dynamically register a proxy as CDI bean via our 'BeanBuilder'.
 
 === 1. Declare Proxy Module Dependencies