org.apache.commons.jelly.util
Class ClassLoaderUtils

java.lang.Object
  extended byorg.apache.commons.jelly.util.ClassLoaderUtils

public class ClassLoaderUtils
extends java.lang.Object

A class to centralize the class loader management code.


Constructor Summary
ClassLoaderUtils()
           
 
Method Summary
static java.lang.ClassLoader getClassLoader(java.lang.Class clazz)
          Get the loader for the given class.
static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader specifiedLoader, boolean useContextClassLoader, java.lang.Class callingClass)
          Return the class loader to be used for instantiating application objects when required.
static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader specifiedLoader, java.lang.Class callingClass)
          Return the class loader to be used for instantiating application objects when a context class loader is not specified.
static java.lang.Class loadClass(java.lang.String className, java.lang.Class callingClass)
          Loads the given class using the current Thread's context class loader first otherwise use the class loader which loaded this class.
static java.lang.Class loadClass(java.lang.String className, java.lang.ClassLoader specifiedLoader, boolean useContextLoader, java.lang.Class callingClass)
          Loads the given class using: the specified classloader, the current Thread's context class loader first, if asked otherwise use the class loader which loaded this class.
 
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

getClassLoader

public static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader specifiedLoader,
                                                   boolean useContextClassLoader,
                                                   java.lang.Class callingClass)
Return the class loader to be used for instantiating application objects when required. This is determined based upon the following rules:


getClassLoader

public static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader specifiedLoader,
                                                   java.lang.Class callingClass)
Return the class loader to be used for instantiating application objects when a context class loader is not specified. This is determined based upon the following rules:


getClassLoader

public static java.lang.ClassLoader getClassLoader(java.lang.Class clazz)
Get the loader for the given class.

Parameters:
clazz - the class to retrieve the loader for
Returns:
the class loader that loaded the provided class

loadClass

public static java.lang.Class loadClass(java.lang.String className,
                                        java.lang.Class callingClass)
                                 throws java.lang.ClassNotFoundException
Loads the given class using the current Thread's context class loader first otherwise use the class loader which loaded this class.

Throws:
java.lang.ClassNotFoundException

loadClass

public static java.lang.Class loadClass(java.lang.String className,
                                        java.lang.ClassLoader specifiedLoader,
                                        boolean useContextLoader,
                                        java.lang.Class callingClass)
                                 throws java.lang.ClassNotFoundException
Loads the given class using:
  1. the specified classloader,
  2. the current Thread's context class loader first, if asked
  3. otherwise use the class loader which loaded this class.

Throws:
java.lang.ClassNotFoundException


Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.