Package org.codehaus.groovy.vmplugin.v9
Class ClassFinder
java.lang.Object
org.codehaus.groovy.vmplugin.v9.ClassFinder
Find classes under the specified package via some classpath entry
Usage:
// find classes under `me.sunlan` package via classpath entry(directory) `D:/_APPS/git_apps/java8-labs/out/production/classes/`
ClassFinder.find(URI.create("file:/D:/_APPS/git_apps/java8-labs/out/production/classes/"), "me/sunlan")
// find classes under `groovy.lang` package via classpath entry(jar file) `D:/_DEV/Groovy/groovy-3.0.1/lib/groovy-3.0.1.jar`
ClassFinder.find(URI.create("file:/D:/_DEV/Groovy/groovy-3.0.1/lib/groovy-3.0.1.jar"), "groovy/lang")
// find classes under `java.lang` package via classpath entry(jrt)
ClassFinder.find(URI.create("jrt:/modules/java.base/"), "java/lang")
// find classes under the sub-packages too, e.g. we can get GroovydocHolder
via the following code
ClassFinder.find(URI.create("file:/D:/_DEV/Groovy/groovy-3.0.1/lib/groovy-3.0.1.jar"), "groovy/lang", true)
- Since:
- 3.0.2
-
Method Summary
Modifier and TypeMethodDescriptionReturns the found classesReturns the found classesReturns the found classes
-
Method Details
-
find
Returns the found classes- Parameters:
classpathEntryURI
- the classpath entrypackageName
- the package under which we find classes- Returns:
- the found classes
- Since:
- 3.0.2
-
find
public static Map<String,Set<String>> find(URI classpathEntryURI, String packageName, boolean recursive) Returns the found classes- Parameters:
classpathEntryURI
- the classpath entrypackageName
- the package under which we find classesrecursive
- whether to find sub-packages- Returns:
- the found classes
- Since:
- 3.0.2
-
find
public static Map<String,Set<String>> find(URI classpathEntryURI, String packageName, boolean recursive, boolean innerClasses) Returns the found classes- Parameters:
classpathEntryURI
- the classpath entrypackageName
- the package under which we find classesrecursive
- whether to find sub-packagesinnerClasses
- whether to find inner classes (class names containing a "$")- Returns:
- the found classes
- Since:
- 5.0.0
-