public class InvocationContextImpl extends Object implements InvocationContext
Modifier and Type | Class and Description |
---|---|
static class |
InvocationContextImpl.InterceptorInvocation |
Constructor and Description |
---|
InvocationContextImpl(Object target,
Method method,
Object[] args,
List<InvocationContextImpl.InterceptorInvocation> chain) |
Modifier and Type | Method and Description |
---|---|
Constructor<?> |
getConstructor()
Returns the constructor of the target class for which the
AroundConstruct interceptor method was invoked. |
Map<String,Object> |
getContextData()
Enables an interceptor to retrieve or update the data associated with the invocation by another interceptor, business
method, and/or webservices endpoint in the invocation chain.
|
Method |
getMethod()
Returns the method of the target class for which the interceptor was invoked.
|
Object[] |
getParameters()
Returns the parameter values that will be passed to the method or constructor of the target class.
|
Object |
getTarget()
Returns the target instance.
|
Object |
getTimer()
Returns the timer object associated with a timeout method invocation on the target class, or a null value for
interceptor method types other than
AroundTimeout . |
protected Object |
interceptorChainCompleted() |
protected Object |
invokeNext() |
Object |
proceed()
Proceed to the next interceptor in the interceptor chain.
|
void |
setParameters(Object[] params)
Sets the parameter values that will be passed to the method or constructor of the target class.
|
public InvocationContextImpl(Object target, Method method, Object[] args, List<InvocationContextImpl.InterceptorInvocation> chain)
target
- method
- args
- chain
- protected Object interceptorChainCompleted() throws Exception
Exception
public Object proceed() throws Exception
InvocationContext
proceed
in the last interceptor method in the chain causes the invocation of the target
class method. For AroundConstruct
lifecycle callback interceptor methods, the invocation of proceed
in the last interceptor method in the chain causes the target instance to be created. For all other lifecycle
callback interceptor methods, if there is no callback method defined on the target class, the invocation of proceed
in the last interceptor method in the chain is a no-op.
Return the result of the next method invoked, or a null value if the method has return type void.
proceed
in interface InvocationContext
Exception
- if thrown by target method or interceptor method in call stackpublic Object getTarget()
InvocationContext
AroundConstruct
lifecycle callback interceptor methods, the
getTarget
method returns null
if called before the InvocationContext.proceed()
method.getTarget
in interface InvocationContext
public Method getMethod()
InvocationContext
AroundConstruct
lifecycle callback interceptor method.getMethod
in interface InvocationContext
public Constructor<?> getConstructor()
InvocationContext
AroundConstruct
interceptor method was invoked.
Returns null for interceptor method types other than AroundConstruct
interceptor methods.getConstructor
in interface InvocationContext
public Object[] getParameters() throws IllegalStateException
InvocationContext
InvocationContext.setParameters(java.lang.Object[])
has been called, getParameters
returns the values to which the parameters have
been set.getParameters
in interface InvocationContext
IllegalStateException
- if invoked within a lifecycle callback method that is not an
AroundConstruct
callback.public void setParameters(Object[] params) throws IllegalStateException, IllegalArgumentException
InvocationContext
setParameters
in interface InvocationContext
params
- the parameter values, as an arrayIllegalStateException
- if invoked within a lifecycle callback method that is not an
AroundConstruct
callback.IllegalArgumentException
- if the types of the given parameter values do not match the types of
the method or constructor parameters, or if the number of parameters supplied does not equal the number of method or
constructor parameters (if the last parameter is a vararg parameter of type T
, it is considered to be
equivalent to a parameter of type T[]
).public Map<String,Object> getContextData()
InvocationContext
javax.xml.rpc.handler.MessageContext
.getContextData
in interface InvocationContext
Map<String,Object>
object will be returned.public Object getTimer()
InvocationContext
AroundTimeout
. For example, when associated with an Jakarta Enterprise
Beans component timeout, this method returns javax.ejb.Timer.getTimer
in interface InvocationContext
Copyright © 2019 JBoss by Red Hat. All rights reserved.