org.eclipse.jetty.util

## Class Loader

- java.lang.Object
- - org.eclipse.jetty.util.Loader

-     public class Loader
      extends Object

  ClassLoader Helper. This helper class allows classes to be loaded either from the Thread's ContextClassLoader, the classloader of the derived class or the system ClassLoader. Usage:

       public class MyClass {
           void myMethod() {
                ...
                Class c=Loader.loadClass(this.getClass(),classname);
                ...
           }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Loader()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getClassPath(ClassLoader loader)` Generate the classpath (as a string) of all classloaders above the given classloader.
    `static URL` | `getResource(Class<?> loadClass, String name, boolean checkParents)`
    `static ResourceBundle` | `getResourceBundle(Class<?> loadClass, String name, boolean checkParents, Locale locale)`
    `static Class` | `loadClass(Class loadClass, String name)`
    `static Class` | `loadClass(Class loadClass, String name, boolean checkParents)` Load a class.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Loader

          public Loader()

  - ### Method Detail

    - #### getResource

          public static URL getResource(Class<?> loadClass,
                        String name,
                        boolean checkParents)
                                 throws ClassNotFoundException

      Throws:
        `ClassNotFoundException`

    - #### loadClass

          public static Class loadClass(Class loadClass,
                        String name)
                                 throws ClassNotFoundException

      Throws:
        `ClassNotFoundException`

    - #### loadClass

          public static Class loadClass(Class loadClass,
                        String name,
                        boolean checkParents)
                                 throws ClassNotFoundException

      Load a class.
      Parameters:
        `loadClass` -
        `name` -
        `checkParents` - If true, try loading directly from parent classloaders.
      Returns:
        Class
      Throws:
        `ClassNotFoundException`

    - #### getResourceBundle

          public static ResourceBundle getResourceBundle(Class<?> loadClass,
                                         String name,
                                         boolean checkParents,
                                         Locale locale)
                                                  throws MissingResourceException

      Throws:
        `MissingResourceException`

    - #### getClassPath

          public static String getClassPath(ClassLoader loader)
                                     throws Exception

      Generate the classpath (as a string) of all classloaders above the given classloader. This is primarily used for jasper.
      Returns:
        the system class path
      Throws:
        `Exception`

Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.