public final class ClassLoaderUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassLoaderUtils.ClassLoaderHolder |
| Modifier and Type | Method and Description |
|---|---|
static String |
getClassLoaderName(Class<?> type) |
static URL |
getResource(String resourceName,
Class<?> callingClass)
Load a given resource.
|
static InputStream |
getResourceAsStream(String resourceName,
Class<?> callingClass)
This is a convenience method to load a resource as a stream.
|
static List<URL> |
getResources(String resourceName,
Class<?> callingClass)
Load a given resources.
|
static ClassLoader |
getURLClassLoader(List<URL> urlList,
ClassLoader parent) |
static ClassLoader |
getURLClassLoader(URL[] urls,
ClassLoader parent) |
static Class<?> |
loadClass(String className,
Class<?> callingClass)
Load a class with a given name.
|
static <T> Class<? extends T> |
loadClass(String className,
Class<?> callingClass,
Class<T> type) |
static Class<?> |
loadClassFromContextLoader(String className) |
static ClassLoaderUtils.ClassLoaderHolder |
setThreadContextClassloader(ClassLoader newLoader) |
public static ClassLoaderUtils.ClassLoaderHolder setThreadContextClassloader(ClassLoader newLoader)
public static ClassLoader getURLClassLoader(URL[] urls, ClassLoader parent)
public static ClassLoader getURLClassLoader(List<URL> urlList, ClassLoader parent)
public static URL getResource(String resourceName, Class<?> callingClass)
resourceName - The name of the resource to loadcallingClass - The Class object of the calling objectpublic static List<URL> getResources(String resourceName, Class<?> callingClass)
resourceName - The name of the resource to loadcallingClass - The Class object of the calling objectpublic static InputStream getResourceAsStream(String resourceName, Class<?> callingClass)
resourceName - The name of the resource to loadcallingClass - The Class object of the calling objectpublic static Class<?> loadClass(String className, Class<?> callingClass) throws ClassNotFoundException
className - The name of the class to loadcallingClass - The Class object of the calling objectClassNotFoundException - If the class cannot be found anywhere.public static <T> Class<? extends T> loadClass(String className, Class<?> callingClass, Class<T> type) throws ClassNotFoundException
ClassNotFoundExceptionpublic static Class<?> loadClassFromContextLoader(String className) throws ClassNotFoundException
ClassNotFoundExceptionApache CXF