|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.common.reflect.ClassPath
@Beta public final class ClassPath
Scans the source of a ClassLoader
and finds all the classes loadable.
Nested Class Summary | |
---|---|
static class |
ClassPath.ClassInfo
Represents a class that can be loaded through ClassPath.ClassInfo.load() . |
static class |
ClassPath.ResourceInfo
Represents a class path resource that can be either a class file or any other resource file loadable from the class path. |
Method Summary | |
---|---|
static ClassPath |
from(java.lang.ClassLoader classloader)
Returns a ClassPath representing all classes and resources loadable from classloader and its parent class loaders. |
ImmutableSet<ClassPath.ResourceInfo> |
getResources()
Returns all resources loadable from the current class path, including the class files of all loadable classes. |
ImmutableSet<ClassPath.ClassInfo> |
getTopLevelClasses()
Returns all top level classes loadable from the current class path. |
ImmutableSet<ClassPath.ClassInfo> |
getTopLevelClasses(java.lang.String packageName)
Returns all top level classes whose package name is packageName . |
ImmutableSet<ClassPath.ClassInfo> |
getTopLevelClassesRecursive(java.lang.String packageName)
Returns all top level classes whose package name is packageName or starts with
packageName followed by a '.'. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ClassPath from(java.lang.ClassLoader classloader) throws java.io.IOException
ClassPath
representing all classes and resources loadable from classloader
and its parent class loaders.
Currently only URLClassLoader
and only file://
urls are supported.
java.io.IOException
- if the attempt to read class path resources (jar files or directories)
failed.public ImmutableSet<ClassPath.ResourceInfo> getResources()
public ImmutableSet<ClassPath.ClassInfo> getTopLevelClasses()
public ImmutableSet<ClassPath.ClassInfo> getTopLevelClasses(java.lang.String packageName)
packageName
.
public ImmutableSet<ClassPath.ClassInfo> getTopLevelClassesRecursive(java.lang.String packageName)
packageName
or starts with
packageName
followed by a '.'.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |