Top Description Fields Constructors Methods
bsh.classpath

public Class BshClassLoader

extends URLClassLoader
Class Inheritance
Known Direct Subclasses
bsh.classpath.DiscreteFilesClassLoader
Imports
java.net.*, java.util.*, java.io.*, bsh.BshClassManager

One of the things BshClassLoader does is to address a deficiency in URLClassLoader that prevents us from specifying individual classes via URLs.

Field Summary

Modifier and TypeField and Description
pack-priv BshClassManager

Constructor Summary

AccessConstructor and Description
public
BshClassLoader(BshClassManager classManager, URL[]
URLs JARClassLoader seems to require absolute paths
bases
)

public
BshClassLoader(BshClassManager
URLs JARClassLoader seems to require absolute paths
classManager
,
BshClassPath bcp)

protected
BshClassLoader(BshClassManager
URLs JARClassLoader seems to require absolute paths
classManager
)

For use by children

Method Summary

Modifier and TypeMethod and Description
public void
addURL(URL
the URL to be added to the search path of URLs
url
)

Overrides java.net.URLClassLoader.addURL.

Appends the specified URL to the list of URLs to search for classes and resources.
protected Class<T>
findClass(String
the name of the class
name
)

Overrides java.net.URLClassLoader.findClass.

Find the correct source for the class...
pack-priv BshClassManager
public Class<T>
loadClass(String
The binary name of the class
name
,
boolean
If true then resolve the class
resolve
)

Overrides java.lang.ClassLoader.loadClass.

This modification allows us to reload classes which are in the Java VM user classpath.
Inherited from java.net.URLClassLoader:
closedefinePackagefindResourcefindResourcesgetPermissionsgetResourceAsStreamgetURLsnewInstancenewInstance

Field Detail

classManagerback to summary
pack-priv BshClassManager classManager

Constructor Detail

BshClassLoaderback to summary
public BshClassLoader(BshClassManager classManager, URL[] bases)
Parameters
bases:URL[]

URLs JARClassLoader seems to require absolute paths

BshClassLoaderback to summary
public BshClassLoader(BshClassManager classManager, BshClassPath bcp)
Parameters
classManager:BshClassManager

URLs JARClassLoader seems to require absolute paths

BshClassLoaderback to summary
protected BshClassLoader(BshClassManager classManager)

For use by children

Parameters
classManager:BshClassManager

URLs JARClassLoader seems to require absolute paths

Method Detail

addURLback to summary
public void addURL(URL url)

Overrides java.net.URLClassLoader.addURL.

Doc from java.net.URLClassLoader.addURL.

Appends the specified URL to the list of URLs to search for classes and resources.

If the URL specified is null or is already in the list of URLs, or if this loader is closed, then invoking this method has no effect.

Parameters
url:URL

the URL to be added to the search path of URLs

findClassback to summary
protected Class<T> findClass(String name) throws ClassNotFoundException

Overrides java.net.URLClassLoader.findClass.

Find the correct source for the class... Try designated loader if any Try our URLClassLoader paths if any Try base loader if any Try system ???

Parameters
name:String

Doc from java.net.URLClassLoader.findClass.

the name of the class

Returns:Class<T>

Doc from java.net.URLClassLoader.findClass.

the resulting class

Exceptions
ClassNotFoundException:

Doc from java.net.URLClassLoader.findClass.

if the class could not be found, or if the loader is closed.

getClassManagerback to summary
pack-priv BshClassManager getClassManager()
loadClassback to summary
public Class<T> loadClass(String name, boolean resolve) throws ClassNotFoundException

Overrides java.lang.ClassLoader.loadClass.

This modification allows us to reload classes which are in the Java VM user classpath. We search first rather than delegate to the parent classloader (or bootstrap path) first. An exception is for BeanShell core classes which are always loaded from the same classloader as the interpreter.

Parameters
name:String

Doc from java.lang.ClassLoader.loadClass.

The binary name of the class

resolve:boolean

Doc from java.lang.ClassLoader.loadClass.

If true then resolve the class

Returns:Class<T>

Doc from java.lang.ClassLoader.loadClass.

The resulting Class object

Exceptions
ClassNotFoundException:

Doc from java.lang.ClassLoader.loadClass.

If the class could not be found