@Beta public final class ClassPath extends Object
ClassLoader and finds all loadable classes and resources.
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassPath
Represents a class that can be loaded through
ClassPath.
|
static class |
ClassPath
Represents a class path resource that can be either a class file or any other resource file loadable from the class path.
|
| Modifier and Type | Method and Description |
|---|---|
static ClassPath |
from(ClassLoader
Returns a
ClassPath representing all classes and resources loadable from
classloader and its parent class loaders.
|
ImmutableSet |
getAllClasses()
Returns all classes loadable from the current class path.
|
ImmutableSet |
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.
|
ImmutableSet |
getTopLevelClasses()
Returns all top level classes loadable from the current class path.
|
ImmutableSet |
getTopLevelClasses(String
Returns all top level classes whose package name is
packageName.
|
ImmutableSet |
getTopLevelClassesRecursive(String
Returns all top level classes whose package name is
packageName or starts with
packageName followed by a '.'.
|
public static ClassPathfrom(ClassLoader classloader) throws IOException
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.
public ImmutableSet<ClassPath .ResourceInfo > getResources()
public ImmutableSet<ClassPath .ClassInfo > getAllClasses()
public ImmutableSet<ClassPath .ClassInfo > getTopLevelClasses()
public ImmutableSet<ClassPath .ClassInfo > getTopLevelClasses(String packageName)
packageName.
public ImmutableSet<ClassPath .ClassInfo > getTopLevelClassesRecursive(String packageName)
packageName or starts with
packageName followed by a '.'.