|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader dsto.dfc.util.plugins.DfcClassLoader
public class DfcClassLoader
A class loader that supports dynamic addition to the classpath, including JAR/ZIP files and directories. To avoid various problems, it does not load any class files that are considered to be part of the system (ie java.*, javax.* etc).
When the DfcClassLoader is first started, it scans the system class path, and adds all of the paths into its own search path.
NOTE that this loader does not currently respect the order in which items are added to the classpath, so if the same class is in several locations which one gets loaded is not defined.
BootStrapLoader
Field Summary | |
---|---|
static DfcClassLoader |
INSTANCE
|
Constructor Summary | |
---|---|
protected |
DfcClassLoader()
Constructor is protected so as to make it a singleton. |
Method Summary | |
---|---|
void |
addJarFile(String jarFilePath)
Adds a path to a jar file to the end of the search path. |
void |
addPath(String dirPath)
addPath adds a directory path to the search path. |
void |
addZipFile(String zipFilePath)
Adds a path to a zip file to the end of the search path. |
protected Class |
findClass(String name)
Look for a class in the defined Jar files, Zip files and directories. |
protected URL |
findResource(String name)
Finds the resource with the given name. |
Class |
loadClass(String name)
Loads the class with the specified name. |
Class |
loadClass(String name,
boolean resolve)
Loads the class with the specified name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final DfcClassLoader INSTANCE
Constructor Detail |
---|
protected DfcClassLoader()
Method Detail |
---|
public void addJarFile(String jarFilePath)
jarFilePath
- The path to the Jar file that you want added
to the classloader path.public void addZipFile(String zipFilePath)
zipFilePath
- The path to the Zip file that you want added
to the classloader path.public void addPath(String dirPath)
dirPath
- The path to the directory that you want added to the classloader path.public Class loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
name
- The name of the class to try to load.
ClassNotFoundException
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
name
- The name of the class to try to load.resolve
- Flag set if you would like the class loader to attempt to
resolve the class.
ClassNotFoundException
- Thrown if the class couldn't be found.protected Class findClass(String name) throws ClassNotFoundException
findClass
in class ClassLoader
name
- The name of the class to load.
ClassNotFoundException
- if the class couldn't be found.protected URL findResource(String name)
findResource
in class ClassLoader
name
- The name of the resource.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |