net.sf.cglib
Class BeforeAfterInterceptor
java.lang.Object
|
+--net.sf.cglib.BeforeAfterInterceptor
- All Implemented Interfaces:
- MethodInterceptor
- Direct Known Subclasses:
- BeforeAfterAdapter
- public abstract class BeforeAfterInterceptor
- extends java.lang.Object
- implements MethodInterceptor
An implementation of MethodInterceptor provides separate callbacks for
code to execute before and after the original method execution.
- Version:
- $Id: BeforeAfterInterceptor.java,v 1.9 2003/05/13 06:17:09 herbyderby Exp $
- Author:
- Juozas Baliuka baliuka@mwm.lt
Method Summary |
abstract java.lang.Object |
afterReturn(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args,
boolean invokedSuper,
java.lang.Object retValFromSuper,
java.lang.Throwable e)
This method is called after invoking the super (non-intercepted) method, or
directly after the invokeSuper interceptor method, if it returned false. |
java.lang.Object |
intercept(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args,
MethodProxy proxy)
All generated proxied methods call this method instead of the original method.
|
abstract boolean |
invokeSuper(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args)
This method is called before invoking the super (non-intercepted) method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BeforeAfterInterceptor
public BeforeAfterInterceptor()
intercept
public java.lang.Object intercept(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args,
MethodProxy proxy)
throws java.lang.Throwable
- Description copied from interface:
MethodInterceptor
- All generated proxied methods call this method instead of the original method.
The original method may either be invoked by normal reflection using the Method object,
or by using the MethodProxy (faster).
- Specified by:
intercept
in interface MethodInterceptor
- Following copied from interface:
net.sf.cglib.MethodInterceptor
- Parameters:
obj
- "this", the enhanced objectmethod
- intercepted Methodargs
- argument array; primitive types are wrappedproxy
- used to invoke super (non-intercepted method); may be called
as many times as needed- Returns:
- any value compatible with the signature of the proxied method. Method returning void will ignore this value.
- Throws:
java.lang.Throwable
- any exception may be thrown; if so, super method will not be invoked- See Also:
MethodProxy
invokeSuper
public abstract boolean invokeSuper(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- This method is called before invoking the super (non-intercepted) method.
- Parameters:
obj
- "this", the enhanced objectmethod
- intercepted Methodargs
- argument array; primitive types are wrapped- Returns:
- true to invoke super method, false to skip
- Throws:
java.lang.Throwable
- any exception may be thrown; super method will not be invoked
afterReturn
public abstract java.lang.Object afterReturn(java.lang.Object obj,
java.lang.reflect.Method method,
java.lang.Object[] args,
boolean invokedSuper,
java.lang.Object retValFromSuper,
java.lang.Throwable e)
throws java.lang.Throwable
- This method is called after invoking the super (non-intercepted) method, or
directly after the invokeSuper interceptor method, if it returned false.
- Parameters:
obj
- "this", the enhanced objectmethod
- intercepted Methodargs
- argument array; primitive types are wrappedinvokedSuper
- whether the super method was invokedretValFromSuper
- value returned from super (unless there was an exception)e
- Throwable thrown by the super method (if any)- Returns:
- value to return from generated method; primitive will be unwrapped if necessary
- Throws:
java.lang.Throwable
- any exception may be thrown
Copyright © 2002-2003 cglib. All Rights Reserved.