Package javassist.scopedpool
Class ScopedClassPool
- java.lang.Object
-
- javassist.ClassPool
-
- javassist.scopedpool.ScopedClassPool
-
public class ScopedClassPool extends ClassPool
A scoped class pool.- Version:
- $Revision: 1.8 $
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ref.WeakReferenceclassLoaderprotected LoaderClassPathclassPath(package private) booleanisBootstrapClprotected ScopedClassPoolRepositoryrepositoryprotected SoftValueHashMapsoftcache-
Fields inherited from class javassist.ClassPool
childFirstLookup, classes, doPruning, parent, releaseUnmodifiedClassFile, source
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)Deprecated.protectedScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)Create a new ScopedClassPool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcacheCtClass(java.lang.String classname, CtClass c, boolean dynamic)Cache a classvoidclose()Close the class poolvoidflushClass(java.lang.String classname)Flush a classprotected CtClassgetCached(java.lang.String classname)Get the cached classprotected CtClassgetCachedLocally(java.lang.String classname)Whether the class is cached in this pooledjava.lang.ClassLoadergetClassLoader()Get the class loaderprotected java.lang.ClassLoadergetClassLoader0()CtClassgetLocally(java.lang.String classname)Get any local copy of the classbooleanisUnloadedClassLoader()Whether the classloader is loadervoidlockInCache(CtClass c)Lock a class into the cachevoidsoften(CtClass clazz)Soften a classjava.lang.ClasstoClass(CtClass ct, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)Convert a javassist class to a java class-
Methods inherited from class javassist.ClassPool
appendClassPath, appendClassPath, appendPathList, appendSystemPath, clearImportedPackages, createCtClass, find, get, get, get0, getAndRename, getCtClass, getDefault, getImportedPackages, getMethod, getOrNull, importPackage, insertClassPath, insertClassPath, lookupCflow, makeAnnotation, makeClass, makeClass, makeClass, makeClass, makeClass, makeClass, makeClassIfNew, makeInterface, makeInterface, makePackage, recordInvalidClassName, removeCached, removeClassPath, toClass, toClass, toString
-
-
-
-
Field Detail
-
repository
protected ScopedClassPoolRepository repository
-
classLoader
protected java.lang.ref.WeakReference classLoader
-
classPath
protected LoaderClassPath classPath
-
softcache
protected SoftValueHashMap softcache
-
isBootstrapCl
boolean isBootstrapCl
-
-
Constructor Detail
-
ScopedClassPool
protected ScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)Deprecated.Create a new ScopedClassPool.- Parameters:
cl- the classloadersrc- the original class poolrepository- the repository
-
ScopedClassPool
protected ScopedClassPool(java.lang.ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)Create a new ScopedClassPool.- Parameters:
cl- the classloadersrc- the original class poolrepository- the repositoryisTemp- Whether this is a temporary pool used to resolve references
-
-
Method Detail
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Get the class loader- Overrides:
getClassLoaderin classClassPool- Returns:
- the class loader
- See Also:
ClassPool.toClass(CtClass),CtClass.getAnnotations()
-
getClassLoader0
protected java.lang.ClassLoader getClassLoader0()
-
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- Overrides:
getCachedin classClassPool- Parameters:
classname- the class name- Returns:
- the class
- See Also:
ClassPool.cacheCtClass(String,CtClass,boolean),ClassPool.removeCached(String)
-
cacheCtClass
protected void cacheCtClass(java.lang.String classname, CtClass c, boolean dynamic)Cache a class- Overrides:
cacheCtClassin classClassPool- Parameters:
classname- the class namec- the ctClassdynamic- whether the class is dynamically generated- See Also:
ClassPool.getCached(String),ClassPool.removeCached(String)
-
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, java.security.ProtectionDomain domain) throws CannotCompileException
Convert a javassist class to a java class- Overrides:
toClassin classClassPool- Parameters:
ct- the javassist classloader- the loaderdomain- the protection domain for the class. If it is null, the default domain created byjava.lang.ClassLoaderis used.- Throws:
CannotCompileException- for any error- See Also:
ClassPool.getClassLoader()
-
-