org.apache.ibatis.io
Class ClassLoaderWrapper

java.lang.Object
  extended by org.apache.ibatis.io.ClassLoaderWrapper

public class ClassLoaderWrapper
extends Object

A class to wrap access to multiple class loaders making them work as one


Method Summary
 Class classForName(String name)
          Find a class on the classpath (or die trying)
 Class classForName(String name, ClassLoader classLoader)
          Find a class on the classpath, starting with a specific classloader (or die trying)
 InputStream getResourceAsStream(String resource)
          Get a resource from the classpath
 InputStream getResourceAsStream(String resource, ClassLoader classLoader)
          Get a resource from the classpath, starting with a specific class loader
 URL getResourceAsURL(String resource)
          Get a resource as a URL using the current class path
 URL getResourceAsURL(String resource, ClassLoader classLoader)
          Get a resource from the classpath, starting with a specific class loader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResourceAsURL

public URL getResourceAsURL(String resource)
Get a resource as a URL using the current class path

Parameters:
resource - - the resource to locate
Returns:
the resource or null

getResourceAsURL

public URL getResourceAsURL(String resource,
                            ClassLoader classLoader)
Get a resource from the classpath, starting with a specific class loader

Parameters:
resource - - the resource to find
classLoader - - the first classloader to try
Returns:
the stream or null

getResourceAsStream

public InputStream getResourceAsStream(String resource)
Get a resource from the classpath

Parameters:
resource - - the resource to find
Returns:
the stream or null

getResourceAsStream

public InputStream getResourceAsStream(String resource,
                                       ClassLoader classLoader)
Get a resource from the classpath, starting with a specific class loader

Parameters:
resource - - the resource to find
classLoader - - the first class loader to try
Returns:
the stream or null

classForName

public Class classForName(String name)
                   throws ClassNotFoundException
Find a class on the classpath (or die trying)

Parameters:
name - - the class to look for
Returns:
- the class
Throws:
ClassNotFoundException - Duh.

classForName

public Class classForName(String name,
                          ClassLoader classLoader)
                   throws ClassNotFoundException
Find a class on the classpath, starting with a specific classloader (or die trying)

Parameters:
name - - the class to look for
classLoader - - the first classloader to try
Returns:
- the class
Throws:
ClassNotFoundException - Duh.


Copyright © 2010. All Rights Reserved.