java.lang.Object
org.jline.script.PackageHelper
https://stackoverflow.com/questions/520328/can-you-find-all-classes-in-a-package-using-reflection/22462785#22462785
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClassesForPackage(String pckgname) Attempts to list all the classes in the specified package as determined by the context class loadergetClassesForPackage(String pckgname, groovy.lang.GroovyClassLoader classLoader, Function<String, Class<?>> classResolver) Attempts to list all the classes in the specified package as determined by the Groovy class loader classpathgetClassNamesForPackage(String pckgname, ClassLoader classLoader) Attempts to list all the class names in the specified package as determined by the Groovy class loader classpath
-
Constructor Details
-
PackageHelper
public PackageHelper()
-
-
Method Details
-
getClassNamesForPackage
Attempts to list all the class names in the specified package as determined by the Groovy class loader classpath- Parameters:
pckgname- the package name to searchclassLoader- class loader- Returns:
- a list of class names that exist within that package
-
getClassesForPackage
public static List<Object> getClassesForPackage(String pckgname, groovy.lang.GroovyClassLoader classLoader, Function<String, Class<?>> classResolver) throws ClassNotFoundExceptionAttempts to list all the classes in the specified package as determined by the Groovy class loader classpath- Parameters:
pckgname- the package name to searchclassLoader- Groovy class loaderclassResolver- resolve class from class name- Returns:
- a list of classes that exist within that package
- Throws:
ClassNotFoundException- if something went wrong
-
getClassesForPackage
Attempts to list all the classes in the specified package as determined by the context class loader- Parameters:
pckgname- the package name to search- Returns:
- a list of classes that exist within that package
- Throws:
ClassNotFoundException- if something went wrong
-