public abstract class LibraryInfo extends java.lang.Object implements java.lang.Comparable<LibraryInfo>, java.lang.Cloneable
JarManager for each library that should be on the build
path.This class also keeps track of an optional source location, such as a zip file or source folder. If defined, this location is used to find the .java source corresponding to the library's classes, which is used to display Javadoc comments during code completion.
DirLibraryInfo,
JarLibraryInfo,
ClasspathLibraryInfo| Constructor and Description |
|---|
LibraryInfo() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
bulkClassFileCreationEnd()
Does any cleanup necessary after a call to
bulkClassFileCreationStart(). |
abstract void |
bulkClassFileCreationStart()
Readies this library for many class files being fetched via
createClassFileBulk(String). |
java.lang.Object |
clone()
Returns a deep copy of this library.
|
abstract ClassFile |
createClassFile(java.lang.String entryName)
Returns the class file information for the specified class.
|
abstract ClassFile |
createClassFileBulk(java.lang.String entryName)
Returns the class file information for the specified class.
|
abstract PackageMapNode |
createPackageMap()
Creates and returns a map of maps representing the hierarchical package
structure in this library.
|
boolean |
equals(java.lang.Object o)
Two
LibraryInfos are considered equal if they represent
the same class file location. |
static LibraryInfo |
getJreJarInfo(java.io.File jreHome)
Returns information on the "main" jar for a JRE.
|
abstract long |
getLastModified()
Returns the time this library was last modified.
|
abstract java.lang.String |
getLocationAsString()
Returns the location of this library, as a string.
|
static LibraryInfo |
getMainJreJarInfo()
Returns information on the JRE running this application.
|
SourceLocation |
getSourceLocation()
Returns the location of the source corresponding to this library.
|
abstract int |
hashCode()
Subclasses should override this method since
equals(Object) is
overridden. |
void |
setSourceLocation(SourceLocation sourceLoc)
Sets the location of the source corresponding to this library.
|
public abstract void bulkClassFileCreationEnd()
throws java.io.IOException
bulkClassFileCreationStart().java.io.IOException - If an IO error occurs.bulkClassFileCreationStart(),
createClassFileBulk(String)public abstract void bulkClassFileCreationStart()
throws java.io.IOException
createClassFileBulk(String). After calling this method,
the actual class file fetching should be done in a try/finally block
that ensures a call to bulkClassFileCreationEnd(); e.g.
libInfo.bulkClassFileCreationStart();
try {
String entryName = ...;
ClassFile cf = createClassFileBulk(entryName);
...
} finally {
libInfo.bulkClassFileCreationEnd();
}
java.io.IOException - If an IO error occurs.bulkClassFileCreationEnd(),
createClassFileBulk(String)public java.lang.Object clone()
clone in class java.lang.Objectpublic abstract ClassFile createClassFile(java.lang.String entryName) throws java.io.IOException
JarReader 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
bulkClassFileCreationStart() and
createClassFileBulk(String) over this method, for performance
reasons.
entryName - 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.createClassFileBulk(String)public abstract ClassFile createClassFileBulk(java.lang.String entryName) throws java.io.IOException
JarReader 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
bulkClassFileCreationStart(). If only a single class file is
being fetched, it is simpler to call createClassFile(String).
entryName - 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.createClassFile(String)public abstract PackageMapNode createPackageMap() throws java.io.IOException
java.io.IOException - If an IO error occurs.public boolean equals(java.lang.Object o)
LibraryInfos are considered equal if they represent
the same class file location. Source attachment is irrelevant.equals in class java.lang.Objectpublic static LibraryInfo getJreJarInfo(java.io.File jreHome)
null if there is not a JRE in
the specified directory.getMainJreJarInfo()public abstract long getLastModified()
This API may change in the future.
public abstract java.lang.String getLocationAsString()
null.public static LibraryInfo getMainJreJarInfo()
null if an error occurs.getJreJarInfo(File)public SourceLocation getSourceLocation()
null if none.setSourceLocation(SourceLocation)public abstract int hashCode()
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 java.lang.Objectpublic void setSourceLocation(SourceLocation sourceLoc)
sourceLoc - The source location. This may be null.getSourceLocation()