public class ClasspathScanner extends Object
Constructor and Description |
---|
ClasspathScanner() |
Modifier and Type | Method and Description |
---|---|
static Set<Class<?>> |
getClassesInPackage(String scanPackage)
Return all classes within a package and all "sub packages"
Consider the following classes:
x.y.a.TestClass
x.y.a.b.TestClass
x.y.b.TestClass
Inoking getClassesInPackage("x.y.a") would return
x.y.a.TestClass and x.y.a.b.TestClass
|
static <T> Set<Class<T>> |
getClassForType(Class<T> type,
String scanPackage)
Get all classes of required type in specified package
|
static Set<Class<?>> |
scanDir(int basePathLength,
String dirPath)
Scan a directory for classes
|
public static Set<Class<?>> scanDir(int basePathLength, String dirPath)
basePathLength
- start prefix indexdirPath
- directorypublic static <T> Set<Class<T>> getClassForType(Class<T> type, String scanPackage)
type
- a required typescanPackage
- package to scanpublic static Set<Class<?>> getClassesInPackage(String scanPackage)
scanPackage
- package to starts can atCopyright © 2018. All rights reserved.