ch.qos.cal10n.plugins
Class ThisFirstClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by ch.qos.cal10n.plugins.ThisFirstClassLoader

public class ThisFirstClassLoader
extends URLClassLoader

An almost trivial no fuss implementation of a class loader following the child-first delegation model.

Author:
Ceki Gülcü

Constructor Summary
ThisFirstClassLoader(URL[] urls)
           
ThisFirstClassLoader(URL[] urls, ClassLoader parent)
           
 
Method Summary
 void addURL(URL url)
           
 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
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, getResource, 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

ThisFirstClassLoader

public ThisFirstClassLoader(URL[] urls)

ThisFirstClassLoader

public ThisFirstClassLoader(URL[] urls,
                            ClassLoader parent)
Method Detail

addURL

public void addURL(URL url)
Overrides:
addURL in class URLClassLoader

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
Throws:
ClassNotFoundException


Copyright © 2009-2013 QOS.ch. All Rights Reserved.