|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface InvocationContext
Exposes context information about the intercepted invocation and operations that enable interceptor methods to control the behavior of the invocation chain.
@AroundInvoke public Object logInvocation(InvocationContext ctx) throws Exception { String class = ctx.getMethod().getDeclaringClass().getName(); String method = ctx.getMethod().getName(); Logger.global.entering(class, method, ctx.getParameters()); try { Object result = ctx.proceed(); Logger.global.exiting(class, method, result); return result; } catch (Exception e) { Logger.global.throwing(class, method, e); throw e; } }
Method Summary | |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getContextData()
Returns the context data associated with this invocation or lifecycle callback. |
java.lang.reflect.Method |
getMethod()
Returns the method of the target class for which the interceptor was invoked. |
java.lang.Object[] |
getParameters()
Returns the parameter values that will be passed to the method of the target class. |
java.lang.Object |
getTarget()
Returns the target instance. |
java.lang.Object |
getTimer()
Returns the timer object associated with a timeout method invocation on the target class, or a null value for method and lifecycle callback interceptor methods. |
java.lang.Object |
proceed()
Proceed to the next interceptor in the interceptor chain. |
void |
setParameters(java.lang.Object[] params)
Sets the parameter values that will be passed to the method of the target class. |
Method Detail |
---|
java.lang.Object getTarget()
java.lang.Object getTimer()
Timer
java.lang.reflect.Method getMethod()
java.lang.Object[] getParameters()
setParameters()
has been called,
getParameters()
returns the values to which the parameters
have been set.
java.lang.IllegalStateException
- if invoked within
a lifecycle callback method.void setParameters(java.lang.Object[] params)
params
- the parameter values, as an array
java.lang.IllegalStateException
- if invoked within
a lifecycle callback method.
java.lang.IllegalArgumentException
- if the types of the
given parameter values do not match the types of the method parameters,
or if the number of parameters supplied does not equal the number of
method parameters.java.util.Map<java.lang.String,java.lang.Object> getContextData()
Map<String,Object>
object will be returned.
java.lang.Object proceed() throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 10-February-2011 12:41