org.codehaus.aspectwerkz.util
Class ContextClassLoader

java.lang.Object
  extended by org.codehaus.aspectwerkz.util.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 Class forName(ClassLoader loader, String name)
          Loads a class starting from the given class loader (can be null, then use default class loader)
static Class forName(String name)
          Loads a class from the context class loader or, if that fails, from the default class loader.
static ClassLoader getLoader()
          Returns the context 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

forName

public static Class forName(ClassLoader loader,
                            String name)
                     throws ClassNotFoundException
Loads a class starting from the given class loader (can be null, then use default class loader)

Parameters:
loader -
name - of class to load
Returns:
Throws:
ClassNotFoundException

forName

public static Class forName(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.

getLoader

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

Returns:
the context class loader


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