Package org.powermock.core.classloader
Class DeferSupportingClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- javassist.Loader
-
- org.powermock.core.classloader.DeferSupportingClassLoader
-
- Direct Known Subclasses:
MockClassLoader
public abstract class DeferSupportingClassLoader extends javassist.Loader
Defers classloading of system classes to a delegate.- Author:
- Johan Haleby, Jan Kronquist
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addIgnorePackage(String... packagesToIgnore)
void
cache(Class<?> cls)
Register a class to the cache of this classloaderprotected URL
findResource(String name)
Finds the resource with the specified name on the search path.protected Enumeration<URL>
findResources(String name)
URL
getResource(String s)
InputStream
getResourceAsStream(String s)
Enumeration<URL>
getResources(String name)
protected Class<?>
loadClass(String name, boolean resolve)
protected abstract Class<?>
loadModifiedClass(String s)
protected abstract boolean
shouldLoadUnmodifiedClass(String className)
protected boolean
shouldModify(Iterable<String> packages, String name)
protected abstract boolean
shouldModifyClass(String s)
-
Methods inherited from class javassist.Loader
addTranslator, delegateLoadingOf, delegateToParent, findClass, loadClassByDelegation, main, run, run, setClassPool, setDomain
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
addIgnorePackage
public void addIgnorePackage(String... packagesToIgnore)
-
loadClass
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
- Overrides:
loadClass
in classjavassist.Loader
- Throws:
ClassNotFoundException
-
findResource
protected URL findResource(String name)
Finds the resource with the specified name on the search path.- Overrides:
findResource
in classClassLoader
- Parameters:
name
- the name of the resource- Returns:
- a
URL
for the resource, ornull
if the resource could not be found.
-
findResources
protected Enumeration<URL> findResources(String name) throws IOException
- Overrides:
findResources
in classClassLoader
- Throws:
IOException
-
getResource
public URL getResource(String s)
- Overrides:
getResource
in classClassLoader
-
getResourceAsStream
public InputStream getResourceAsStream(String s)
- Overrides:
getResourceAsStream
in classClassLoader
-
getResources
public Enumeration<URL> getResources(String name) throws IOException
- Overrides:
getResources
in classClassLoader
- Throws:
IOException
-
loadModifiedClass
protected abstract Class<?> loadModifiedClass(String s) throws ClassFormatError, ClassNotFoundException
-
shouldModifyClass
protected abstract boolean shouldModifyClass(String s)
-
shouldLoadUnmodifiedClass
protected abstract boolean shouldLoadUnmodifiedClass(String className)
-
cache
public void cache(Class<?> cls)
Register a class to the cache of this classloader
-
-