org.jboss.aop.instrument
Class TransformerCommon

java.lang.Object
  extended by org.jboss.aop.instrument.TransformerCommon

public class TransformerCommon
extends Object

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

Version:
$Revision: 78208 $
Author:
Kabir Khan

Constructor Summary
TransformerCommon()
           
 
Method Summary
protected static void addInfoField(Instrumentor instrumentor, String infoClassName, String infoName, int modifiers, javassist.CtClass addTo, boolean weak, javassist.CtField.Initializer init, boolean synthetic)
           
static void compileOrLoadClass(javassist.CtClass classForPackage, javassist.CtClass newClass)
           
static void compileOrLoadClass(javassist.CtClass classForPackage, javassist.CtClass newClass, boolean compile)
          Compiles the class to file or adds it to the class pool
static void debugWriteFile(javassist.CtClass clazz)
           
protected static String infoFromWeakReference(String infoClassName, String localName, String infoName)
           
static boolean isCompileTime()
           
static javassist.CtClass makeClass(javassist.ClassPool pool, String name)
          Utility method to make a new class in a pool.
static javassist.CtClass makeClass(javassist.ClassPool pool, String name, javassist.CtClass superClass)
          Utility method to make a new class in a pool.
static javassist.CtClass makeNestedClass(javassist.CtClass outer, String name, boolean isStatic)
          Utility method to make a new class in a pool.
static javassist.CtClass makeNestedClass(javassist.CtClass outer, String name, boolean isStatic, int modifiers, javassist.CtClass superClass)
          Utility method to make a new class in a pool.
static Class<?> toClass(javassist.CtClass newClass, ClassLoader loader, ProtectionDomain pd)
           
static Class<?> toClass(javassist.CtClass newClass, ProtectionDomain pd)
           
 
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

isCompileTime

public static boolean isCompileTime()

compileOrLoadClass

public static void compileOrLoadClass(javassist.CtClass classForPackage,
                                      javassist.CtClass newClass)

compileOrLoadClass

public static void compileOrLoadClass(javassist.CtClass classForPackage,
                                      javassist.CtClass newClass,
                                      boolean compile)
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

toClass

public static Class<?> toClass(javassist.CtClass newClass,
                               ProtectionDomain pd)
                        throws javassist.CannotCompileException
Throws:
javassist.CannotCompileException

toClass

public static Class<?> toClass(javassist.CtClass newClass,
                               ClassLoader loader,
                               ProtectionDomain pd)
                        throws javassist.CannotCompileException
Throws:
javassist.CannotCompileException

debugWriteFile

public static void debugWriteFile(javassist.CtClass clazz)

addInfoField

protected static void addInfoField(Instrumentor instrumentor,
                                   String infoClassName,
                                   String infoName,
                                   int modifiers,
                                   javassist.CtClass addTo,
                                   boolean weak,
                                   javassist.CtField.Initializer init,
                                   boolean synthetic)
                            throws javassist.NotFoundException,
                                   javassist.CannotCompileException
Throws:
javassist.NotFoundException
javassist.CannotCompileException

infoFromWeakReference

protected static String infoFromWeakReference(String infoClassName,
                                              String localName,
                                              String infoName)

makeNestedClass

public static javassist.CtClass makeNestedClass(javassist.CtClass outer,
                                                String name,
                                                boolean isStatic,
                                                int modifiers,
                                                javassist.CtClass superClass)
                                         throws javassist.CannotCompileException
Utility method to make a new class in a pool. It makes sure that the class is registered with the pool, so others can find it.

Throws:
javassist.CannotCompileException

makeNestedClass

public static javassist.CtClass makeNestedClass(javassist.CtClass outer,
                                                String name,
                                                boolean isStatic)
                                         throws javassist.CannotCompileException
Utility method to make a new class in a pool. It makes sure that the class is registered with the pool, so others can find it.

Throws:
javassist.CannotCompileException

makeClass

public static javassist.CtClass makeClass(javassist.ClassPool pool,
                                          String name)
Utility method to make a new class in a pool. It makes sure that the class is registered with the pool, so others can find it.


makeClass

public static javassist.CtClass makeClass(javassist.ClassPool pool,
                                          String name,
                                          javassist.CtClass superClass)
Utility method to make a new class in a pool. It makes sure that the class is registered with the pool, so others can find it.



Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.