public class ClasspathLibraryInfo extends LibraryInfo
Since there is no real way to determine all classes in a package via
reflection, you must explicitly enumerate all classes that are on the
classpath that you want on the build path. To make this easier, you can
use the ClassEnumerationReader class to read a list of classes from
a plain text file or other resource.
If you're delivering the corresponding .java source files also on the
classpath (i.e. you have a library "hard-coded" to be on the build path),
you can set the source location to be a ClasspathSourceLocation
to get the source located automatically.
JarLibraryInfo,
DirLibraryInfo,
ClasspathSourceLocation| Constructor and Description |
|---|
ClasspathLibraryInfo(java.util.List<java.lang.String> classes)
Constructor.
|
ClasspathLibraryInfo(java.util.List<java.lang.String> classes,
SourceLocation sourceLoc)
Constructor.
|
ClasspathLibraryInfo(java.lang.String[] classes)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bulkClassFileCreationEnd()
Does any cleanup necessary after a call to
LibraryInfo.bulkClassFileCreationStart(). |
void |
bulkClassFileCreationStart()
Readies this library for many class files being fetched via
LibraryInfo.createClassFileBulk(String). |
int |
compareTo(LibraryInfo info) |
ClassFile |
createClassFile(java.lang.String entryName)
Returns the class file information for the specified class.
|
ClassFile |
createClassFileBulk(java.lang.String entryName)
Returns the class file information for the specified class.
|
PackageMapNode |
createPackageMap()
Creates and returns a map of maps representing the hierarchical package
structure in this library.
|
long |
getLastModified()
Since stuff on the current classpath never changes (we don't support
hotswapping), this method always returns
0. |
java.lang.String |
getLocationAsString()
Returns the location of this library, as a string.
|
int |
hashCode()
Subclasses should override this method since
LibraryInfo.equals(Object) is
overridden. |
clone, equals, getJreJarInfo, getMainJreJarInfo, getSourceLocation, setSourceLocationpublic ClasspathLibraryInfo(java.lang.String[] classes)
classes - A list of fully-qualified class names for classes you
want added to the build path.public ClasspathLibraryInfo(java.util.List<java.lang.String> classes)
classes - A list of fully-qualified class names for classes you
want added to the build path.public ClasspathLibraryInfo(java.util.List<java.lang.String> classes,
SourceLocation sourceLoc)
classes - A list of fully-qualified class names for classes you
want added to the build path.sourceLoc - The location of the source files for the classes given.
This may be null.public void bulkClassFileCreationEnd()
LibraryInfoLibraryInfo.bulkClassFileCreationStart().bulkClassFileCreationEnd in class LibraryInfoLibraryInfo.bulkClassFileCreationStart(),
LibraryInfo.createClassFileBulk(String)public void bulkClassFileCreationStart()
LibraryInfoLibraryInfo.createClassFileBulk(String). After calling this method,
the actual class file fetching should be done in a try/finally block
that ensures a call to LibraryInfo.bulkClassFileCreationEnd(); e.g.
libInfo.bulkClassFileCreationStart();
try {
String entryName = ...;
ClassFile cf = createClassFileBulk(entryName);
...
} finally {
libInfo.bulkClassFileCreationEnd();
}
bulkClassFileCreationStart in class LibraryInfoLibraryInfo.bulkClassFileCreationEnd(),
LibraryInfo.createClassFileBulk(String)public int compareTo(LibraryInfo info)
public ClassFile createClassFile(java.lang.String entryName) throws java.io.IOException
LibraryInfoJarReader can call this method to lazily load
information on individual classes and shove it into their package maps.
If many class files will be fetched at a time, you should prefer using
LibraryInfo.bulkClassFileCreationStart() and
LibraryInfo.createClassFileBulk(String) over this method, for performance
reasons.
createClassFile in class LibraryInfoentryName - The fully qualified name of the class file.null if it isn't found in this
library.java.io.IOException - If an IO error occurs.LibraryInfo.createClassFileBulk(String)public ClassFile createClassFileBulk(java.lang.String entryName) throws java.io.IOException
LibraryInfoJarReader can call this method to lazily load
information on individual classes and shove it into their package maps.
This method should be used when multiple classes will be fetched from
this library at the same time. It should only be called after a call to
LibraryInfo.bulkClassFileCreationStart(). If only a single class file is
being fetched, it is simpler to call LibraryInfo.createClassFile(String).
createClassFileBulk in class LibraryInfoentryName - The fully qualified name of the class file.null if it isn't found in this
library.java.io.IOException - If an IO error occurs.LibraryInfo.createClassFile(String)public PackageMapNode createPackageMap() throws java.io.IOException
LibraryInfocreatePackageMap in class LibraryInfojava.io.IOException - If an IO error occurs.public long getLastModified()
0.getLastModified in class LibraryInfo0 always.public java.lang.String getLocationAsString()
LibraryInfonull.getLocationAsString in class LibraryInfopublic int hashCode()
LibraryInfoLibraryInfo.equals(Object) is
overridden. Instances of LibraryInfo aren't typically
stored in maps, so the hash value isn't necessarily important to
RSTALanguageSupport.hashCode in class LibraryInfo