public class ResourceOverridingShadowingClassLoader extends ShadowingClassLoader
DEFAULT_EXCLUDED_PACKAGES
Constructor and Description |
---|
ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader)
Create a new ResourceOverridingShadowingClassLoader,
decorating the given ClassLoader.
|
Modifier and Type | Method and Description |
---|---|
void |
copyOverrides(ResourceOverridingShadowingClassLoader other)
Copy all overrides from the given ClassLoader.
|
URL |
getResource(String requestedPath) |
InputStream |
getResourceAsStream(String requestedPath) |
Enumeration<URL> |
getResources(String requestedPath) |
void |
override(String oldPath,
String newPath)
Return the resource (if any) at the new path
on an attempt to locate a resource at the old path.
|
void |
suppress(String oldPath)
Ensure that a resource with the given path is not found.
|
addTransformer, copyTransformers, isEligibleForShadowing, loadClass
excludeClass, excludePackage, isExcluded
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader)
enclosingClassLoader
- the ClassLoader to decoratepublic void override(String oldPath, String newPath)
oldPath
- the path requestednewPath
- the actual path to be looked uppublic void suppress(String oldPath)
oldPath
- the path of the resource to hide even if
it exists in the parent ClassLoaderpublic void copyOverrides(ResourceOverridingShadowingClassLoader other)
other
- the other ClassLoader to copy frompublic URL getResource(String requestedPath)
getResource
in class ShadowingClassLoader
@Nullable public InputStream getResourceAsStream(String requestedPath)
getResourceAsStream
in class ShadowingClassLoader
public Enumeration<URL> getResources(String requestedPath) throws IOException
getResources
in class ShadowingClassLoader
IOException