Class ClasspathLibraryInfo

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<LibraryInfo>

    public class ClasspathLibraryInfo
    extends LibraryInfo
    Information about specific classes on the current application's classpath to add to the "build path." This type of container is useful if your application ships with specific classes you want included in code completion, but you don't want to add the entire jar to the build path.

    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.

    Version:
    1.0
    See Also:
    JarLibraryInfo, DirLibraryInfo, ClasspathSourceLocation
    • Field Detail

      • classNameToClassFile

        private java.util.Map<java.lang.String,​ClassFile> classNameToClassFile
        Mapping of class names to ClassFiles. This information is cached even though it's also cached at the JarReader level because the class definitions are effectively immutable since they're on the classpath. This allows you to theoretically share a single ClasspathLibraryInfo across several different jar managers.
    • Constructor Detail

      • ClasspathLibraryInfo

        public ClasspathLibraryInfo​(java.lang.String[] classes)
        Constructor.
        Parameters:
        classes - A list of fully-qualified class names for classes you want added to the build path.
      • ClasspathLibraryInfo

        public ClasspathLibraryInfo​(java.util.List<java.lang.String> classes)
        Constructor.
        Parameters:
        classes - A list of fully-qualified class names for classes you want added to the build path.
      • ClasspathLibraryInfo

        public ClasspathLibraryInfo​(java.util.List<java.lang.String> classes,
                                    SourceLocation sourceLoc)
        Constructor.
        Parameters:
        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.