org.jboss.aop.joinpoint
Class MethodInvocation

java.lang.Object
  extended byorg.jboss.aop.joinpoint.InvocationBase
      extended byorg.jboss.aop.joinpoint.MethodInvocation
All Implemented Interfaces:
Externalizable, Invocation, Serializable
Direct Known Subclasses:
ContainerProxyMethodInvocation, MethodInvocationWrapper, ProxyMethodInvocation

public class MethodInvocation
extends InvocationBase
implements Externalizable

Version:
$Revision: 1.42 $
Author:
Bill Burke
See Also:
Serialized Form

Field Summary
protected  Method advisedMethod
           
protected  Object[] arguments
          arguments of the method call expressed as an array of objects
protected  MarshalledObject marshalledArguments
           
protected  long methodHash
           
protected  Method unadvisedMethod
           
 
Fields inherited from class org.jboss.aop.joinpoint.InvocationBase
advisor, currentInterceptor, instanceResolver, interceptors, metadata, responseContextInfo, targetObject
 
Constructor Summary
  MethodInvocation()
           
protected MethodInvocation(Interceptor[] interceptors)
           
  MethodInvocation(Interceptor[] interceptors, long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor)
           
  MethodInvocation(MethodInfo info, Interceptor[] interceptors)
           
 
Method Summary
 Invocation copy()
          Copies complete state of Invocation object.
 Method getActualMethod()
           
 Advisor getAdvisor()
           
 Object[] getArguments()
           
 Object getMetaData(Object group, Object attr)
          This method resolves metadata based on the context of the invocation.
 Method getMethod()
           
 long getMethodHash()
           
 Invocation getWrapper(Interceptor[] newchain)
          Get a wrapper invocation object that can insert a new chain of interceptors at runtime to the invocation flow.
static Throwable handleErrors(Object target, Method method, Object[] arguments, Throwable t)
          Handle invocation errors
 Object invokeNext()
          Invoke on the next interceptor in the chain.
 void readExternal(ObjectInput in)
           
 Object resolveAnnotation(Class annotation)
          This method resolves an annotation based on the context of the invocation.
 Object resolveAnnotation(Class[] annotations)
          This method resolves an annotation based on the context of the invocation.
 void setArguments(Object[] arguments)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.jboss.aop.joinpoint.InvocationBase
addResponseAttachment, getCurrentInterceptor, getInstanceResolver, getInterceptors, getMetaData, getResponseAttachment, getResponseContextInfo, getTargetObject, invokeNext, resolveClassAnnotation, resolveClassMetaData, setAdvisor, setInstanceResolver, setMetaData, setResponseContextInfo, setTargetObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

arguments

protected Object[] arguments
arguments of the method call expressed as an array of objects


methodHash

protected long methodHash

marshalledArguments

protected MarshalledObject marshalledArguments

advisedMethod

protected Method advisedMethod

unadvisedMethod

protected Method unadvisedMethod
Constructor Detail

MethodInvocation

public MethodInvocation(MethodInfo info,
                        Interceptor[] interceptors)

MethodInvocation

public MethodInvocation(Interceptor[] interceptors,
                        long methodHash,
                        Method advisedMethod,
                        Method unadvisedMethod,
                        Advisor advisor)

MethodInvocation

protected MethodInvocation(Interceptor[] interceptors)

MethodInvocation

public MethodInvocation()
Method Detail

toString

public String toString()

invokeNext

public Object invokeNext()
                  throws Throwable
Invoke on the next interceptor in the chain. If this is already the end of the chain, reflection will call the constructor, field, or method you are invoking on.

Specified by:
invokeNext in interface Invocation
Overrides:
invokeNext in class InvocationBase
Throws:
Throwable

handleErrors

public static Throwable handleErrors(Object target,
                                     Method method,
                                     Object[] arguments,
                                     Throwable t)
                              throws Throwable
Handle invocation errors

Parameters:
target - the target
method - the method
arguments - the arguments
t - the error
Returns:
never
Throws:
Throwable - the throwable

resolveAnnotation

public Object resolveAnnotation(Class annotation)
This method resolves an annotation based on the context of the invocation.

Specified by:
resolveAnnotation in interface Invocation
Overrides:
resolveAnnotation in class InvocationBase

resolveAnnotation

public Object resolveAnnotation(Class[] annotations)
This method resolves an annotation based on the context of the invocation.

Specified by:
resolveAnnotation in interface Invocation
Overrides:
resolveAnnotation in class InvocationBase

getMetaData

public Object getMetaData(Object group,
                          Object attr)
This method resolves metadata based on the context of the invocation. It iterates through its list of MetaDataResolvers to find out the value of the metadata desired.

This list usually is ThreadMetaData, InstanceAdvisor.getMetaData ClassAdvisor.getMethodMetaData (or field, or constructor) ClassAdvisor.getDefaultMetaData

Specified by:
getMetaData in interface Invocation
Overrides:
getMetaData in class InvocationBase

getWrapper

public Invocation getWrapper(Interceptor[] newchain)
Get a wrapper invocation object that can insert a new chain of interceptors at runtime to the invocation flow. CFlow makes use of this. When the wrapper object finishes its invocation chain it delegates back to the wrapped invocation.

Specified by:
getWrapper in interface Invocation
Parameters:
newchain -
Returns:

copy

public Invocation copy()
Copies complete state of Invocation object.

Specified by:
copy in interface Invocation
Returns:

getArguments

public Object[] getArguments()

setArguments

public void setArguments(Object[] arguments)

getMethod

public Method getMethod()

getActualMethod

public Method getActualMethod()

getMethodHash

public long getMethodHash()

getAdvisor

public Advisor getAdvisor()
Specified by:
getAdvisor in interface Invocation
Overrides:
getAdvisor in class InvocationBase

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException


Copyright © 2004 JBoss Inc. All Rights Reserved.