Class ClasspathClasses

  • All Implemented Interfaces:
    Iterable<String>

    public class ClasspathClasses
    extends Object
    implements Iterable<String>
    Classes on the classpath and the JARs that contain them.
    • Constructor Detail

      • ClasspathClasses

        public ClasspathClasses()
    • Method Detail

      • add

        public void add​(URL jarUrl,
                        String classFileName)
        Associates a class with a JAR.
        Parameters:
        jarUrl - the URL of a JAR on the classpath
        classFileName - the name of a class file in the JAR, in the form "java/lang/String.class"
      • addAll

        public void addAll​(URL jarUrl,
                           Collection<String> classFileNames)
        Associates all the given classes with a JAR.
        Parameters:
        jarUrl - the URL of a JAR on the classpath
        classFileNames - the class file names in the JAR, in the form "java/lang/String.class"
      • iterator

        public Iterator<String> iterator()
        Returns an iterator over the class files on the classpath. Each is a String in the form "java/lang/String.class".
        Specified by:
        iterator in interface Iterable<String>
      • size

        public int size()
      • getJarsForClass

        public JarSet getJarsForClass​(String classFileName)
        Returns a set of JAR URLs which contain a given class.
        Parameters:
        classFileName - the name of the class file, in the form "java/lang/String.class".
        Returns:
        the set of JAR URLs containing the class, or an empty set if the class isn't found.