net.jini.loader.pref
Class PreferredFactoryClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
net.jini.loader.pref.PreferredClassLoader
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.
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.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 |
PreferredFactoryClassLoader
PreferredFactoryClassLoader(URL[] urls,
ClassLoader parent,
String exportAnnotation,
boolean requireDownloadPerm)
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:
- If
isPreferredResource
throws an
IOException
, then this method throws a
ClassNotFoundException
containing the
IOException
as its cause.
- If
isPreferredResource
returns
true
, then this method invokes findClass
with name
. If findClass
throws an exception, then this method throws that exception.
Otherwise, this method returns the Class
returned
by findClass
, and if resolve
is
true
, resolveClass
is
invoked with the Class
before returning.
- If
isPreferredResource
returns
false
, then this method invokes the superclass
implementation of loadClass
with name
and resolve
and
returns the result. If the superclass's loadClass
throws an exception, then this method throws that exception.
- Overrides:
loadClass
in class PreferredClassLoader
- Parameters:
name
- the binary name of the class to loadresolve
- 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.