Package org.fife.rsta.ac.java.buildpath
Class DirLibraryInfo
- java.lang.Object
-
- org.fife.rsta.ac.java.buildpath.LibraryInfo
-
- org.fife.rsta.ac.java.buildpath.DirLibraryInfo
-
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Comparable<LibraryInfo>
public class DirLibraryInfo extends LibraryInfo
Information about a folder containing a set of classes to add to the "build path." This type of library info could be used, for example, to add sibling projects in a workspace, not yet built into jars, to another project's build path.- Version:
- 1.0
- See Also:
JarLibraryInfo,ClasspathLibraryInfo
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Filedir
-
Constructor Summary
Constructors Constructor Description DirLibraryInfo(java.io.File dir)DirLibraryInfo(java.io.File dir, SourceLocation sourceLoc)DirLibraryInfo(java.lang.String dir)DirLibraryInfo(java.lang.String dir, SourceLocation sourceLoc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbulkClassFileCreationEnd()Does any cleanup necessary after a call toLibraryInfo.bulkClassFileCreationStart().voidbulkClassFileCreationStart()Readies this library for many class files being fetched viaLibraryInfo.createClassFileBulk(String).intcompareTo(LibraryInfo info)Compares thisLibraryInfoto another one.ClassFilecreateClassFile(java.lang.String entryName)Returns the class file information for the specified class.ClassFilecreateClassFileBulk(java.lang.String entryName)Returns the class file information for the specified class.PackageMapNodecreatePackageMap()Creates and returns a map of maps representing the hierarchical package structure in this library.longgetLastModified()Returns the time this library was last modified.java.lang.StringgetLocationAsString()Returns the location of this library, as a string.private voidgetPackageMapImpl(java.io.File dir, java.lang.String pkg, PackageMapNode root)Does the dirty-work of finding all class files in a directory tree.inthashCodeImpl()Subclasses should override this method sinceLibraryInfo.equals(Object)is overridden.private voidsetDirectory(java.io.File dir)Sets the directory containing the classes.java.lang.StringtoString()Returns a string representation of this jar information.-
Methods inherited from class org.fife.rsta.ac.java.buildpath.LibraryInfo
clone, equals, getJreJarInfo, getMainJreJarInfo, getSourceLocation, hashCode, setSourceLocation
-
-
-
-
Constructor Detail
-
DirLibraryInfo
public DirLibraryInfo(java.io.File dir)
-
DirLibraryInfo
public DirLibraryInfo(java.lang.String dir)
-
DirLibraryInfo
public DirLibraryInfo(java.io.File dir, SourceLocation sourceLoc)
-
DirLibraryInfo
public DirLibraryInfo(java.lang.String dir, SourceLocation sourceLoc)
-
-
Method Detail
-
bulkClassFileCreationEnd
public void bulkClassFileCreationEnd()
Description copied from class:LibraryInfoDoes any cleanup necessary after a call toLibraryInfo.bulkClassFileCreationStart().- Specified by:
bulkClassFileCreationEndin classLibraryInfo- See Also:
LibraryInfo.bulkClassFileCreationStart(),LibraryInfo.createClassFileBulk(String)
-
bulkClassFileCreationStart
public void bulkClassFileCreationStart()
Description copied from class:LibraryInfoReadies this library for many class files being fetched viaLibraryInfo.createClassFileBulk(String). After calling this method, the actual class file fetching should be done in a try/finally block that ensures a call toLibraryInfo.bulkClassFileCreationEnd(); e.g.libInfo.bulkClassFileCreationStart(); try { String entryName = ...; ClassFile cf = createClassFileBulk(entryName); ... } finally { libInfo.bulkClassFileCreationEnd(); }- Specified by:
bulkClassFileCreationStartin classLibraryInfo- See Also:
LibraryInfo.bulkClassFileCreationEnd(),LibraryInfo.createClassFileBulk(String)
-
compareTo
public int compareTo(LibraryInfo info)
Compares thisLibraryInfoto another one. Two instances of this class are only considered equal if they represent the same class file location. Source attachment is irrelevant.- Returns:
- The sort order of these two library infos.
-
createClassFile
public ClassFile createClassFile(java.lang.String entryName) throws java.io.IOException
Description copied from class:LibraryInfoReturns the class file information for the specified class. Instances ofJarReadercan 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()andLibraryInfo.createClassFileBulk(String)over this method, for performance reasons.- Specified by:
createClassFilein classLibraryInfo- Parameters:
entryName- The fully qualified name of the class file.- Returns:
- The class file, or
nullif it isn't found in this library. - Throws:
java.io.IOException- If an IO error occurs.- See Also:
LibraryInfo.createClassFileBulk(String)
-
createClassFileBulk
public ClassFile createClassFileBulk(java.lang.String entryName) throws java.io.IOException
Description copied from class:LibraryInfoReturns the class file information for the specified class. Instances ofJarReadercan 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 callLibraryInfo.createClassFile(String).- Specified by:
createClassFileBulkin classLibraryInfo- Parameters:
entryName- The fully qualified name of the class file.- Returns:
- The class file, or
nullif it isn't found in this library. - Throws:
java.io.IOException- If an IO error occurs.- See Also:
LibraryInfo.createClassFile(String)
-
createPackageMap
public PackageMapNode createPackageMap()
Description copied from class:LibraryInfoCreates and returns a map of maps representing the hierarchical package structure in this library.- Specified by:
createPackageMapin classLibraryInfo- Returns:
- The package structure in this library.
-
getLastModified
public long getLastModified()
Description copied from class:LibraryInfoReturns the time this library was last modified. For jar files, this would be the modified date of the file. For directories, this would be the time a file in the directory was most recently modified. This information is used to determine whether callers should clear their cached package map information and load it anew.This API may change in the future.
- Specified by:
getLastModifiedin classLibraryInfo- Returns:
- The last time this library was modified.
-
getLocationAsString
public java.lang.String getLocationAsString()
Description copied from class:LibraryInfoReturns the location of this library, as a string. If this library is contained in a single jar file, this will be the full path to that jar. If it is a directory containing classes, it will be the full path of the directory. Otherwise, this value will benull.- Specified by:
getLocationAsStringin classLibraryInfo- Returns:
- The location of this library.
-
getPackageMapImpl
private void getPackageMapImpl(java.io.File dir, java.lang.String pkg, PackageMapNode root)Does the dirty-work of finding all class files in a directory tree.- Parameters:
dir- The directory to scan.pkg- The package name scanned so far, in the form "com/company/pkgname"...
-
hashCodeImpl
public int hashCodeImpl()
Description copied from class:LibraryInfoSubclasses should override this method sinceLibraryInfo.equals(Object)is overridden. Instances ofLibraryInfoaren't typically stored in maps, so the hash value isn't necessarily important toRSTALanguageSupport.- Specified by:
hashCodeImplin classLibraryInfo- Returns:
- The hash code for this library.
-
setDirectory
private void setDirectory(java.io.File dir)
Sets the directory containing the classes.- Parameters:
dir- The directory. This cannot benull.
-
toString
public java.lang.String toString()
Returns a string representation of this jar information. Useful for debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this object.
-
-