Save This Page
Home » groovy-src-1.6.3 » org.codehaus » groovy » tools » [javadoc | source]
org.codehaus.groovy.tools
public class: RootLoader [javadoc | source]
java.lang.Object
   java.lang.ClassLoader
      java.security.SecureClassLoader
         java.net.URLClassLoader
            org.codehaus.groovy.tools.RootLoader
This ClassLoader should be used as root of class loaders. Any RootLoader does have it's own classpath. When searching for a class or resource this classpath will be used. Parent Classloaders are ignored first. If a class or resource can't be found in the classpath of the RootLoader, then parent is checked.

Note: this is very against the normal behavior of classloaders. Normal is to first check parent and then look in the resources you gave this classloader.

It's possible to add urls to the classpath at runtime through

Constructor:
 public RootLoader(LoaderConfiguration lc) 
    constructs a new RootLoader with a @see LoaderConfiguration object which holds the classpath
 public RootLoader(URL[] urls,
    ClassLoader parent) 
    constructs a new RootLoader with a parent loader and an array of URLs as classpath
Method from org.codehaus.groovy.tools.RootLoader Summary:
addURL,   findClass,   getResource,   loadClass
Methods from java.net.URLClassLoader:
findResource,   findResources,   getURLs,   newInstance,   newInstance
Methods from java.lang.ClassLoader:
clearAssertionStatus,   getParent,   getResource,   getResourceAsStream,   getResources,   getSystemClassLoader,   getSystemResource,   getSystemResourceAsStream,   getSystemResources,   loadClass,   setClassAssertionStatus,   setDefaultAssertionStatus,   setPackageAssertionStatus
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.codehaus.groovy.tools.RootLoader Detail:
 public  void addURL(URL url) 
    adds an url to the classpath of this classloader
 protected Class findClass(String name) throws ClassNotFoundException 
 public URL getResource(String name) 
    returns the URL of a resource, or null if it is not found
 protected Class loadClass(String name,
    boolean resolve) throws ClassNotFoundException 
    loads a class using the name of the class