You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2013/01/05 23:21:22 UTC
svn commit: r1429403 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
Author: struberg
Date: Sat Jan 5 22:21:22 2013
New Revision: 1429403
URL: http://svn.apache.org/viewvc?rev=1429403&view=rev
Log:
OWB-344 getInternalInstance and JavaDoc
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java?rev=1429403&r1=1429402&r2=1429403&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java Sat Jan 5 22:21:22 2013
@@ -94,14 +94,50 @@ public class InterceptorDecoratorProxyFa
}
}
+ /**
+ * @return the internal instance which gets proxied.
+ */
+ public <T> T getInternalInstance(OwbInterceptorProxy proxyInstance)
+ {
+ try
+ {
+ Field internalInstanceField = proxyInstance.getClass().getDeclaredField(FIELD_PROXIED_INSTANCE);
+ internalInstanceField.setAccessible(true);
+ return (T) internalInstanceField.get(proxyInstance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
/**
- * Create a decorator and interceptor proxy for the given type.
+ * <p>Create a decorator and interceptor proxy for the given type. A single instance
+ * of such a proxy class has exactly one single internal instance.</p>
+ *
+ * <p>There are 3 different kind of methods:
+ * <ol>
+ * <li>
+ * private methods - they do not get proxied at all! If you like to invoke a private method,
+ * then you can use {@link #getInternalInstance(OwbInterceptorProxy)} and use reflection on it.
+ * </li>
+ * <li>
+ * non-proxied methods - all methods which do not have a business interceptor nor decorator
+ * will get delegated to the internal instance without invoking any InterceptorHandler nor
+ * doing reflection. Just plain java bytecode will get generated!
+ * </li>
+ * <li>
+ * proxied methods - all calls to such a proxied method will get forwarded to the
+ * InterceptorHandler which got set for this instance.
+ * </li>
+ * </ol>
+ * </p>
*
*
* @param classLoader to use for creating the class in
- * @param classToProxy
- * @param interceptedMethods the list of intercepted or decorated methods
+ * @param classToProxy the class for which a subclass will get generated
+ * @param interceptedMethods the list of intercepted or decorated business methods.
* @param nonInterceptedMethods all methods which are <b>not</b> intercepted nor decorated and shall get delegated directly
* @param <T>
* @return the proxy class