Class XrayClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- patterntesting.runtime.junit.internal.XrayClassLoader
-
public final class XrayClassLoader extends java.lang.ClassLoader
If we want to load a class and see what happens if another class (needed by the original class) is missing we need a class loader where we can control the classpath and other things.Since 1.6 this class is now moved from the experimental to the internal package.
- Since:
- 1.1 (26.12.2010)
- Author:
- oliver
-
-
Constructor Summary
Constructors Constructor Description XrayClassLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Class<?>
findClass(java.lang.String classname)
Find class.java.util.Set<java.lang.Class<?>>
getLoadedClasses()
Gets the loaded classed of this classloader here.java.lang.Class<?>
loadClass(java.lang.String classname)
Load class.protected java.lang.Class<?>
loadClass(java.lang.String name, boolean resolve)
Loads the class with the given binary name.-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String classname) throws java.lang.ClassNotFoundException
Load class.- Overrides:
loadClass
in classjava.lang.ClassLoader
- Parameters:
classname
- the classname- Returns:
- the class
- Throws:
java.lang.ClassNotFoundException
- the class not found exception- See Also:
ClassLoader.loadClass(java.lang.String)
-
loadClass
protected java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
Loads the class with the given binary name. If the given class is a Java class from the bootstrap class we ask the parent to do the job. Otherwise we would get a security exception or something like that.- Overrides:
loadClass
in classjava.lang.ClassLoader
- Parameters:
name
- the binary name of the classresolve
- inidicates if the class should be resolved (linked) or not- Returns:
- the loaded class
- Throws:
java.lang.ClassNotFoundException
- the class not found exception
-
getLoadedClasses
public java.util.Set<java.lang.Class<?>> getLoadedClasses()
Gets the loaded classed of this classloader here.- Returns:
- the loaded classed
-
findClass
protected java.lang.Class<?> findClass(java.lang.String classname) throws java.lang.ClassNotFoundException
Find class.- Overrides:
findClass
in classjava.lang.ClassLoader
- Parameters:
classname
- the classname- Returns:
- the class
- Throws:
java.lang.ClassNotFoundException
- the class not found exception- See Also:
ClassLoader.findClass(java.lang.String)
-
-