bitronix.tm.utils
Class ClassLoaderUtils

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

public class ClassLoaderUtils
extends Object

Static utility methods for loading classes and resources.


Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static ClassLoader getClassLoader()
          Get the class loader which can be used to generate proxies without leaking memory.
static InputStream getResourceAsStream(String resourceName)
          Load a resource from the classpath.
static Class loadClass(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

getClassLoader

public static ClassLoader 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

public static Class loadClass(String className)
                       throws 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:
ClassNotFoundException - if the class cannot be found in the classpath.

getResourceAsStream

public static InputStream getResourceAsStream(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.


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.