net.jini.loader.pref
Class PreferredFactoryClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by net.jini.loader.pref.PreferredClassLoader
                  extended by net.jini.loader.pref.PreferredFactoryClassLoader
All Implemented Interfaces:
ClassAnnotation

final class PreferredFactoryClassLoader
extends PreferredClassLoader

Class loader to wrap the preferred class loader so that loadClass checks package access. Similar to the class loaders returned by URLClassLoader.newInstance.

Author:
Sun Microsystems, Inc.

Constructor Summary
PreferredFactoryClassLoader(URL[] urls, ClassLoader parent, String exportAnnotation, boolean requireDownloadPerm)
           
 
Method Summary
 Class loadClass(String name, boolean resolve)
          Loads a class with the specified name.
 
Methods inherited from class net.jini.loader.pref.PreferredClassLoader
addPermissionsForURLs, checkPermissions, definePackage, getClassAnnotation, getLoaderAccessControlContext, getPermissions, getResource, isPreferredResource, newInstance, toString, urlsToPath
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreferredFactoryClassLoader

PreferredFactoryClassLoader(URL[] urls,
                            ClassLoader parent,
                            String exportAnnotation,
                            boolean requireDownloadPerm)
Method Detail

loadClass

public final Class loadClass(String name,
                             boolean resolve)
                      throws ClassNotFoundException
Description copied from class: PreferredClassLoader
Loads a class with the specified name.

PreferredClassLoader implements this method as follows:

This method first invokes findLoadedClass with name; if findLoadedClass returns a non-null Class, then this method returns that Class.

Otherwise, this method invokes isPreferredResource with name as the first argument and true as the second argument:

Overrides:
loadClass in class PreferredClassLoader
Parameters:
name - the binary name of the class to load
resolve - if true, then resolveClass will be invoked with the loaded class before returning
Returns:
the loaded class
Throws:
ClassNotFoundException - if the class could not be found


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.