org.aopalliance.intercept.MethodInvocation interface,
implementing the extended
org.springframework.aop.ProxyMethodInvocation interface.
Invokes the target object using reflection. Subclasses can override the
invokeJoinpoint() method to change this behavior, so this is also
a useful base class for more specialized MethodInvocation implementations.
It is possible to clone an invocation, to invoke proceed()
repeatedly (once per clone), using the invocableClone() method.
It is also possible to attach custom attributes to the invocation,
using the setUserAttribute / getUserAttribute methods.
Note
This class is considered internal and should not be
directly accessed. The sole reason for it being public is compatibility
with existing framework integrations (e.g. Pitchfork). For any other
purposes, use the ProxyMethodInvocation interface instead.
invokeJoinpoint, proceed, invocableClone, setUserAttribute, getUserAttribute
| Modifier and Type | Field and Description |
|---|---|
| protected Object[] | |
| private int | currentInterceptorIndex
Index from 0 of the current interceptor we're invoking. |
| protected final List | interceptorsAndDynamicMethodMatchers
List of MethodInterceptor and InterceptorAndDynamicMethodMatcher that need dynamic checks. |
| protected final Method | |
| protected final Object | |
| protected final Object | |
| private final Class | |
| private Map | userAttributes
Lazily initialized map of user-specific attributes for this invocation. |
| Access | Constructor and Description |
|---|---|
| protected | ReflectiveMethodInvocation(Object
the proxy object that the invocation was made on proxy, Object the target object to invoke target, Method the method to invoke method, Object[] the arguments to invoke the method with arguments, Class<?> the target class, for MethodMatcher invocations targetClass, List<Object> interceptors that should be applied,
along with any InterceptorAndDynamicMethodMatchers that need evaluation at runtime.
MethodMatchers included in this struct must already have been found to have matched
as far as was possibly statically. Passing an array might be about 10% faster,
but would complicate the code. And it would work only for static pointcuts. interceptorsAndDynamicMethodMatchers)Construct a new ReflectiveMethodInvocation with the given arguments. |
| Modifier and Type | Method and Description |
|---|---|
| public final Object[] | getArguments()
Implements org. Get the arguments as an array object. |
| public final Method | getMethod()
Implements org. Return the method invoked on the proxied interface. |
| public final Object | getProxy()
Implements org. Return the proxy that this method invocation was made through. |
| public final AccessibleObject | getStaticPart()
Implements org. Return the static part of this joinpoint. |
| public final Object | getThis()
Implements org. Return the object that holds the current joinpoint's static part. |
| public Object | getUserAttribute(String
the name of the attribute key)Implements org. Return the value of the specified user attribute. |
| public Map | Returns: any user attributes associated with this invocation (nevernull)Return user attributes associated with this invocation. |
| public MethodInvocation | invocableClone()
Implements org. This implementation returns a shallow copy of this invocation object, including an independent copy of the original arguments array. |
| public MethodInvocation | invocableClone(Object...
the arguments that the cloned invocation is supposed to use,
overriding the original arguments arguments)Implements org. This implementation returns a shallow copy of this invocation object, using the given arguments array for the clone. |
| protected Object | |
| public Object | proceed()
Implements org. Proceed to the next interceptor in the chain. |
| public void | setArguments(Object...
the argument array arguments)Implements org. Set the arguments to be used on subsequent invocations in the any advice in this chain. |
| public void | setUserAttribute(String
the name of the attribute key, Object the value of the attribute, or value)null to reset itImplements org. Add the specified user attribute with the given value to this invocation. |
| public String |
| arguments | back to summary |
|---|---|
| protected Object[] arguments | |
| currentInterceptorIndex | back to summary |
|---|---|
| private int currentInterceptorIndex Index from 0 of the current interceptor we're invoking. -1 until we invoke: then the current interceptor. | |
| interceptorsAndDynamicMethodMatchers | back to summary |
|---|---|
| protected final List<?> interceptorsAndDynamicMethodMatchers List of MethodInterceptor and InterceptorAndDynamicMethodMatcher that need dynamic checks. | |
| method | back to summary |
|---|---|
| protected final Method method | |
| proxy | back to summary |
|---|---|
| protected final Object proxy | |
| target | back to summary |
|---|---|
| protected final Object target
| |
| targetClass | back to summary |
|---|---|
| private final Class<?> targetClass
| |
| userAttributes | back to summary |
|---|---|
| private Map<String, Object> userAttributes Lazily initialized map of user-specific attributes for this invocation. | |
| ReflectiveMethodInvocation | back to summary |
|---|---|
| protected ReflectiveMethodInvocation(Object proxy, Object target, Method method, Object[] arguments, Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) Construct a new ReflectiveMethodInvocation with the given arguments.
| |
| getArguments | back to summary |
|---|---|
| public final Object[] getArguments() Implements org. Doc from org. Get the arguments as an array object. It is possible to change element values within this array to change the arguments. | |
| getMethod | back to summary |
|---|---|
| public final Method getMethod() Implements org. Return the method invoked on the proxied interface. May or may not correspond with a method invoked on an underlying implementation of that interface.
| |
| getProxy | back to summary |
|---|---|
| public final Object getProxy() Implements org. Doc from org. Return the proxy that this method invocation was made through. | |
| getStaticPart | back to summary |
|---|---|
| public final AccessibleObject getStaticPart() Implements org. Doc from org. Return the static part of this joinpoint. The static part is an accessible object on which a chain of interceptors is installed.
| |
| getThis | back to summary |
|---|---|
| public final Object getThis() Implements org. Doc from org. Return the object that holds the current joinpoint's static part. For instance, the target object for an invocation. | |
| getUserAttribute | back to summary |
|---|---|
| public Object getUserAttribute(String key) Implements org. Doc from org. Return the value of the specified user attribute. | |
| getUserAttributes | back to summary |
|---|---|
| public Map Return user attributes associated with this invocation. This method provides an invocation-bound alternative to a ThreadLocal. This map is initialized lazily and is not used in the AOP framework itself. | |
| invocableClone | back to summary |
|---|---|
| public MethodInvocation invocableClone() Implements org. This implementation returns a shallow copy of this invocation object, including an independent copy of the original arguments array. We want a shallow copy in this case: We want to use the same interceptor chain and other object references, but we want an independent value for the current interceptor index.
| |
| invocableClone | back to summary |
|---|---|
| public MethodInvocation invocableClone(Object... arguments) Implements org. This implementation returns a shallow copy of this invocation object, using the given arguments array for the clone. We want a shallow copy in this case: We want to use the same interceptor chain and other object references, but we want an independent value for the current interceptor index.
| |
| invokeJoinpoint | back to summary |
|---|---|
| protected Object invokeJoinpoint() throws Throwable Invoke the joinpoint using reflection. Subclasses can override this to use custom invocation. | |
| proceed | back to summary |
|---|---|
| public Object proceed() throws Throwable Implements org. Doc from org. Proceed to the next interceptor in the chain. The implementation and the semantics of this method depends on the actual joinpoint type (see the children interfaces). | |
| setArguments | back to summary |
|---|---|
| public void setArguments(Object... arguments) Implements org. Doc from org. Set the arguments to be used on subsequent invocations in the any advice in this chain. | |
| setUserAttribute | back to summary |
|---|---|
| public void setUserAttribute(String key, Object value) Implements org. Doc from org. Add the specified user attribute with the given value to this invocation. Such attributes are not used within the AOP framework itself. They are just kept as part of the invocation object, for use in special interceptors. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |