Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.red5.classloading
Class ChildFirstClassLoader

    java.lang.Object
      java.lang.ClassLoader
          java.security.SecureClassLoader
              java.net.URLClassLoader
                  org.red5.classloading.ChildFirstClassLoader

    public final class ChildFirstClassLoader

extends URLClassLoader

An almost trivial no-fuss implementation of a class loader following the child-first delegation model. Based on code from Ceki Gulcu

Author:
  Paul Gregoire (mondain@gmail.com)

Constructor Summary
`ChildFirstClassLoader(URL[] urls)`
`ChildFirstClassLoader(URL[] urls, ClassLoader parent)`

Method Summary
`URL` | `getResource(String name)` Override the parent-first resource loading model established by java.lang.Classloader with child-first behavior.
`Class<?>` | `loadClass(String name)`
`protected Class<?>` | `loadClass(String name, boolean resolve)` We override the parent-first behavior established by java.lang.Classloader.

Methods inherited from class java.net.URLClassLoader
`addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance`

Methods inherited from class java.security.SecureClassLoader
`defineClass, defineClass`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChildFirstClassLoader

    public ChildFirstClassLoader(URL[] urls)

### ChildFirstClassLoader

    public ChildFirstClassLoader(URL[] urls,
                                 ClassLoader parent)

Method Detail

### loadClass

    public Class<?> loadClass(String name)
                       throws ClassNotFoundException

  Overrides:
    `loadClass` in class `ClassLoader`
  Throws:
    `ClassNotFoundException`

### loadClass

    protected Class<?> loadClass(String name,
                                 boolean resolve)
                          throws ClassNotFoundException

  We override the parent-first behavior established by java.lang.Classloader.

  The implementation is surprisingly straightforward.

  Overrides:
    `loadClass` in class `ClassLoader`
  Parameters:
    `name` - the name of the class to load, should not be `null` .
    `resolve` - flag that indicates whether the class should be resolved.
  Returns:
    the loaded class, never `null`.
  Throws:
    `ClassNotFoundException` - if the class could not be loaded.

### getResource

    public URL getResource(String name)

  Override the parent-first resource loading model established by java.lang.Classloader with child-first behavior.

  Overrides:
    `getResource` in class `ClassLoader`
  Parameters:
    `name` - the name of the resource to load, should not be `null`.
  Returns:
    a `URL` for the resource, or `null` if it could not be found.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 The Red5 Project