Class ClassPath

  • @Beta
    public final class ClassPath
    extends Object
    Scans the source of a ClassLoader and finds all loadable classes and resources.
    • Method Detail

      • from

        public static ClassPath from​(ClassLoader classloader)
                              throws IOException
        Returns a ClassPath representing all classes and resources loadable from classloader and its parent class loaders.

        Currently only URLClassLoader and only file:// urls are supported.

        IOException - if the attempt to read class path resources (jar files or directories) failed.
      • getResources

        public ImmutableSet<ClassPath.ResourceInfo> getResources()
        Returns all resources loadable from the current class path, including the class files of all loadable classes but excluding the "META-INF/MANIFEST.MF" file.
      • getTopLevelClassesRecursive

        public ImmutableSet<ClassPath.ClassInfo> getTopLevelClassesRecursive​(String packageName)
        Returns all top level classes whose package name is packageName or starts with packageName followed by a '.'.