org.codehaus.aspectwerkz
Class ContextClassLoader

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

public class ContextClassLoader
extends java.lang.Object

Methods to deal with the context class loader. Fail-over is provided to the default class loader.

Author:
Tibor Varga, Jonas Bonér

Constructor Summary
ContextClassLoader()
           
 
Method Summary
static java.lang.ClassLoader getLoader()
          Returns the context class loader.
static java.io.InputStream getResourceAsStream(java.lang.String name)
          Loads a resource from the context class loader or, if that fails, from the default class loader, as stream
static java.lang.Class loadClass(java.lang.String name)
          Loads a class from the context class loader or, if that fails, from the default class loader.
static java.net.URL loadResource(java.lang.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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextClassLoader

public ContextClassLoader()
Method Detail

loadClass

public static java.lang.Class loadClass(java.lang.String name)
                                 throws java.lang.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:
java.lang.ClassNotFoundException - if the class was not found.

loadResource

public static java.net.URL loadResource(java.lang.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 java.io.InputStream getResourceAsStream(java.lang.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 java.lang.ClassLoader getLoader()
Returns the context class loader.

Returns:
the context class loader


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.