org.codehaus.aspectwerkz.joinpoint
Class MethodJoinPoint

java.lang.Object
  extended byorg.codehaus.aspectwerkz.joinpoint.MethodJoinPoint
All Implemented Interfaces:
JoinPoint, java.io.Serializable
Direct Known Subclasses:
MemberMethodJoinPoint, StaticMethodJoinPoint

public abstract class MethodJoinPoint
extends java.lang.Object
implements JoinPoint

Matches well defined point of execution in the program where a method is executed.
Stores meta data from the join point. I.e. a reference to original object an method, the parameters to A the result from the original method invocation etc.
Handles the invocation of the advices added to the join point.

Author:
Jonas Bonér
See Also:
Serialized Form

Constructor Summary
MethodJoinPoint(java.lang.String uuid, int methodId, java.lang.String controllerClass)
          Creates a new MethodJoinPoint object.
 
Method Summary
 java.lang.String createAdviceNotCorrectlyMappedMessage()
          Creates an advices not correctly mapped message.
 java.util.List getCFlowPointcuts()
          Returns the cflow pointcuts.
 java.lang.reflect.Method getMethod()
          Returns the original method.
 int getMethodId()
          Returns the internal method id.
 MethodMetaData getMethodMetaData()
          Returns the method meta-data.
 java.lang.String getMethodName()
          Returns the method name of the original invocation.
 java.lang.reflect.Method getOriginalMethod()
          Returns the original method.
 java.lang.Object[] getParameters()
          Returns the parameters from the original invocation.
 java.lang.Class[] getParameterTypes()
          Returns the parameter types from the original invocation.
 MethodPointcut[] getPointcuts()
          Returns the method pointcuts.
 java.lang.Object getResult()
          Returns the result from the original invocation.
 java.lang.Class getReturnType()
          Returns the return type from the original invocation.
 AspectWerkz getSystem()
          Returns the AspectWerkz system.
 java.lang.Class getTargetClass()
          Returns the original class.
abstract  java.lang.Object getTargetObject()
          Returns the original object.
 java.lang.String getUuid()
          Returns the UUID for the AspectWerkz system.
 int hashCode()
           
 java.lang.Object invokeOriginalMethod()
          Invokes the origignal method.
 java.lang.Object proceed()
          Walks through the pointcuts and invokes all its advices.
 java.lang.Object proceedInNewThread()
          To be called instead of proceed() when a new thread is spawned.
 void setCFlowPointcuts(java.util.List pointcuts)
          Sets the cflow pointcuts (overwrites the old ones)
 void setParameters(java.lang.Object[] parameters)
          Sets the parameters.
 void setPointcuts(MethodPointcut[] pointcuts)
          Sets the method pointcuts (overwrites the old ones).
 void setResult(java.lang.Object result)
          Sets the result.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodJoinPoint

public MethodJoinPoint(java.lang.String uuid,
                       int methodId,
                       java.lang.String controllerClass)
Creates a new MethodJoinPoint object.

Parameters:
uuid - the UUID for the AspectWerkz system to use
methodId - the id of the method
controllerClass - the class name of the controller class to use
Method Detail

getSystem

public AspectWerkz getSystem()
Returns the AspectWerkz system.

Returns:
the system

setPointcuts

public void setPointcuts(MethodPointcut[] pointcuts)
Sets the method pointcuts (overwrites the old ones).

Parameters:
pointcuts - the method pointcuts

getPointcuts

public MethodPointcut[] getPointcuts()
Returns the method pointcuts.

Returns:
the method pointcuts

getCFlowPointcuts

public java.util.List getCFlowPointcuts()
Returns the cflow pointcuts.

Returns:
the cflow pointcuts

setCFlowPointcuts

public void setCFlowPointcuts(java.util.List pointcuts)
Sets the cflow pointcuts (overwrites the old ones)

Parameters:
pointcuts - the cflow pointcuts

getMethodMetaData

public MethodMetaData getMethodMetaData()
Returns the method meta-data.

Returns:
the method meta-data

getMethodId

public int getMethodId()
Returns the internal method id.

Returns:
the internal method id

getOriginalMethod

public java.lang.reflect.Method getOriginalMethod()
Returns the original method.

Returns:
the original method

getUuid

public java.lang.String getUuid()
Returns the UUID for the AspectWerkz system.

Returns:
the UUID

getTargetObject

public abstract java.lang.Object getTargetObject()
Returns the original object.

Specified by:
getTargetObject in interface JoinPoint
Returns:
the original object

getTargetClass

public java.lang.Class getTargetClass()
Returns the original class.

Specified by:
getTargetClass in interface JoinPoint
Returns:
the original class

getMethod

public java.lang.reflect.Method getMethod()
Returns the original method.

Returns:
the original method

getMethodName

public java.lang.String getMethodName()
Returns the method name of the original invocation.

Returns:
the method name

getParameters

public java.lang.Object[] getParameters()
Returns the parameters from the original invocation.

Returns:
the parameters

getParameterTypes

public java.lang.Class[] getParameterTypes()
Returns the parameter types from the original invocation.

Returns:
the parameter types

getReturnType

public java.lang.Class getReturnType()
Returns the return type from the original invocation.

Returns:
the return type

getResult

public java.lang.Object getResult()
Returns the result from the original invocation.

Returns:
the result

setResult

public void setResult(java.lang.Object result)
Sets the result.

Parameters:
result - the result as an object

setParameters

public void setParameters(java.lang.Object[] parameters)
Sets the parameters.

Parameters:
parameters - the parameters as a list of objects

proceed

public java.lang.Object proceed()
                         throws java.lang.Throwable
Walks through the pointcuts and invokes all its advices. When the last advice of the last pointcut has been invoked, the original method is invoked. Is called recursively.

Specified by:
proceed in interface JoinPoint
Returns:
the result from the next invocation
Throws:
java.lang.Throwable

proceedInNewThread

public java.lang.Object proceedInNewThread()
                                    throws java.lang.Throwable
To be called instead of proceed() when a new thread is spawned. Otherwise the result is unpredicable.

Specified by:
proceedInNewThread in interface JoinPoint
Returns:
the result from the next invocation
Throws:
java.lang.Throwable

invokeOriginalMethod

public java.lang.Object invokeOriginalMethod()
                                      throws java.lang.Throwable
Invokes the origignal method.

Returns:
the result from the method invocation
Throws:
java.lang.Throwable - the exception from the original method

createAdviceNotCorrectlyMappedMessage

public java.lang.String createAdviceNotCorrectlyMappedMessage()
Creates an advices not correctly mapped message.

Returns:
the message

toString

public java.lang.String toString()

hashCode

public int hashCode()


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.