org.jboss.aop.instrument
Class MethodExecutionTransformer

java.lang.Object
  extended byorg.jboss.aop.instrument.MethodExecutionTransformer
Direct Known Subclasses:
GeneratedAdvisorMethodExecutionTransformer, NonOptimizedMethodExecutionTransformer, OptimizedMethodExecutionTransformer

public abstract class MethodExecutionTransformer
extends Object

Comment

Version:
$Revision: 1.41 $
Author:
Bill Burke

Nested Class Summary
protected  class MethodExecutionTransformer.MethodTransformation
           
 
Field Summary
protected  Instrumentor instrumentor
           
static String METHOD_INFO_CLASS_NAME
           
 
Constructor Summary
protected MethodExecutionTransformer(Instrumentor instrumentor)
           
 
Method Summary
protected  boolean addInfoAsWeakReference()
           
protected  String addMethodInfoField(int modifiers, javassist.CtClass addTo, MethodExecutionTransformer.MethodTransformation trans)
          Adds a MethodInfo field to the passed in class
protected  String addMethodInfoField(int modifiers, javassist.CtClass addTo, MethodExecutionTransformer.MethodTransformation trans, javassist.CtField.Initializer init)
          Adds a MethodInfo field to the passed in class
protected  JoinpointClassification[] classifyMethods(javassist.CtClass clazz, ClassAdvisor advisor)
          Classifies the method execution joinpoints.
protected  void copyAnnotations(javassist.CtMethod src, javassist.CtMethod dest)
           
protected abstract  void doWrap(MethodExecutionTransformer.MethodTransformation trans, String methodInfoFieldName)
           
protected static String getAopReturnStr(boolean isVoid)
           
protected static String getAopReturnStr(javassist.CtMethod method)
           
protected  JoinpointClassifier getClassifier()
           
static String getMethodInfoFieldName(String methodName, long methodHash)
           
static String getMethodNameHash(String methodName, long methodHash)
           
protected static String getReturnStr(boolean isVoid)
           
protected static String getReturnStr(javassist.CtMethod method)
           
protected static WrapperTransformer getWrapper()
           
 void instrument(javassist.CtClass clazz, ClassAdvisor advisor)
           
protected static String methodInfoFromWeakReference(String localName, String methodInfoName)
           
protected abstract  void transformMethod(MethodExecutionTransformer.MethodTransformation trans, boolean wrap)
           
 void unwrap(javassist.CtClass clazz, Collection methodInfos)
          Unwraps the method executions contained in methodInfos.
 void wrap(javassist.CtClass clazz, Collection methodInfos)
          Wraps the method executions contained in methodInfos.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_INFO_CLASS_NAME

public static final String METHOD_INFO_CLASS_NAME
See Also:
Constant Field Values

instrumentor

protected Instrumentor instrumentor
Constructor Detail

MethodExecutionTransformer

protected MethodExecutionTransformer(Instrumentor instrumentor)
Method Detail

getWrapper

protected static WrapperTransformer getWrapper()

getClassifier

protected JoinpointClassifier getClassifier()

addMethodInfoField

protected String addMethodInfoField(int modifiers,
                                    javassist.CtClass addTo,
                                    MethodExecutionTransformer.MethodTransformation trans)
                             throws javassist.NotFoundException,
                                    javassist.CannotCompileException
Adds a MethodInfo field to the passed in class

Throws:
javassist.NotFoundException
javassist.CannotCompileException

addMethodInfoField

protected String addMethodInfoField(int modifiers,
                                    javassist.CtClass addTo,
                                    MethodExecutionTransformer.MethodTransformation trans,
                                    javassist.CtField.Initializer init)
                             throws javassist.NotFoundException,
                                    javassist.CannotCompileException
Adds a MethodInfo field to the passed in class

Throws:
javassist.NotFoundException
javassist.CannotCompileException

addInfoAsWeakReference

protected boolean addInfoAsWeakReference()

getMethodNameHash

public static String getMethodNameHash(String methodName,
                                       long methodHash)

getMethodInfoFieldName

public static String getMethodInfoFieldName(String methodName,
                                            long methodHash)

methodInfoFromWeakReference

protected static String methodInfoFromWeakReference(String localName,
                                                    String methodInfoName)

classifyMethods

protected JoinpointClassification[] classifyMethods(javassist.CtClass clazz,
                                                    ClassAdvisor advisor)
                                             throws javassist.NotFoundException
Classifies the method execution joinpoints.

Parameters:
clazz - the clazz whose methods will be classified.
advisor - the advisor associated to clazz.
Returns:
a classification array.
Throws:
javassist.NotFoundException

instrument

public void instrument(javassist.CtClass clazz,
                       ClassAdvisor advisor)
                throws javassist.NotFoundException,
                       javassist.CannotCompileException
Throws:
javassist.NotFoundException
javassist.CannotCompileException

wrap

public void wrap(javassist.CtClass clazz,
                 Collection methodInfos)
          throws Exception
Wraps the method executions contained in methodInfos.

Parameters:
clazz - the class being instrumented.
Throws:
Exception

unwrap

public void unwrap(javassist.CtClass clazz,
                   Collection methodInfos)
            throws Exception
Unwraps the method executions contained in methodInfos.

Parameters:
clazz - the class being instrumented.
Throws:
Exception

copyAnnotations

protected void copyAnnotations(javassist.CtMethod src,
                               javassist.CtMethod dest)

getAopReturnStr

protected static String getAopReturnStr(javassist.CtMethod method)
                                 throws javassist.NotFoundException
Throws:
javassist.NotFoundException

getAopReturnStr

protected static String getAopReturnStr(boolean isVoid)
                                 throws javassist.NotFoundException
Throws:
javassist.NotFoundException

getReturnStr

protected static String getReturnStr(javassist.CtMethod method)
                              throws javassist.NotFoundException
Throws:
javassist.NotFoundException

getReturnStr

protected static String getReturnStr(boolean isVoid)
                              throws javassist.NotFoundException
Throws:
javassist.NotFoundException

transformMethod

protected abstract void transformMethod(MethodExecutionTransformer.MethodTransformation trans,
                                        boolean wrap)
                                 throws javassist.CannotCompileException,
                                        javassist.NotFoundException
Throws:
javassist.CannotCompileException
javassist.NotFoundException

doWrap

protected abstract void doWrap(MethodExecutionTransformer.MethodTransformation trans,
                               String methodInfoFieldName)
                        throws javassist.NotFoundException,
                               Exception
Throws:
javassist.NotFoundException
Exception


Copyright © 2004 JBoss Inc. All Rights Reserved.