Class ReflectiveMethodInvocation
- All Implemented Interfaces:
- Cloneable,- Invocation,- Joinpoint,- MethodInvocation,- ProxyMethodInvocation
MethodInvocation interface,
 implementing the extended
 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(java.lang.String, java.lang.Object) / getUserAttribute(java.lang.String) 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 (for example, Pitchfork). For any other
 purposes, use the ProxyMethodInvocation interface instead.
- Author:
- Rod Johnson, Juergen Hoeller, Adrian Colyer
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedReflectiveMethodInvocation(Object proxy, @Nullable Object target, Method method, @Nullable Object[] arguments, @Nullable Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) Construct a new ReflectiveMethodInvocation with the given arguments.
- 
Method SummaryModifier and TypeMethodDescriptionGet the arguments as an array object.final MethodReturn the method invoked on the proxied interface.final ObjectgetProxy()Return the proxy that this method invocation was made through.final AccessibleObjectReturn the static part of this joinpoint.getThis()Return the object that holds the current joinpoint's static part.getUserAttribute(String key) Return the value of the specified user attribute.Return user attributes associated with this invocation.This implementation returns a shallow copy of this invocation object, including an independent copy of the original arguments array.invocableClone(@Nullable Object... arguments) This implementation returns a shallow copy of this invocation object, using the given arguments array for the clone.Invoke the joinpoint using reflection.proceed()Proceed to the next interceptor in the chain.voidsetArguments(@Nullable Object... arguments) Set the arguments to be used on subsequent invocations in the any advice in this chain.voidsetUserAttribute(String key, @Nullable Object value) Add the specified user attribute with the given value to this invocation.toString()
- 
Field Details- 
proxy
- 
target
- 
method
- 
arguments
- 
interceptorsAndDynamicMethodMatchersList of MethodInterceptor and InterceptorAndDynamicMethodMatcher that need dynamic checks.
 
- 
- 
Constructor Details- 
ReflectiveMethodInvocationprotected ReflectiveMethodInvocation(Object proxy, @Nullable Object target, Method method, @Nullable Object[] arguments, @Nullable Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) Construct a new ReflectiveMethodInvocation with the given arguments.- Parameters:
- proxy- the proxy object that the invocation was made on
- target- the target object to invoke
- method- the method to invoke
- arguments- the arguments to invoke the method with
- targetClass- the target class, for MethodMatcher invocations
- interceptorsAndDynamicMethodMatchers- 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.
 
 
- 
- 
Method Details- 
getProxyDescription copied from interface:ProxyMethodInvocationReturn the proxy that this method invocation was made through.- Specified by:
- getProxyin interface- ProxyMethodInvocation
- Returns:
- the original proxy object
 
- 
getThisDescription copied from interface:JoinpointReturn the object that holds the current joinpoint's static part.For instance, the target object for an invocation. 
- 
getStaticPartDescription copied from interface:JoinpointReturn the static part of this joinpoint.The static part is an accessible object on which a chain of interceptors is installed. - Specified by:
- getStaticPartin interface- Joinpoint
 
- 
getMethodReturn the method invoked on the proxied interface. May or may not correspond with a method invoked on an underlying implementation of that interface.- Specified by:
- getMethodin interface- MethodInvocation
- Returns:
- the method being called
 
- 
getArgumentsDescription copied from interface:InvocationGet the arguments as an array object. It is possible to change element values within this array to change the arguments.- Specified by:
- getArgumentsin interface- Invocation
- Returns:
- the argument of the invocation
 
- 
setArgumentsDescription copied from interface:ProxyMethodInvocationSet the arguments to be used on subsequent invocations in the any advice in this chain.- Specified by:
- setArgumentsin interface- ProxyMethodInvocation
- Parameters:
- arguments- the argument array
 
- 
proceedDescription copied from interface:JoinpointProceed 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). 
- 
invokeJoinpoint
- 
invocableCloneThis 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. - Specified by:
- invocableClonein interface- ProxyMethodInvocation
- Returns:
- an invocable clone of this invocation.
 proceed()can be called once per clone.
- See Also:
 
- 
invocableCloneThis 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. - Specified by:
- invocableClonein interface- ProxyMethodInvocation
- Parameters:
- arguments- the arguments that the cloned invocation is supposed to use, overriding the original arguments
- Returns:
- an invocable clone of this invocation.
 proceed()can be called once per clone.
- See Also:
 
- 
setUserAttributeDescription copied from interface:ProxyMethodInvocationAdd 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. - Specified by:
- setUserAttributein interface- ProxyMethodInvocation
- Parameters:
- key- the name of the attribute
- value- the value of the attribute, or- nullto reset it
 
- 
getUserAttributeDescription copied from interface:ProxyMethodInvocationReturn the value of the specified user attribute.- Specified by:
- getUserAttributein interface- ProxyMethodInvocation
- Parameters:
- key- the name of the attribute
- Returns:
- the value of the attribute, or nullif not set
- See Also:
 
- 
getUserAttributesReturn 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. - Returns:
- any user attributes associated with this invocation
 (never null)
 
- 
toString
 
-