org.springframework.aop.framework
Class ReflectiveMethodInvocation


public class ReflectiveMethodInvocation
implements MethodInvocation

Spring implementation of AOP Alliance MethodInvocation interface. Invokes target using reflection. Subclasses can override the invokeJoinpoint() method to change this behaviour, so this is a useful base class for MethodInvocation implementations.

Author:
Rod Johnson
Version: $Id: ReflectiveMethodInvocation.java,v 1.2 2003/12/10 12:05:26 johnsonr Exp $

Constructor Summary
ReflectiveMethodInvocation(Object proxy, Object target, Class targetInterface, Method m, Object[] arguments, Class targetClass, List interceptorsAndDynamicMethodMatchers)
          Construct a new MethodInvocation with given arguments

Method Summary
 ObjectaddAttachment(String key, Object resource)
           
 InvocationcloneInstance()
           
 ObjectgetArgument(int i)
           
 intgetArgumentCount()
           
 final Object[]getArguments()
          Private optimization method
 ObjectgetAttachment(String key)
           
 AttributeRegistrygetAttributeRegistry()
           
 final MethodgetMethod()
          Return the method invoked on the proxied interface.
 final ObjectgetProxy()
          Return the proxy that this interception was made through
 final AccessibleObjectgetStaticPart()
           
 final ClassgetTargetInterface()
           
 final ObjectgetThis()
           
 Objectproceed()
           
 voidsetArgument(int index, Object argument)
           
 StringtoString()
           

Constructor Detail

ReflectiveMethodInvocation

public ReflectiveMethodInvocation(Object proxy, Object target, Class targetInterface, Method m, Object[] arguments, Class targetClass, List interceptorsAndDynamicMethodMatchers)
Construct a new MethodInvocation with given arguments
Parameters:
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 Detail

addAttachment

public Object addAttachment(String key, Object resource)

cloneInstance

public Invocation cloneInstance()
See Also:
org.aopalliance.intercept.Invocation#cloneInstance

getArgument

public Object getArgument(int i)
See Also:
org.aopalliance.intercept.MethodInvocation#getArgument(int)

getArgumentCount

public int getArgumentCount()
See Also:
org.aopalliance.intercept.MethodInvocation#getArgumentCount()

getArguments

public final Object[] getArguments()
Private optimization method
Returns: Object[]

getAttachment

public Object getAttachment(String key)
Returns: the resource or null

getAttributeRegistry

public AttributeRegistry getAttributeRegistry()
See Also:
org.aopalliance.intercept.Invocation#getAttributeRegistry()

getMethod

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.
Returns: Method

getProxy

public final Object getProxy()
Return the proxy that this interception was made through
Returns: Object

getStaticPart

public final AccessibleObject getStaticPart()

getTargetInterface

public final Class getTargetInterface()

getThis

public final Object getThis()
See Also:
org.aopalliance.intercept.Invocation#getThis

proceed

public Object proceed()
throws java.lang.Throwable
See Also:
org.aopalliance.intercept.Invocation#proceed

setArgument

public void setArgument(int index, Object argument)
See Also:
org.aopalliance.intercept.MethodInvocation#setArgument(int, java.lang.Object)

toString

public String toString()

Association Links

to Class java.lang.Class

Interface this invocation is against. May not be the same as the method's declaring interface.

to Class java.lang.reflect.Method

to Class java.util.List

List of Methodnterceptor and InterceptorAndDynamicMethodMatcher that need dynamic checks.

to Class java.util.HashMap

Any resources attached to this invocation. Lazily initialized for efficiency.

to Class java.lang.Class