public class TestCaseClassLoader extends ClassLoader
The list of excluded package paths is specified in a properties file "excluded.properties" that is located in the same place as the TestCaseClassLoader class.
Known limitation: the TestCaseClassLoader cannot load classes from jar files. - Not needed for 1.0 SDK
proxyCache
Constructor and Description |
---|
TestCaseClassLoader()
Constructs a TestCaseLoader.
|
TestCaseClassLoader(String classPath)
Constructs a TestCaseLoader.
|
Modifier and Type | Method and Description |
---|---|
URL |
getResource(String name)
Finds the resource with the given name.
|
InputStream |
getResourceAsStream(String name)
Returns an input stream for reading the specified resource.
|
boolean |
isExcluded(String name) |
Class |
loadClass(String name,
boolean resolve)
Loads the class with the specified binary name.
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public TestCaseClassLoader()
public TestCaseClassLoader(String classPath)
public URL getResource(String name)
ClassLoader
The name of a resource is a '/'-separated path name that identifies the resource.
This method will first search the parent class loader for the
resource; if the parent is null the path of the class loader
built-in to the virtual machine is searched. That failing, this method
will invoke ClassLoader.findResource(String)
to find the resource.
getResource
in class ClassLoader
name
- The resource namepublic InputStream getResourceAsStream(String name)
ClassLoader
The search order is described in the documentation for ClassLoader.getResource(String)
.
getResourceAsStream
in class ClassLoader
name
- The resource namepublic boolean isExcluded(String name)
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException
ClassLoader
Invoke ClassLoader.findLoadedClass(String)
to check if the class
has already been loaded.
Invoke the loadClass
method
on the parent class loader. If the parent is null the class
loader built-in to the virtual machine is used, instead.
Invoke the ClassLoader.findClass(String)
method to find the
class.
If the class was found using the above steps, and the
resolve flag is true, this method will then invoke the ClassLoader.resolveClass(Class)
method on the resulting Class object.
Subclasses of ClassLoader are encouraged to override ClassLoader.findClass(String)
, rather than this method.
loadClass
in class ClassLoader
name
- The binary name of the classresolve
- If true then resolve the classClassNotFoundException
- If the class could not be found