Package de.tsl2.nano.util
Class AOPProxy<T>
java.lang.Object
de.tsl2.nano.core.util.DelegationHandler<T>
de.tsl2.nano.util.AOPProxy<T>
- All Implemented Interfaces:
de.tsl2.nano.core.util.IDelegationHandler<T>,Serializable,Cloneable,InvocationHandler
public class AOPProxy<T>
extends de.tsl2.nano.core.util.DelegationHandler<T>
simple proxy to enable aop-like enhancement.
- Version:
- $Revision$
- Author:
- Thomas Schneider
- See Also:
-
Field Summary
Fields inherited from class de.tsl2.nano.core.util.DelegationHandler
delegate, interfaces, properties -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class de.tsl2.nano.core.util.DelegationHandler
canDelegate, clone, createProxy, getDelegate, getInterfaces, getMethodArgsId, getProperties, initDeserialization, invokeDelegate, setInterfaces, setProperty, toString
-
Constructor Details
-
AOPProxy
public AOPProxy(T delegate, de.tsl2.nano.core.execution.ICRunnable<?> before, de.tsl2.nano.core.execution.ICRunnable<?> after, boolean proxyResult) constructor- Parameters:
delegate- original instancebefore- (optional) action to execute. will be run with arguments instance, method, and args - before executing the original method.after- (optional) action to execute. will be run with arguments instance, method, and args - after executing the original method.proxyResult- whether to wrap the result into a new proxy (recursive).
-
-
Method Details
-
invoke
- Specified by:
invokein interfaceInvocationHandler- Overrides:
invokein classde.tsl2.nano.core.util.DelegationHandler<T>- Throws:
Throwable
-
createEnhancement
public static final <T> T createEnhancement(T instance, de.tsl2.nano.core.execution.ICRunnable<?> before, de.tsl2.nano.core.execution.ICRunnable<?> after, boolean proxyResult) createEnhancement- Type Parameters:
T-- Parameters:
instance- delegatebefore- (optional) action to execute. will be run with arguments instance, method, and args - before executing the original method.after- (optional) action to execute. will be run with arguments instance, method, and args - after executing the original method.proxyResult- whether to wrap the result into a new proxy (recursive).- Returns:
-