public class ScopedClassPool extends ClassPool
Modifier and Type | Field and Description |
---|---|
protected WeakReference |
classLoader |
protected LoaderClassPath |
classPath |
protected ScopedClassPoolRepository |
repository |
protected SoftValueHashMap |
softcache |
childFirstLookup, classes, doPruning, parent, releaseUnmodifiedClassFile, source
Modifier | Constructor and Description |
---|---|
protected |
ScopedClassPool(ClassLoader cl,
ClassPool src,
ScopedClassPoolRepository repository)
Deprecated.
|
protected |
ScopedClassPool(ClassLoader cl,
ClassPool src,
ScopedClassPoolRepository repository,
boolean isTemp)
Create a new ScopedClassPool.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cacheCtClass(String classname,
CtClass c,
boolean dynamic)
Cache a class
|
void |
close()
Close the class pool
|
void |
flushClass(String classname)
Flush a class
|
protected CtClass |
getCached(String classname)
Get the cached class
|
protected CtClass |
getCachedLocally(String classname)
Whether the class is cached in this pooled
|
ClassLoader |
getClassLoader()
Get the class loader
|
protected ClassLoader |
getClassLoader0() |
CtClass |
getLocally(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
|
Class |
toClass(CtClass ct,
ClassLoader loader,
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 WeakReference classLoader
protected LoaderClassPath classPath
protected SoftValueHashMap softcache
protected ScopedClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
cl
- the classloadersrc
- the original class poolrepository
- the repositoryprotected ScopedClassPool(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 ClassLoader getClassLoader()
getClassLoader
in class ClassPool
ClassPool.toClass(CtClass)
,
CtClass.getAnnotations()
protected ClassLoader getClassLoader0()
public void close()
public void flushClass(String classname)
classname
- the class to flushpublic void soften(CtClass clazz)
clazz
- the classpublic boolean isUnloadedClassLoader()
protected CtClass getCached(String classname)
getCached
in class ClassPool
classname
- the class nameClassPool.cacheCtClass(String,CtClass,boolean)
,
ClassPool.removeCached(String)
protected void cacheCtClass(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(String classname)
classname
- the class namepublic CtClass getLocally(String classname) throws NotFoundException
classname
- the class nameNotFoundException
- when the class is not foundpublic Class toClass(CtClass ct, ClassLoader loader, 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()
Copyright © 2024. All rights reserved.