org.jboss.aop.instrument
Class MethodExecutionTransformer

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

public abstract class MethodExecutionTransformer
extends Object

Comment

Version:
$Revision: 78208 $
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 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  boolean markInfoAsSynthetic()
           
protected static String methodInfoFromWeakReference(String localName, String methodInfoName)
           
protected  void moveAnnotationsAndCopySignature(javassist.CtMethod src, javassist.CtMethod dest)
           
protected abstract  void transformMethod(MethodExecutionTransformer.MethodTransformation trans, boolean wrap)
           
 void unwrap(javassist.CtClass clazz, Collection<MethodInfo> methodInfos)
          Unwraps the method executions contained in methodInfos.
 void wrap(javassist.CtClass clazz, Collection<MethodInfo> 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()

markInfoAsSynthetic

protected boolean markInfoAsSynthetic()

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)

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<MethodInfo> methodInfos)
          throws Exception
Wraps the method executions contained in methodInfos.

Parameters:
clazz - the class being instrumented.
constructorIndexes - a collection of org.jboss.aop.MethodInfo indentifying the methods to be wrapped.
Throws:
Exception

unwrap

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

Parameters:
clazz - the class being instrumented.
constructorIndexes - a collection of org.jboss.aop.MethodInfo indentifying the methods to be unwrapped.
Throws:
Exception

moveAnnotationsAndCopySignature

protected void moveAnnotationsAndCopySignature(javassist.CtMethod src,
                                               javassist.CtMethod dest)
                                        throws javassist.NotFoundException
Throws:
javassist.NotFoundException

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 © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.