spring-framework / org.springframework.aop.framework / ReflectiveMethodInvocation

ReflectiveMethodInvocation

open class ReflectiveMethodInvocation : ProxyMethodInvocation, Cloneable

Spring's implementation of the AOP Alliance 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.

Author
Rod Johnson

Author
Juergen Hoeller

Author
Adrian Colyer

See Also
#invokeJoinpoint#proceed#invocableClone#setUserAttribute#getUserAttribute

Functions

getArguments

fun getArguments(): Array<Any>

getMethod

fun getMethod(): Method

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

fun getProxy(): Any

getStaticPart

fun getStaticPart(): AccessibleObject

getThis

fun getThis(): Any

getUserAttribute

open fun getUserAttribute(key: String): Any

getUserAttributes

open fun getUserAttributes(): MutableMap<String, Any>

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

open fun invocableClone(): MethodInvocation

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.

open fun invocableClone(vararg arguments: Any): MethodInvocation

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.

proceed

open fun proceed(): Any

setArguments

open fun setArguments(vararg arguments: Any): Unit

setUserAttribute

open fun setUserAttribute(key: String, value: Any): Unit

toString

open fun toString(): String