public class ClassFinder extends Object
Constructor and Description |
---|
ClassFinder() |
Modifier and Type | Method and Description |
---|---|
static List<Class<?>> |
findClasses(Package pkg)
Scans all classes accessible from the context class loader which belong
to the given package and sub-packages.
|
static List<Class<?>> |
findClasses(String packageName)
Scans all classes accessible from the context class loader which belong
to the given package and subpackages.
|
static List<Class<?>> |
findClassesInDir(File directory,
String packageName)
Recursive method to find all classes in a given directory and subdirs.
|
static List<Class<?>> |
findClassesInJar(File jarFile,
String packageName)
Finds all the classes in a given package or its subpackages within a jar
file.
|
public ClassFinder()
public static List<Class<?>> findClasses(Package pkg) throws IOException
pkg
- The base packageIOException
public static List<Class<?>> findClasses(String packageName) throws IOException
packageName
- The base packageIOException
public static List<Class<?>> findClassesInDir(File directory, String packageName)
directory
- The base directorypackageName
- The package name for classes found inside the base directorypublic static List<Class<?>> findClassesInJar(File jarFile, String packageName) throws IOException
jarFile
- The jar filepackageName
- The package nameIOException