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.LoaderDefers 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 voidaddIgnorePackage(String... packagesToIgnore)voidcache(Class<?> cls)Register a class to the cache of this classloaderprotected URLfindResource(String name)Finds the resource with the specified name on the search path.protected Enumeration<URL>findResources(String name)URLgetResource(String s)InputStreamgetResourceAsStream(String s)Enumeration<URL>getResources(String name)protected Class<?>loadClass(String name, boolean resolve)protected abstract Class<?>loadModifiedClass(String s)protected abstract booleanshouldLoadUnmodifiedClass(String className)protected booleanshouldModify(Iterable<String> packages, String name)protected abstract booleanshouldModifyClass(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:
loadClassin classjavassist.Loader- Throws:
ClassNotFoundException
-
findResource
protected URL findResource(String name)
Finds the resource with the specified name on the search path.- Overrides:
findResourcein classClassLoader- Parameters:
name- the name of the resource- Returns:
- a
URLfor the resource, ornullif the resource could not be found.
-
findResources
protected Enumeration<URL> findResources(String name) throws IOException
- Overrides:
findResourcesin classClassLoader- Throws:
IOException
-
getResource
public URL getResource(String s)
- Overrides:
getResourcein classClassLoader
-
getResourceAsStream
public InputStream getResourceAsStream(String s)
- Overrides:
getResourceAsStreamin classClassLoader
-
getResources
public Enumeration<URL> getResources(String name) throws IOException
- Overrides:
getResourcesin 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
-
-