Package bitronix.tm.utils
Class ClassLoaderUtils
java.lang.Object
bitronix.tm.utils.ClassLoaderUtils
Static utility methods for loading classes and resources.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoaderGet the class loader which can be used to generate proxies without leaking memory.static InputStreamgetResourceAsStream(String resourceName) Load a resource from the classpath.static ClassLoad a class by name.
-
Constructor Details
-
ClassLoaderUtils
public ClassLoaderUtils()
-
-
Method Details
-
getClassLoader
Get the class loader which can be used to generate proxies without leaking memory.- Returns:
- the class loader which can be used to generate proxies without leaking memory.
-
loadClass
Load a class by name. Tries the current thread's context loader then falls back toClass.forName(String).- Parameters:
className- name of the class to load.- Returns:
- the loaded class.
- Throws:
ClassNotFoundException- if the class cannot be found in the classpath.
-
getResourceAsStream
Load a resource from the classpath. Tries the current thread's context loader then falls back toClassLoader.getResourceAsStream(String)using this class' classloader.- Parameters:
resourceName- the resource name to load.- Returns:
- a
InputStreamif the resource could be found, null otherwise.
-