org.fife.rsta.ac.java.buildpath.ClasspathLibraryInfo Maven / Gradle / Ivy
Show all versions of languagesupport Show documentation
/* * 04/21/2012 * * Copyright (C) 2010 Robert Futrell * robert_futrell at users.sourceforge.net * http://fifesoft.com/rsyntaxtextarea * * This library is distributed under a modified BSD license. See the included * RSTALanguageSupport.License.txt file for details. */ package org.fife.rsta.ac.java.buildpath; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.fife.rsta.ac.java.Util; import org.fife.rsta.ac.java.classreader.ClassFile; /** * 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.
. * * @return* * 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 {@link 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. * * @author Robert Futrell * @version 1.0 * @see JarLibraryInfo * @see DirLibraryInfo * @see ClasspathSourceLocation */ public class ClasspathLibraryInfo extends LibraryInfo { /** * Mapping of class names toClassFile
s. This information is * cached even though it's also cached at theJarReader
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. */ private Map classNameToClassFile; /** * Constructor. * * @param classes A list of fully-qualified class names for classes you * want added to the build path. */ public ClasspathLibraryInfo(String[] classes) { this(Arrays.asList(classes), null); } /** * Constructor. * * @param classes A list of fully-qualified class names for classes you * want added to the build path. */ public ClasspathLibraryInfo(List classes) { this(classes, null); } /** * Constructor. * * @param classes A list of fully-qualified class names for classes you * want added to the build path. * @param sourceLoc The location of the source files for the classes given. * This may benull
. */ public ClasspathLibraryInfo(List classes, SourceLocation sourceLoc) { setSourceLocation(sourceLoc); classNameToClassFile = new HashMap(); int count = classes==null ? 0 : classes.size(); for (int i=0; i0 0
always. */ public long getLastModified() { return 0; } public String getLocationAsString() { return null; } public int hashCode() { return classNameToClassFile.hashCode(); } }