Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » aop » framework » [javadoc | source]
org.springframework.aop.framework
public class: ReflectiveMethodInvocation [javadoc | source]
java.lang.Object
   org.springframework.aop.framework.ReflectiveMethodInvocation

All Implemented Interfaces:
    Cloneable, ProxyMethodInvocation

Direct Known Subclasses:
    CglibMethodInvocation

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.

Field Summary
protected final  Object proxy     
protected final  Object target     
protected final  Method method     
protected  Object[] arguments     
protected final  List interceptorsAndDynamicMethodMatchers    List of MethodInterceptor and InterceptorAndDynamicMethodMatcher that need dynamic checks. 
Constructor:
 protected ReflectiveMethodInvocation(Object proxy,
    Object target,
    Method method,
    Object[] arguments,
    Class targetClass,
    List 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 from org.springframework.aop.framework.ReflectiveMethodInvocation Summary:
getArguments,   getMethod,   getProxy,   getStaticPart,   getThis,   getUserAttribute,   getUserAttributes,   invocableClone,   invocableClone,   invokeJoinpoint,   proceed,   setArguments,   setUserAttribute,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.aop.framework.ReflectiveMethodInvocation Detail:
 public final Object[] getArguments() 
 public final Method getMethod() 
    Return the method invoked on the proxied interface. May or may not correspond with a method invoked on an underlying implementation of that interface.
 public final Object getProxy() 
 public final AccessibleObject getStaticPart() 
 public final Object getThis() 
 public Object getUserAttribute(String key) 
 public Map getUserAttributes() 
    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.

 public MethodInvocation invocableClone() 
    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.

 public MethodInvocation invocableClone(Object[] arguments) 
    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.

 protected Object invokeJoinpoint() throws Throwable 
    Invoke the joinpoint using reflection. Subclasses can override this to use custom invocation.
 public Object proceed() throws Throwable 
 public  void setArguments(Object[] arguments) 
 public  void setUserAttribute(String key,
    Object value) 
 public String toString()