org.apache.tapestry5.ioc.internal.services
Class ClassFactoryClassPool

java.lang.Object
  extended by javassist.ClassPool
      extended by org.apache.tapestry5.ioc.internal.services.ClassFactoryClassPool

public class ClassFactoryClassPool
extends javassist.ClassPool

Used to ensure that ClassPool.appendClassPath(javassist.ClassPath) is invoked within a synchronized lock, and also handles tricky class loading issues (caused by the creation of classes, and class loaders, at runtime).


Field Summary
 
Fields inherited from class javassist.ClassPool
childFirstLookup, classes, doPruning, parent, releaseUnmodifiedClassFile, source
 
Constructor Summary
ClassFactoryClassPool(ClassLoader contextClassLoader)
           
 
Method Summary
 void addClassLoaderIfNeeded(ClassLoader loader)
          Convienience method for adding to the ClassPath for a particular class loader.
 Class importClass(Class clazz)
          Returns the nearest super-class of the provided class that can be converted to a CtClass.
 Class toClass(javassist.CtClass ct, ClassLoader loader, ProtectionDomain domain)
          Overriden to remove a deadlock producing synchronized block.
 
Methods inherited from class javassist.ClassPool
appendClassPath, appendClassPath, appendPathList, appendSystemPath, cacheCtClass, clearImportedPackages, createCtClass, find, get, get, get0, getAndRename, getCached, getClassLoader, getCtClass, getDefault, getImportedPackages, getMethod, getOrNull, importPackage, insertClassPath, insertClassPath, lookupCflow, makeClass, makeClass, makeClass, makeClass, makeClassIfNew, makeInterface, makeInterface, recordInvalidClassName, removeCached, removeClassPath, toClass, toClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassFactoryClassPool

public ClassFactoryClassPool(ClassLoader contextClassLoader)
Method Detail

importClass

public Class importClass(Class clazz)
Returns the nearest super-class of the provided class that can be converted to a CtClass. This is used to filter out Hibernate-style proxies (created as subclasses of oridnary classes). This will automatically add the class' classLoader to the pool's class path.

Parameters:
clazz - class to import
Returns:
clazz, or a super-class of clazz

addClassLoaderIfNeeded

public void addClassLoaderIfNeeded(ClassLoader loader)
Convienience method for adding to the ClassPath for a particular class loader.

Parameters:
loader - the class loader to add (derived from a loaded class, and may be null for some system classes)

toClass

public Class toClass(javassist.CtClass ct,
                     ClassLoader loader,
                     ProtectionDomain domain)
              throws javassist.CannotCompileException
Overriden to remove a deadlock producing synchronized block. We expect that the defineClass() methods will have been marked as accessible statically (by this class), so there's no need to set them accessible again.

Overrides:
toClass in class javassist.ClassPool
Throws:
javassist.CannotCompileException


Copyright © 2003-2012 The Apache Software Foundation.