Package net.sf.ehcache.management
Class ResourceClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- net.sf.ehcache.management.ResourceClassLoader
-
public class ResourceClassLoader extends java.lang.ClassLoaderResourceClassLoader can load classes nested in a subdirectory of a jar Example : ehcache.jar!/net/sf/ehcache/CacheManager is in the "normal" classpath and will be loaded by any typical classloader ehcache.jar!/subdirectory/net/sf/ehcache/CacheManager can only be loaded by the ResourceClassLoader, with prefix "subdirectory" Assumes classes under prefix directory to have ending .clazz- Author:
- Anthony Dahanne
-
-
Constructor Summary
Constructors Constructor Description ResourceClassLoader(java.lang.String prefix, java.lang.ClassLoader parent)Given a parent classloader and the prefix to apply to the lookup path Creates a ResourceClassLoader able to load classes from resources prefixed with "prefix"
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Class<?>findClass(java.lang.String className)protected java.net.URLfindResource(java.lang.String name)protected java.util.Enumeration<java.net.URL>findResources(java.lang.String name)java.net.URLgetResource(java.lang.String name)java.util.Enumeration<java.net.URL>getResources(java.lang.String resourceName)java.lang.Class<?>loadClass(java.lang.String name, boolean resolve)-
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, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
ResourceClassLoader
public ResourceClassLoader(java.lang.String prefix, java.lang.ClassLoader parent)Given a parent classloader and the prefix to apply to the lookup path Creates a ResourceClassLoader able to load classes from resources prefixed with "prefix"- Parameters:
prefix-parent-
-
-
Method Detail
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException- Overrides:
loadClassin classjava.lang.ClassLoader- Throws:
java.lang.ClassNotFoundException
-
getResource
public java.net.URL getResource(java.lang.String name)
- Overrides:
getResourcein classjava.lang.ClassLoader
-
findResource
protected java.net.URL findResource(java.lang.String name)
- Overrides:
findResourcein classjava.lang.ClassLoader
-
getResources
public java.util.Enumeration<java.net.URL> getResources(java.lang.String resourceName) throws java.io.IOException- Overrides:
getResourcesin classjava.lang.ClassLoader- Throws:
java.io.IOException
-
findResources
protected java.util.Enumeration<java.net.URL> findResources(java.lang.String name) throws java.io.IOException- Overrides:
findResourcesin classjava.lang.ClassLoader- Throws:
java.io.IOException
-
findClass
protected java.lang.Class<?> findClass(java.lang.String className) throws java.lang.ClassNotFoundException- Overrides:
findClassin classjava.lang.ClassLoader- Throws:
java.lang.ClassNotFoundException
-
-