程序包 bsh.classpath
类 ClassManagerImpl
java.lang.Object
bsh.BshClassManager
bsh.classpath.ClassManagerImpl
Manage all classloading in BeanShell. Allows classpath extension and class file reloading. This class holds the implementation of the BshClassManager so that it can be separated from the core package. This class currently relies on 1.2 for BshClassLoader and weak references. Is there a workaround for weak refs? If so we could make this work with 1.1 by supplying our own classloader code... See "http://www.beanshell.org/manual/classloading.html" for details on the bsh classloader architecture. Bsh has a multi-tiered class loading architecture. No class loader is created unless/until a class is generated, the classpath is modified, or a class is reloaded. Note: we may need some synchronization in here Note on jdk1.2 dependency: We are forced to use weak references here to accomodate all of the fleeting namespace listeners. (NameSpaces must be informed if the class space changes so that they can un-cache names). I had the interesting thought that a way around this would be to implement BeanShell's own garbage collector... Then I came to my senses and said - screw it, class re-loading will require 1.2. --------------------- Classloading precedence: in-script evaluated class (scripted class) in-script added / modified classpath optionally, external classloader optionally, thread context classloader plain Class.forName() source class (.java file in classpath)
-
嵌套类概要
从类继承的嵌套类/接口 bsh.BshClassManager
BshClassManager.Listener
-
字段概要
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addClassPath
(URL path) void
classForName
(String name) Load the specified class by name, taking into account added classpath and reloaded classes, etc.protected void
Clear global class cache and notify namespaces to clear their class caches.defineClass
(String name, byte[] code) Get the BeanShell classloader.void
Support for "import *;" Hide details in here as opposed to NameSpace.void
dump
(PrintWriter i) getClassNameByUnqName
(String name) Return the name or null if none is found, Throw an ClassPathException containing detail if name is ambigous.Get the full blown classpath.getResource
(String path) Get a resource URL using the BeanShell classpathgetResourceAsStream
(String path) Get a resource stream using the BeanShell classpathprotected boolean
A "super import" ("import *") operation has been performed.void
Overlay the entire path with a new class loader.void
reloadClasses
(String[] classNames) Reloading classes means creating a new classloader and using it whenever we are asked for classes in the appropriate space.void
reloadPackage
(String pack) Reload all classes in the specified package: e.g.void
void
reset()
Clear all classloading behavior and class caches and reset to initial state.void
setClassPath
(URL[] cp) Set a new base classpath and create a new base classloader.
-
构造器详细资料
-
ClassManagerImpl
public ClassManagerImpl()Used by BshClassManager singleton constructor
-
-
方法详细资料
-
classForName
从类复制的说明:BshClassManager
Load the specified class by name, taking into account added classpath and reloaded classes, etc. Note: Again, this is just a trivial implementation. See bsh.classpath.ClassManagerImpl for the fully functional class management package.- 覆盖:
classForName
在类中BshClassManager
- 返回:
- the class or null
-
getResource
Get a resource URL using the BeanShell classpath- 覆盖:
getResource
在类中BshClassManager
- 参数:
path
- should be an absolute path
-
getResourceAsStream
Get a resource stream using the BeanShell classpath- 覆盖:
getResourceAsStream
在类中BshClassManager
- 参数:
path
- should be an absolute path
-
addClassPath
- 覆盖:
addClassPath
在类中BshClassManager
- 抛出:
IOException
-
reset
public void reset()Clear all classloading behavior and class caches and reset to initial state.- 覆盖:
reset
在类中BshClassManager
-
setClassPath
Set a new base classpath and create a new base classloader. This means all types change.- 覆盖:
setClassPath
在类中BshClassManager
-
reloadAllClasses
Overlay the entire path with a new class loader. Set the base path to the user path + base path. No point in including the boot class path (can't reload thos).- 覆盖:
reloadAllClasses
在类中BshClassManager
- 抛出:
ClassPathException
-
reloadClasses
Reloading classes means creating a new classloader and using it whenever we are asked for classes in the appropriate space. For this we use a DiscreteFilesClassLoader- 覆盖:
reloadClasses
在类中BshClassManager
- 抛出:
ClassPathException
-
reloadPackage
Reload all classes in the specified package: e.g. "com.sun.tools" The special package name "" can be used to refer to unpackaged classes. - 覆盖:
reloadPackage
在类中BshClassManager
- 抛出:
ClassPathException
-
getClassPath
Get the full blown classpath. -
doSuperImport
Support for "import *;" Hide details in here as opposed to NameSpace.- 覆盖:
doSuperImport
在类中BshClassManager
- 抛出:
UtilEvalError
-
hasSuperImport
protected boolean hasSuperImport()从类复制的说明:BshClassManager
A "super import" ("import *") operation has been performed.- 覆盖:
hasSuperImport
在类中BshClassManager
-
getClassNameByUnqName
Return the name or null if none is found, Throw an ClassPathException containing detail if name is ambigous.- 覆盖:
getClassNameByUnqName
在类中BshClassManager
- 抛出:
ClassPathException
-
addListener
- 覆盖:
addListener
在类中BshClassManager
-
removeListener
- 覆盖:
removeListener
在类中BshClassManager
-
getBaseLoader
-
defineClass
Get the BeanShell classloader. public ClassLoader getClassLoader() { }- 覆盖:
defineClass
在类中BshClassManager
-
classLoaderChanged
protected void classLoaderChanged()Clear global class cache and notify namespaces to clear their class caches. The listener list is implemented with weak references so that we will not keep every namespace in existence forever.- 覆盖:
classLoaderChanged
在类中BshClassManager
-
dump
- 覆盖:
dump
在类中BshClassManager
-