org.apache.cactus.internal.util
Class ClassLoaderUtils

java.lang.Object
  extended by org.apache.cactus.internal.util.ClassLoaderUtils

public class ClassLoaderUtils
extends java.lang.Object

Utiliy methods related to class loading in a webapp environment.

Version:
$Id: ClassLoaderUtils.java 238991 2004-05-22 11:34:50Z vmassol $

Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static java.lang.Class loadClass(java.lang.String theClassName, java.lang.Class theReferrer)
          Try loading a class first by using the context class loader or by using the classloader of the referrer class if the context classloader failed to load the class.
static java.lang.Class loadClassFromContextClassLoader(java.lang.String theClassName)
          Try loading class using the Context class loader.
static java.lang.Class loadClassFromWebappClassLoader(java.lang.String theClassName, java.lang.Class theReferrer)
          Try loading class using the Webapp class loader.
static java.util.ResourceBundle loadPropertyResourceBundle(java.lang.String theName, java.lang.Class theReferrer)
          Try loading a resource bundle from either the context class loader or the.
 
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

loadClass

public static java.lang.Class loadClass(java.lang.String theClassName,
                                        java.lang.Class theReferrer)
                                 throws java.lang.ClassNotFoundException
Try loading a class first by using the context class loader or by using the classloader of the referrer class if the context classloader failed to load the class.

Parameters:
theClassName - the name of the test class
theReferrer - the class will be loaded using the classloader which has loaded this referrer class
Returns:
the class object the test class to call
Throws:
java.lang.ClassNotFoundException - if the class cannot be loaded through either classloader

loadClassFromContextClassLoader

public static java.lang.Class loadClassFromContextClassLoader(java.lang.String theClassName)
                                                       throws java.lang.ClassNotFoundException
Try loading class using the Context class loader.

Parameters:
theClassName - the class to load
Returns:
the Class object for the class to load
Throws:
java.lang.ClassNotFoundException - if the class cannot be loaded through this class loader

loadClassFromWebappClassLoader

public static java.lang.Class loadClassFromWebappClassLoader(java.lang.String theClassName,
                                                             java.lang.Class theReferrer)
                                                      throws java.lang.ClassNotFoundException
Try loading class using the Webapp class loader.

Parameters:
theClassName - the class to load
theReferrer - the class will be loaded using the classloader which has loaded this referrer class
Returns:
the Class object for the class to load
Throws:
java.lang.ClassNotFoundException - if the class cannot be loaded through this class loader

loadPropertyResourceBundle

public static java.util.ResourceBundle loadPropertyResourceBundle(java.lang.String theName,
                                                                  java.lang.Class theReferrer)
Try loading a resource bundle from either the context class loader or the.

Parameters:
theName - the resource bundle name
theReferrer - the resource bundle will be loaded using the classloader which has loaded this referrer class
Returns:
the loaded resource bundle


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.