package bluej.classmgr;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;

import bluej.utility.Utility;


| A BlueJ Project ClassLoader that can be used to load or obtain information about classes loadable in a bluej project. | Different projects have different class loaders since they shoule each have a well defined and unique namespace. | Every time a project is compiled, even when the compilation is started from the GUI, a new ProjectLoader is created and | if the Extension currently have a copy of the old one it should discard it. | Note: There is a name clash with ProjectClassLoader that should be deleted at the end of refactornig, | unfortunately ProjectClassLoader has different semantic and it would be unvise to break the current behaviour before | having a correct working version. This is the reason for this class being named BPClassLoader. | it will be renamed when the new classloading is refactored and tested. | | @author Damiano Bolla | public final class BPClassLoader extends URLClassLoader{
| Constructructor. | @param parent the parent loader that is searched first to resolve classes. | @param urls the list of jars and directory that are searched next. | public BPClassLoader(URL[] urls, ClassLoader parent) { super(urls, parent); }
| Compare the current array of URLS with the given one. | Note that is the order of the array is different then the two are considered different. | @param compare URLs to compare with the original. | @return true if the two arrays are the same. |
| Create a string with this class path as a separated list of strings. | Note that a classpath to be used to start another local JVM cannot refer to a URL but to a local file. | It is therefore advisable to move as much as possible from a Classpath oriented vew to a ClassLoader. | | @return The classpath as string. | public String getClassPathAsString() { return Utility.toClasspathString(getClassPathAsFiles()); }
| Return the class path as an array of files. | Note that there is no guarantee that all files are indeed local files althout this is true for the | current BlueJ. | @return a non null array of Files, may be empty if no library at all is defined. | public final List getClassPathAsFiles() { return Utility.urlsToFiles(getURLs()); } public String toString() { return "BPClassLoader path=" + getClassPathAsString(); } }

.   - BPClassLoader
.   BPClassLoader
.   getClassPathAsString
.   getClassPathAsFiles
.   toString




57 neLoCode + 24 LoComm