PreferredClassLoader
implements this method as follows:
This method first invokes {@link #findLoadedClass findLoadedClass} with name
; iffindLoadedClass
returns a non-null
Class
, then this method returns that Class
.
Otherwise, this method invokes {@link #isPreferredResource isPreferredResource} with name
as the firstargument and true
as the second argument:
isPreferredResource
throws an IOException
, then this method throws a ClassNotFoundException
containing the IOException
as its cause. isPreferredResource
returns true
, then this method invokes {@link #findClass 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
, {@link #resolveClass resolveClass} isinvoked with the Class
before returning. isPreferredResource
returns false
, then this method invokes the superclass implementation of {@link ClassLoader#loadClass(String,boolean) loadClass} with name
and resolve
andreturns the result. If the superclass's loadClass
throws an exception, then this method throws that exception. true
, then {@link #resolveClass resolveClass} will be invoked with the loaded class beforereturning
@return the loaded class
@throws ClassNotFoundException if the class could not be found
|
|
|
|