Top Description Fields Constructors Methods
javassist.scopedpool

public Class ScopedClassPool

extends ClassPool
Class Inheritance
Imports
java.lang.ref.Reference, .WeakReference, java.security.ProtectionDomain, java.util.Map, javassist.CannotCompileException, .ClassPool, .CtClass, .LoaderClassPath, .NotFoundException

A scoped class pool.
Authors
Bill Burke, Adrian Brock, Kabir Khan
Version
$Revision: 1.8 $

Field Summary

Modifier and TypeField and Description
protected Reference<ClassLoader>
protected LoaderClassPath
pack-priv boolean
protected ScopedClassPoolRepository
protected Map<String, CtClass>
Inherited from javassist.ClassPool:
cacheOpenedJarFilechildFirstLookupclassesdoPruningparentreleaseUnmodifiedClassFilesource

Constructor Summary

AccessConstructor and Description
protected
ScopedClassPool(ClassLoader
the classloader
cl
,
ClassPool
the original class pool
src
,
ScopedClassPoolRepository
the repository
repository
)

Create a new ScopedClassPool.

protected
ScopedClassPool(ClassLoader
the classloader
cl
,
ClassPool
the original class pool
src
,
ScopedClassPoolRepository
the repository
repository
,
boolean
Whether this is a temporary pool used to resolve references
isTemp
)

Create a new ScopedClassPool.

Method Summary

Modifier and TypeMethod and Description
protected void
cacheCtClass(String
the class name
classname
,
CtClass
the ctClass
c
,
boolean
whether the class is dynamically generated
dynamic
)

Overrides javassist.ClassPool.cacheCtClass.

Cache a class

public void
close()

Close the class pool

public synchronized void
flushClass(String
the class to flush
classname
)

Flush a class

protected CtClass

Returns:

the class
getCached
(String
the class name
classname
)

Overrides javassist.ClassPool.getCached.

Get the cached class

protected CtClass

Returns:

the cached class
getCachedLocally
(String
the class name
classname
)

Whether the class is cached in this pooled

public ClassLoader

Returns:

the class loader
getClassLoader
()

Overrides javassist.ClassPool.getClassLoader.

Get the class loader

protected ClassLoader
public synchronized CtClass

Returns:

the class
getLocally
(String
the class name
classname
)

Get any local copy of the class

public boolean

Returns:

false always
isUnloadedClassLoader
()

Whether the classloader is loader

public void
lockInCache(CtClass
the class
c
)

Lock a class into the cache

public synchronized void
soften(CtClass
the class
clazz
)

Soften a class

public Class<?>
toClass(CtClass
the javassist class
ct
,
ClassLoader
the loader
loader
,
ProtectionDomain
the protection domain for the class. If it is null, the default domain created by java.lang.ClassLoader is used.
domain
)

Overrides javassist.ClassPool.toClass.

Convert a javassist class to a java class

Inherited from javassist.ClassPool:
appendClassPathappendClassPathappendPathListappendSystemPathclearImportedPackagescreateCtClassfindgetgetget0getAndRenamegetCtClassgetDefaultgetImportedPackagesgetMethodgetOrNullimportPackageinsertClassPathinsertClassPathlookupCflowmakeAnnotationmakeClassmakeClassmakeClassmakeClassmakeClassmakeClassmakeClassIfNewmakeInterfacemakeInterfacemakePackagerecordInvalidClassNameremoveCachedremoveClassPathtoClasstoClasstoClasstoClasstoClasstoString

Field Detail

classLoaderback to summary
protected Reference<ClassLoader> classLoader
classPathback to summary
protected LoaderClassPath classPath
isBootstrapClback to summary
pack-priv boolean isBootstrapCl
repositoryback to summary
protected ScopedClassPoolRepository repository
softcacheback to summary
protected Map<String, CtClass> softcache

Constructor Detail

ScopedClassPoolback to summary
protected ScopedClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)

Create a new ScopedClassPool.

Parameters
cl:ClassLoader

the classloader

src:ClassPool

the original class pool

repository:ScopedClassPoolRepository

the repository

ScopedClassPoolback to summary
protected ScopedClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)

Create a new ScopedClassPool.

Parameters
cl:ClassLoader

the classloader

src:ClassPool

the original class pool

repository:ScopedClassPoolRepository

the repository

isTemp:boolean

Whether this is a temporary pool used to resolve references

Method Detail

cacheCtClassback to summary
protected void cacheCtClass(String classname, CtClass c, boolean dynamic)

Overrides javassist.ClassPool.cacheCtClass.

Cache a class

Parameters
classname:String

the class name

c:CtClass

the ctClass

dynamic:boolean

whether the class is dynamically generated

closeback to summary
public void close()

Close the class pool

flushClassback to summary
public synchronized void flushClass(String classname)

Flush a class

Parameters
classname:String

the class to flush

getCachedback to summary
protected CtClass getCached(String classname)

Overrides javassist.ClassPool.getCached.

Get the cached class

Parameters
classname:String

the class name

Returns:CtClass

the class

Annotations
@Override
getCachedLocallyback to summary
protected CtClass getCachedLocally(String classname)

Whether the class is cached in this pooled

Parameters
classname:String

the class name

Returns:CtClass

the cached class

getClassLoaderback to summary
public ClassLoader getClassLoader()

Overrides javassist.ClassPool.getClassLoader.

Get the class loader

Returns:ClassLoader

the class loader

getClassLoader0back to summary
protected ClassLoader getClassLoader0()
getLocallyback to summary
public synchronized CtClass getLocally(String classname) throws NotFoundException

Get any local copy of the class

Parameters
classname:String

the class name

Returns:CtClass

the class

Exceptions
NotFoundException:
when the class is not found
isUnloadedClassLoaderback to summary
public boolean isUnloadedClassLoader()

Whether the classloader is loader

Returns:boolean

false always

lockInCacheback to summary
public void lockInCache(CtClass c)

Lock a class into the cache

Parameters
c:CtClass

the class

softenback to summary
public synchronized void soften(CtClass clazz)

Soften a class

Parameters
clazz:CtClass

the class

toClassback to summary
public Class<?> toClass(CtClass ct, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException

Overrides javassist.ClassPool.toClass.

Convert a javassist class to a java class

Parameters
ct:CtClass

the javassist class

loader:ClassLoader

the loader

domain:ProtectionDomain

Doc from javassist.ClassPool.toClass.

the protection domain for the class. If it is null, the default domain created by java.lang.ClassLoader is used.

Exceptions
CannotCompileException:
for any error