org.jboss.aop.instrument
Class TransformerCommon

java.lang.Object
  extended byorg.jboss.aop.instrument.TransformerCommon

public class TransformerCommon
extends Object

A few handy methods and common things used by the other Transformers

Version:
$Revision: 1.3 $
Author:
Kabir Khan

Constructor Summary
TransformerCommon()
           
 
Method Summary
static void addArgumentFieldsToInvocation(javassist.CtClass invocation, javassist.CtClass[] params)
          Adds fields arg0, arg1 etc.
static void addGetArguments(javassist.ClassPool pool, javassist.CtClass invocation, javassist.CtClass[] params)
           
static void compileOrLoadClass(javassist.CtClass classForPackage, javassist.CtClass invocation)
          Compiles the class to file or adds it to the class pool
static javassist.CtClass makeInvocationClass(AOPClassPool pool, boolean makeInnerClass, javassist.CtClass outerClass, String className, javassist.CtClass superInvocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformerCommon

public TransformerCommon()
Method Detail

makeInvocationClass

public static javassist.CtClass makeInvocationClass(AOPClassPool pool,
                                                    boolean makeInnerClass,
                                                    javassist.CtClass outerClass,
                                                    String className,
                                                    javassist.CtClass superInvocation)
                                             throws javassist.CannotCompileException,
                                                    javassist.NotFoundException
Parameters:
pool - The AOPClassPool to create the optimized invocation class in
makeInnerClass - If true creates the new class as an inner class of className
outerClass - The class to create the invocation class as an inner class of if makeInnerClass==true
className - The full class name (including package info) of the invocation class to be created
superInvocation - The super class of this invocation
Returns:
The created invocation class
Throws:
javassist.CannotCompileException
javassist.NotFoundException

compileOrLoadClass

public static void compileOrLoadClass(javassist.CtClass classForPackage,
                                      javassist.CtClass invocation)
                               throws Exception
Compiles the class to file or adds it to the class pool

Parameters:
classForPackage - The class to be used to determine the directory to place the class in
invocation - The class to be comiled/added to class pool
Throws:
Exception

addArgumentFieldsToInvocation

public static void addArgumentFieldsToInvocation(javassist.CtClass invocation,
                                                 javassist.CtClass[] params)
                                          throws javassist.CannotCompileException
Adds fields arg0, arg1 etc. to the invocation class for storing the parameters for a method

Parameters:
invocation - The invocation we want to add
params - Array of the types of the parameters
Throws:
javassist.CannotCompileException

addGetArguments

public static void addGetArguments(javassist.ClassPool pool,
                                   javassist.CtClass invocation,
                                   javassist.CtClass[] params)
                            throws Exception
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.