jasco.runtime
Class JascoMethod

java.lang.Object
  extended by jasco.runtime.JascoMethod
All Implemented Interfaces:
MethodJoinpoint, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
JascoDirectCallbackMethod, ReflectJascoMethod, TraversalJascoMethod

public class JascoMethod
extends java.lang.Object
implements java.lang.Cloneable, MethodJoinpoint, java.io.Serializable

The calledmethod keyword availabe in JAsCo aspects is of type JascoMethod, this means that all subsequent methods are availabe for this keyword. calledmethod refers to the method joinpoint that triggered the aspect.

See Also:
Serialized Form

Constructor Summary
JascoMethod()
          Do not use, internal usage only
JascoMethod(java.lang.String aName)
          Do not use, internal usage only
JascoMethod(java.lang.String fullname, java.lang.Object object, java.lang.Object[] args, java.lang.String aName, java.lang.String aClassName, int methodid, JAsCoBeanCallback callbackObject, int modifiers)
          Do not use, internal usage only for hotswap 1, deprecated...
JascoMethod(java.lang.String fullname, java.lang.String aName, java.lang.String aClassName, int methodid, JAsCoBeanCallback callbackObject, int modifiers)
          Do not use, internal usage only
JascoMethod(java.lang.String fullname, java.lang.String aName, java.lang.String aClassName, int methodid, JAsCoBeanCallback callbackObject, int modifiers, boolean isExecution)
          Do not use, internal usage only
 
Method Summary
static JascoMethod buildFrom(javassist.CtMethod method, java.lang.ClassLoader loader, int id)
           
 void clearLinkedHooks()
          Do not use, internal usage only
 void clearProceedCheck()
          Do not use, internal usage only
 JascoMethod copy()
           
 boolean dontLoadClass()
           
 void dontLoadClass(boolean b)
           
 java.lang.Class[] getActualArgumentTypes()
          Returns the actual argument types
 java.lang.annotation.Annotation[] getAnnotations()
          Returns all defined annotations
 java.lang.Object[] getArgumentsArray()
          Returns an array of all arguments
 java.lang.Object getCalledObject()
          Returns the object the method is invoked upon
 java.lang.ClassLoader getClassLoader()
          Returns the classLoader responsible for loading this joinpoint.
 java.lang.String getClassName()
          Returns the fully quantified name of class the method is declared
 java.lang.Class[] getExceptionTypes()
          Returns java.lang.reflect.class objects denoting types of exceptions thrown by this method
 java.lang.String[] getFormalArgumentTypeNames()
          returns array of full class names of formal arguments
 java.lang.Class[] getFormalArgumentTypes()
          Returns the formal argument types
 java.lang.String getFullName()
          Returns the unique name for this method joinpoint
 long getID()
           
 javassist.CtMethod getJavassistMethod()
           
 IHook[] getLinkedHooks()
          Do not use, internal usage only
 int getModifiers()
          Returns the modifiers intger, see java.lang.reflect.Modifier
 java.lang.String getName()
          Returns the method name
protected  java.lang.reflect.Method getReflectMethod()
           
 java.lang.Class getReturnType()
          Returns java.lang.reflect.class object denoting the return type of this method
 java.lang.String getReturnTypeName()
          returns full class name of return type
 java.lang.String getSignature()
          Returns the unique name for this method joinpoint
 int getSourceLocation()
          returns location of joinpoint in original source code
 void initClassLoader(java.lang.ClassLoader loader)
           
protected static void initFrom(JascoMethod theMethod, javassist.CtMethod method, java.lang.ClassLoader loader, int id)
           
protected  void initJavassistMethod()
           
protected  void initReflectMethod()
           
protected  void initReflectMethod(java.lang.Class clz)
           
 boolean inlineCompiled()
          Do not use, internal usage only
 java.lang.Object invoke(java.lang.Object obj, java.lang.Object[] args)
          Invokes the replaced method or subsequent around advices, only availabe in around advice
 java.lang.Object invokeAgain()
          Allows to invoke the original method all over again with original arguments.
 java.lang.Object invokeAgain(java.lang.Object calledobject, java.lang.Object[] args)
          Allows to invoke the original method all over again.
 java.lang.Object invokeJAsCoMethod()
          Invokes the replaced method or subsequent around advices with original arguments, only availabe in around advice.
 java.lang.Object invokeNoAspectAgain()
          Allows to invoke the original method again with original arguments.
 java.lang.Object invokeOriginal(java.lang.Object obj, java.lang.Object[] args)
          Invokes the original method, only availabe in around advice.
 java.lang.Object invokeOriginalJAsCoMethod()
          Invokes the original method with original arguments, only availabe in around advice.
 boolean isCall()
          Returns true when this method joinpoint is a call joinpoint
 boolean isExecution()
          Returns true when this method joinpoint is an execution joinpoint
 java.lang.Class loadClass()
          Loads this class
protected  java.lang.Class loadClass(java.lang.String aClass)
           
 void resetProceedChain()
          Allows to reset the proceed chain, so that all applicable aspects (including the current one) are executed again when proceed is invoked.
 void setArgumentsArray(java.lang.Object[] v)
          Do not use, internal usage only
 void setCallbackObject(JAsCoBeanCallback callback)
          Do not use, internal usage only
 void setCalledObject(java.lang.Object o)
          Do not use, internal usage only
 void setExceptionTypes(java.lang.String[] excs)
           
 void setFormalArgumentTypes(java.lang.String[] fargs)
           
 void setInlineCompiled(boolean b)
          Do not use, internal usage only
 void setLinkedHooks(IHook[] link)
          Do not use, internal usage only
protected  void setReturnTypeName(java.lang.String s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JascoMethod

public JascoMethod()
Do not use, internal usage only


JascoMethod

public JascoMethod(java.lang.String aName)
Do not use, internal usage only


JascoMethod

public JascoMethod(java.lang.String fullname,
                   java.lang.String aName,
                   java.lang.String aClassName,
                   int methodid,
                   JAsCoBeanCallback callbackObject,
                   int modifiers)
Do not use, internal usage only


JascoMethod

public JascoMethod(java.lang.String fullname,
                   java.lang.Object object,
                   java.lang.Object[] args,
                   java.lang.String aName,
                   java.lang.String aClassName,
                   int methodid,
                   JAsCoBeanCallback callbackObject,
                   int modifiers)
Do not use, internal usage only for hotswap 1, deprecated...


JascoMethod

public JascoMethod(java.lang.String fullname,
                   java.lang.String aName,
                   java.lang.String aClassName,
                   int methodid,
                   JAsCoBeanCallback callbackObject,
                   int modifiers,
                   boolean isExecution)
Do not use, internal usage only

Method Detail

setFormalArgumentTypes

public void setFormalArgumentTypes(java.lang.String[] fargs)

setExceptionTypes

public void setExceptionTypes(java.lang.String[] excs)

getReflectMethod

protected java.lang.reflect.Method getReflectMethod()

loadClass

public java.lang.Class loadClass()
Description copied from interface: MethodJoinpoint
Loads this class

Specified by:
loadClass in interface MethodJoinpoint

getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Returns all defined annotations

Specified by:
getAnnotations in interface MethodJoinpoint

getReturnType

public java.lang.Class getReturnType()
Description copied from interface: MethodJoinpoint
Returns java.lang.reflect.class object denoting the return type of this method

Specified by:
getReturnType in interface MethodJoinpoint

initReflectMethod

protected void initReflectMethod()

initReflectMethod

protected void initReflectMethod(java.lang.Class clz)

getFullName

public java.lang.String getFullName()
Returns the unique name for this method joinpoint

Specified by:
getFullName in interface MethodJoinpoint

getSignature

public java.lang.String getSignature()
Returns the unique name for this method joinpoint

Specified by:
getSignature in interface MethodJoinpoint

initClassLoader

public void initClassLoader(java.lang.ClassLoader loader)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isExecution

public boolean isExecution()
Returns true when this method joinpoint is an execution joinpoint

Specified by:
isExecution in interface MethodJoinpoint

isCall

public boolean isCall()
Returns true when this method joinpoint is a call joinpoint

Specified by:
isCall in interface MethodJoinpoint

getName

public java.lang.String getName()
Returns the method name

Specified by:
getName in interface MethodJoinpoint

getID

public long getID()

getActualArgumentTypes

public java.lang.Class[] getActualArgumentTypes()
Returns the actual argument types

Specified by:
getActualArgumentTypes in interface MethodJoinpoint

getClassLoader

public java.lang.ClassLoader getClassLoader()
Description copied from interface: MethodJoinpoint
Returns the classLoader responsible for loading this joinpoint. When using reflection on certain classes related to the joinpoint use this classloader to ensure classloader safety in complicated class loader hierarchies.

Specified by:
getClassLoader in interface MethodJoinpoint

loadClass

protected java.lang.Class loadClass(java.lang.String aClass)
                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getFormalArgumentTypes

public java.lang.Class[] getFormalArgumentTypes()
Returns the formal argument types

Specified by:
getFormalArgumentTypes in interface MethodJoinpoint

getClassName

public java.lang.String getClassName()
Returns the fully quantified name of class the method is declared

Specified by:
getClassName in interface MethodJoinpoint

getModifiers

public int getModifiers()
Returns the modifiers intger, see java.lang.reflect.Modifier

Specified by:
getModifiers in interface MethodJoinpoint

getArgumentsArray

public java.lang.Object[] getArgumentsArray()
Returns an array of all arguments

Specified by:
getArgumentsArray in interface MethodJoinpoint

setArgumentsArray

public void setArgumentsArray(java.lang.Object[] v)
Do not use, internal usage only


setCallbackObject

public void setCallbackObject(JAsCoBeanCallback callback)
Do not use, internal usage only


getCalledObject

public java.lang.Object getCalledObject()
Returns the object the method is invoked upon

Specified by:
getCalledObject in interface MethodJoinpoint

setCalledObject

public void setCalledObject(java.lang.Object o)
Do not use, internal usage only


invokeJAsCoMethod

public final java.lang.Object invokeJAsCoMethod()
                                         throws java.lang.Exception
Invokes the replaced method or subsequent around advices with original arguments, only availabe in around advice. Is equivalent to invoking proceed(), proceed is however the preferred because it will execute considerably faster because of optimizations.

Specified by:
invokeJAsCoMethod in interface MethodJoinpoint
Throws:
ProceedFinishedException - proceed was previously invoked and all advices and original method already executed.
java.lang.Exception

invokeOriginalJAsCoMethod

public java.lang.Object invokeOriginalJAsCoMethod()
                                           throws java.lang.Exception
Invokes the original method with original arguments, only availabe in around advice. WARNING: This method bypasses the around chain, subsequent arounds are not executed! Use invokeJAsCoMethod if you just want to proceed.

Specified by:
invokeOriginalJAsCoMethod in interface MethodJoinpoint
Throws:
java.lang.Exception

invoke

public final java.lang.Object invoke(java.lang.Object obj,
                                     java.lang.Object[] args)
                              throws java.lang.Exception
Invokes the replaced method or subsequent around advices, only availabe in around advice

Specified by:
invoke in interface MethodJoinpoint
Parameters:
obj - The object to invoke the method upon, is typically calledobject keyword
args - The arguments to invoke the proceed chain with.
Throws:
ProceedFinishedException - proceed was previously invoked and all advices and original method already executed.
java.lang.Exception

invokeOriginal

public java.lang.Object invokeOriginal(java.lang.Object obj,
                                       java.lang.Object[] args)
                                throws java.lang.Exception
Invokes the original method, only availabe in around advice. WARNING: This method bypasses the around chain, subsequent arounds are not executed! Use invokeJAsCoMethod if you just want to proceed.

Specified by:
invokeOriginal in interface MethodJoinpoint
Parameters:
obj - The object to invoke the method upon, is typically calledobject keyword
args - The arguments to invoke the original method with.
Throws:
java.lang.Exception

clearLinkedHooks

public void clearLinkedHooks()
Do not use, internal usage only


clearProceedCheck

public void clearProceedCheck()
Do not use, internal usage only


setLinkedHooks

public void setLinkedHooks(IHook[] link)
Do not use, internal usage only


getLinkedHooks

public IHook[] getLinkedHooks()
Do not use, internal usage only


invokeAgain

public java.lang.Object invokeAgain()
                             throws java.lang.Exception
Allows to invoke the original method all over again with original arguments. This means that the list of applicable aspects is rebuild. WARNING: could easily cause an infinite loop if this aspect is applicable again! Does not work with method overloading yet.

Specified by:
invokeAgain in interface MethodJoinpoint
Throws:
java.lang.Exception

invokeAgain

public java.lang.Object invokeAgain(java.lang.Object calledobject,
                                    java.lang.Object[] args)
                             throws java.lang.Exception
Allows to invoke the original method all over again. This means that the list of applicable aspects is rebuild and all aspects (including the current one) are triggered again if applicable. WARNING: could easily cause an infinite loop if this aspect is applicable again! Does not work with method overloading yet.

Specified by:
invokeAgain in interface MethodJoinpoint
Parameters:
calledobject - The object to invoke the method upon, is typically calledobject keyword
args - The arguments to invoke the original method with.
Throws:
java.lang.Exception

invokeNoAspectAgain

public java.lang.Object invokeNoAspectAgain()
Allows to invoke the original method again with original arguments. If this aspect is however triggered by a method defined in another aspect, the triggering method for that aspect is used unless that aspect is triggered by a method defined in an aspect etc...

Specified by:
invokeNoAspectAgain in interface MethodJoinpoint

inlineCompiled

public boolean inlineCompiled()
Do not use, internal usage only


setInlineCompiled

public void setInlineCompiled(boolean b)
Do not use, internal usage only


getExceptionTypes

public java.lang.Class[] getExceptionTypes()
Description copied from interface: MethodJoinpoint
Returns java.lang.reflect.class objects denoting types of exceptions thrown by this method

Specified by:
getExceptionTypes in interface MethodJoinpoint

resetProceedChain

public final void resetProceedChain()
                             throws java.lang.Exception
Allows to reset the proceed chain, so that all applicable aspects (including the current one) are executed again when proceed is invoked. In contary to invokeAgain, the list of appliable aspects is not rebuild. WARNING: could easily cause an infinite loop if this aspect always invokes this method!

Throws:
java.lang.Exception

initFrom

protected static final void initFrom(JascoMethod theMethod,
                                     javassist.CtMethod method,
                                     java.lang.ClassLoader loader,
                                     int id)
                              throws javassist.NotFoundException
Throws:
javassist.NotFoundException

buildFrom

public static JascoMethod buildFrom(javassist.CtMethod method,
                                    java.lang.ClassLoader loader,
                                    int id)
                             throws javassist.NotFoundException
Throws:
javassist.NotFoundException

getReturnTypeName

public java.lang.String getReturnTypeName()
Description copied from interface: MethodJoinpoint
returns full class name of return type

Specified by:
getReturnTypeName in interface MethodJoinpoint
Returns:
full class name of return type

setReturnTypeName

protected void setReturnTypeName(java.lang.String s)

getFormalArgumentTypeNames

public java.lang.String[] getFormalArgumentTypeNames()
Description copied from interface: MethodJoinpoint
returns array of full class names of formal arguments

Specified by:
getFormalArgumentTypeNames in interface MethodJoinpoint
Returns:
full class names of formal arguments

dontLoadClass

public boolean dontLoadClass()
Returns:

dontLoadClass

public void dontLoadClass(boolean b)

copy

public JascoMethod copy()

getJavassistMethod

public javassist.CtMethod getJavassistMethod()

initJavassistMethod

protected void initJavassistMethod()

getSourceLocation

public int getSourceLocation()
Description copied from interface: MethodJoinpoint
returns location of joinpoint in original source code

Specified by:
getSourceLocation in interface MethodJoinpoint
Returns:
line number or -1 if not available