public final class ClasspathResourceLoader extends Object implements ResourceLoader
ResourceLoader that uses ClassLoader.getResourceAsStream(String)
and Class.forName(String,boolean,ClassLoader) to open resources and
classes, respectively.| Constructor and Description |
|---|
ClasspathResourceLoader()
Creates an instance using the context classloader to load Resources and classes.
|
ClasspathResourceLoader(Class<?> clazz)
Creates an instance using the context classloader to load Resources and classes
Resources are resolved relative to the given class, if path is not absolute.
|
ClasspathResourceLoader(ClassLoader loader)
Creates an instance using the given classloader to load Resources and classes.
|
| Modifier and Type | Method and Description |
|---|---|
<T> Class<? extends T> |
findClass(String cname,
Class<T> expectedType)
Finds class of the name and expected type
|
<T> T |
newInstance(String cname,
Class<T> expectedType)
Creates an instance of the name and expected type
|
InputStream |
openResource(String resource)
Opens a named resource
|
public ClasspathResourceLoader()
public ClasspathResourceLoader(ClassLoader loader)
public ClasspathResourceLoader(Class<?> clazz)
public InputStream openResource(String resource) throws IOException
ResourceLoaderopenResource in interface ResourceLoaderIOExceptionpublic <T> Class<? extends T> findClass(String cname, Class<T> expectedType)
ResourceLoaderfindClass in interface ResourceLoaderpublic <T> T newInstance(String cname, Class<T> expectedType)
ResourceLoadernewInstance in interface ResourceLoaderCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.