[Groovy] Class PackageHelperImpl
- org.apache.groovy.groovysh.util.PackageHelperImpl
- All Implemented Interfaces and Traits:
- PackageHelper, PreferenceChangeListener
@AutoFinal @CompileStatic class PackageHelperImpl extends Object implements PackageHelper, PreferenceChangeListener
Helper class that crawls all items of the classpath for packages. Retrieves from those sources the list of subpackages and classes on demand.
Field Summary
Modifiers | Name | Description |
---|---|---|
protected static Logger | LOG | |
static Pattern | NAME_PATTERN | Pattern for regular class names. |
Properties Summary
Type | Name and description |
---|---|
ClassLoader |
groovyClassLoader |
Map<String, CachedPackage> |
rootPackages |
Constructor Summary
Constructor and description |
---|
PackageHelperImpl
(ClassLoader groovyClassLoader) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
static Collection<String> |
collectPackageNamesFromFolderRecursive(File directory, String prefix, Set<String> packnames) Crawls a folder, iterates over subfolders, looking for class files. | |
static Set<String> |
getClassnames(Set<URL> urls, String packagename) Copied from JLine 1.0 ClassNameCompletor. | |
Set<String> |
getContents(String packagename) Returns the names of Classes and direct subpackages contained in a package. | |
static Collection<String> |
getPackageNames(URL url) Returns all package names found at URL; accepts jar files and folders. | |
static Collection<String> |
getPackageNamesFromJar(JarFile jf) | |
static Object |
mergeNewPackages(Collection<String> packageNames, URL url, Map<String, CachedPackage> rootPackages) | |
void |
preferenceChange(PreferenceChangeEvent evt) | |
void |
reset() |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail
protected static final Logger LOG
public static final Pattern NAME_PATTERN
Pattern for regular class names.
Property Detail
final ClassLoader groovyClassLoader
Map<String, CachedPackage> rootPackages
Constructor Detail
PackageHelperImpl(ClassLoader groovyClassLoader)
Method Detail
static Collection<String> collectPackageNamesFromFolderRecursive(File directory, String prefix, Set<String> packnames)
Crawls a folder, iterates over subfolders, looking for class files.
static Set<String> getClassnames(Set<URL> urls, String packagename)
Copied from JLine 1.0 ClassNameCompletor.
@Override Set<String> getContents(String packagename)
Returns the names of Classes and direct subpackages contained in a package.
static Collection<String> getPackageNames(URL url)
Returns all package names found at URL; accepts jar files and folders.
static Collection<String> getPackageNamesFromJar(JarFile jf)
static Object mergeNewPackages(Collection<String> packageNames, URL url, Map<String, CachedPackage> rootPackages)
@Override void preferenceChange(PreferenceChangeEvent evt)
@Override void reset()
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/apache/groovy/groovysh/util/PackageHelperImpl.html