[Groovy] Class PackageHelperImpl

  • org.codehaus.groovy.tools.shell.util.PackageHelperImpl
All Implemented Interfaces and Traits:
PackageHelper, PreferenceChangeListener
class PackageHelperImpl

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

Fields
Modifiers Name Description
protected static Logger LOG
static Pattern NAME_PATTERN

Properties Summary

Properties
Type Name and description
ClassLoader groovyClassLoader
Map<String, CachedPackage> rootPackages

Constructor Summary

Constructors
Constructor and description
PackageHelperImpl (ClassLoader groovyClassLoader = null)

Methods Summary

Methods
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 packagenames found at URL, accepts jar files and folders
static Collection<String> getPackageNamesFromJar(JarFile jf)
static Map<String, CachedPackage> initializePackages(ClassLoader groovyClassLoader)
static def mergeNewPackages(Collection<String> packageNames, URL url, Map<String, CachedPackage> rootPackages)
void preferenceChange(PreferenceChangeEvent evt)

Inherited Methods Summary

Inherited Methods
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

Property Detail

final ClassLoader groovyClassLoader

Map<String, CachedPackage> rootPackages

Constructor Detail

PackageHelperImpl(ClassLoader groovyClassLoader = null)

Method Detail

static Collection<String> collectPackageNamesFromFolderRecursive(File directory, String prefix, Set<String> packnames)

Crawls a folder, iterates over subfolders, looking for class files.

Parameters:
directory
prefix
packnames
Returns:

@CompileStatic static Set<String> getClassnames(Set<URL> urls, String packagename)

Copied from JLine 1.0 ClassNameCompletor

Parameters:
urls
packagename
Returns:

@CompileStatic Set<String> getContents(String packagename)

returns the names of Classes and direct subpackages contained in a package

Parameters:
packagename
Returns:

static Collection<String> getPackageNames(URL url)

Returns all packagenames found at URL, accepts jar files and folders

Parameters:
url
Returns:

static Collection<String> getPackageNamesFromJar(JarFile jf)

static Map<String, CachedPackage> initializePackages(ClassLoader groovyClassLoader)

static def mergeNewPackages(Collection<String> packageNames, URL url, Map<String, CachedPackage> rootPackages)

@Override void preferenceChange(PreferenceChangeEvent evt)

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/org/codehaus/groovy/tools/shell/util/PackageHelperImpl.html