bitronix.tm.utils
Class ClassLoaderUtils

java.lang.Object
  extended by bitronix.tm.utils.ClassLoaderUtils

public class ClassLoaderUtils
extends java.lang.Object

Static utility methods for loading classes and resources.

© Bitronix Software


Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static java.io.InputStream getResourceAsStream(java.lang.String resourceName)
          Load a resource from the classpath.
static java.lang.Class loadClass(java.lang.String className)
          Load a class by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderUtils

public ClassLoaderUtils()
Method Detail

loadClass

public static java.lang.Class loadClass(java.lang.String className)
                                 throws java.lang.ClassNotFoundException
Load a class by name. Tries the current thread's context loader then falls back to Class.forName(String).

Parameters:
className - name of the class to load.
Returns:
the loaded class.
Throws:
java.lang.ClassNotFoundException - if the class cannot be found in the classpath.

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String resourceName)
Load a resource from the classpath. Tries the current thread's context loader then falls back to ClassLoader.getResourceAsStream(String) using this class' classloader.

Parameters:
resourceName - the resource name to load.
Returns:
a InputStream if the resource could be found, null otherwise.