org.jboss.lang.javassist
Class ScopedClassPool

java.lang.Object
  extended by ClassPool
      extended by org.jboss.lang.javassist.ScopedClassPool

public class ScopedClassPool
extends ClassPool

A scoped class pool


Field Summary
protected  java.lang.ref.WeakReference classLoader
           
protected  LoaderClassPath classPath
           
protected  ScopedClassPoolRepository repository
           
protected  SoftValueHashMap softcache
           
 
Constructor Summary
protected ScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
          Create a new ScopedClassPool.
 
Method Summary
protected  void cacheCtClass(java.lang.String classname, CtClass c, boolean dynamic)
          Cache a class
 void close()
          Close the class pool
 void flushClass(java.lang.String classname)
          Flush a class
protected  CtClass getCached(java.lang.String classname)
          Get the cached class
protected  CtClass getCachedLocally(java.lang.String classname)
          Whether the class is cached in this pooled
 java.lang.ClassLoader getClassLoader()
          Get the class loader
 CtClass getLocally(java.lang.String classname)
          Get any local copy of the class
 boolean isUnloadedClassLoader()
          Whether the classloader is loader
 void lockInCache(CtClass c)
          Lock a class into the cache
 void soften(CtClass clazz)
          Soften a class
 java.lang.Class toClass(CtClass ct, java.lang.ClassLoader loader)
          Convert a javassist class to a java class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repository

protected ScopedClassPoolRepository repository

classLoader

protected java.lang.ref.WeakReference classLoader

classPath

protected LoaderClassPath classPath

softcache

protected SoftValueHashMap softcache
Constructor Detail

ScopedClassPool

protected ScopedClassPool(java.lang.ClassLoader cl,
                          ClassPool src,
                          ScopedClassPoolRepository repository)
Create a new ScopedClassPool.

Parameters:
cl - the classloader
src - the original class pool
repository - the repository
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the class loader

Returns:
the class loader

close

public void close()
Close the class pool


flushClass

public void flushClass(java.lang.String classname)
Flush a class

Parameters:
classname - the class to flush

soften

public void soften(CtClass clazz)
Soften a class

Parameters:
clazz - the class

isUnloadedClassLoader

public boolean isUnloadedClassLoader()
Whether the classloader is loader

Returns:
false always

getCached

protected CtClass getCached(java.lang.String classname)
Get the cached class

Parameters:
classname - the class name
Returns:
the class

cacheCtClass

protected void cacheCtClass(java.lang.String classname,
                            CtClass c,
                            boolean dynamic)
Cache a class

Parameters:
classname - the class name
c - the ctClass
dynamic - whether the class is dynamically generated

lockInCache

public void lockInCache(CtClass c)
Lock a class into the cache

Parameters:
c - the class

getCachedLocally

protected CtClass getCachedLocally(java.lang.String classname)
Whether the class is cached in this pooled

Parameters:
classname - the class name
Returns:
the cached class

getLocally

public CtClass getLocally(java.lang.String classname)
                   throws NotFoundException
Get any local copy of the class

Parameters:
classname - the class name
Returns:
the class
Throws:
NotFoundException - when the class is not found

toClass

public java.lang.Class toClass(CtClass ct,
                               java.lang.ClassLoader loader)
                        throws CannotCompileException
Convert a javassist class to a java class

Parameters:
ct - the javassist class
loader - the loader
Throws:
CannotCompileException - for any error