org.codehaus.aspectwerkz
Class ContextClassLoader

java.lang.Object
  extended byorg.codehaus.aspectwerkz.ContextClassLoader

public final class ContextClassLoader
extends Object

Utility methods dealing with the context class loader. Fail-over is provided to the default class loader.

Author:
Jonas Bonér

Constructor Summary
ContextClassLoader()
           
 
Method Summary
static ClassLoader getLoader()
          Returns the context class loader.
static InputStream getResourceAsStream(String name)
          Loads a resource from the context class loader or, if that fails, from the default class loader, as stream
static Class loadClass(String name)
          Loads a class from the context class loader or, if that fails, from the default class loader.
static URL loadResource(String name)
          Loads a resource from the context class loader or, if that fails, from the default class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextClassLoader

public ContextClassLoader()
Method Detail

loadClass

public static Class loadClass(String name)
                       throws ClassNotFoundException
Loads a class from the context class loader or, if that fails, from the default class loader.

Parameters:
name - is the name of the class to load.
Returns:
a Class object.
Throws:
ClassNotFoundException - if the class was not found.

loadResource

public static URL loadResource(String name)
Loads a resource from the context class loader or, if that fails, from the default class loader.

Parameters:
name - is the name of the resource to load.
Returns:
a URL object.

getResourceAsStream

public static InputStream getResourceAsStream(String name)
Loads a resource from the context class loader or, if that fails, from the default class loader, as stream

Parameters:
name - is the name of the resource to load.
Returns:
a InputStream object.

getLoader

public static ClassLoader getLoader()
Returns the context class loader.

Returns:
the context class loader


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.