public class ScopedClassPool extends ClassPool
Modifier and Type | Field and Description |
---|---|
protected java.lang.ref.WeakReference |
classLoader |
protected LoaderClassPath |
classPath |
(package private) boolean |
isBootstrapCl |
protected ScopedClassPoolRepository |
repository |
protected SoftValueHashMap |
softcache |
childFirstLookup, classes, doPruning, parent, releaseUnmodifiedClassFile, source
Modifier | Constructor and Description |
---|---|
protected |
ScopedClassPool(java.lang.ClassLoader cl,
ClassPool src,
ScopedClassPoolRepository repository)
Deprecated.
|
protected |
ScopedClassPool(java.lang.ClassLoader cl,
ClassPool src,
ScopedClassPoolRepository repository,
boolean isTemp)
Create a new ScopedClassPool.
|
Modifier and Type | Method and Description |
---|---|
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
|
protected java.lang.ClassLoader |
getClassLoader0() |
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,
java.security.ProtectionDomain domain)
Convert a javassist class to a java class
|
appendClassPath, appendClassPath, appendPathList, appendSystemPath, clearImportedPackages, createCtClass, find, get, get, get0, getAndRename, getCtClass, getDefault, getImportedPackages, getMethod, getOrNull, importPackage, insertClassPath, insertClassPath, lookupCflow, makeClass, makeClass, makeClass, makeClass, makeClassIfNew, makeInterface, makeInterface, makePackage, recordInvalidClassName, removeCached, removeClassPath, toClass, toClass, toString
protected ScopedClassPoolRepository repository
protected java.lang.ref.WeakReference classLoader
protected LoaderClassPath classPath
protected SoftValueHashMap softcache
boolean isBootstrapCl
protected ScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
cl
- the classloadersrc
- the original class poolrepository
- the repositoryprotected ScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)
cl
- the classloadersrc
- the original class poolrepository
- the repositoryisTemp
- Whether this is a temporary pool used to resolve referencespublic java.lang.ClassLoader getClassLoader()
getClassLoader
in class ClassPool
ClassPool.toClass(CtClass)
,
CtClass.getAnnotations()
protected java.lang.ClassLoader getClassLoader0()
public void close()
public void flushClass(java.lang.String classname)
classname
- the class to flushpublic void soften(CtClass clazz)
clazz
- the classpublic boolean isUnloadedClassLoader()
protected CtClass getCached(java.lang.String classname)
getCached
in class ClassPool
classname
- the class nameClassPool.cacheCtClass(String,CtClass,boolean)
,
ClassPool.removeCached(String)
protected void cacheCtClass(java.lang.String classname, CtClass c, boolean dynamic)
cacheCtClass
in class ClassPool
classname
- the class namec
- the ctClassdynamic
- whether the class is dynamically generatedClassPool.getCached(String)
,
#removeCached(String,CtClass)
public void lockInCache(CtClass c)
c
- the classprotected CtClass getCachedLocally(java.lang.String classname)
classname
- the class namepublic CtClass getLocally(java.lang.String classname) throws NotFoundException
classname
- the class nameNotFoundException
- when the class is not foundpublic java.lang.Class toClass(CtClass ct, java.lang.ClassLoader loader, java.security.ProtectionDomain domain) throws CannotCompileException
toClass
in class ClassPool
ct
- the javassist classloader
- the loaderdomain
- the protection domain for the class.
If it is null, the default domain created
by java.lang.ClassLoader
is used.CannotCompileException
- for any errorClassPool.getClassLoader()