Documentation: https://github.com/classgraph/classgraph/wiki
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ClassGraph.
Method to use to attempt to circumvent encapsulation in JDK 16+, in order to get access to a classloader's private classpath. |
| public static interface | ClassGraph.
Add a classpath element filter. |
| public static interface | ClassGraph.
Add a classpath element URL filter. |
| public static interface | ClassGraph.
A callback used to handle failure during an asynchronous scan. |
| public static interface | ClassGraph.
A callback used to process the result of a successful asynchronous scan. |
| Modifier and Type | Field and Description |
|---|---|
| public static ClassGraph. | CIRCUMVENT_ENCAPSULATION
If you are running on JDK 16+, the JDK enforces strong encapsulation, and ClassGraph may be unable to read the classpath from your classloader if the classloader does not make the classpath available via a public method or field. |
| pack-priv static final int | DEFAULT_NUM_WORKER_THREADS
The default number of worker threads to use while scanning. |
| private final ReflectionUtils | |
| pack-priv ScanSpec | scanSpec
The scanning specification. |
| private LogNode | topLevelLog
If non-null, log while scanning. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of classes to scan (using '.' as a separator). To match a class name by
glob in any package, you must include a package glob too, e.g. classNames)"*.*Suffix".Scan one or more specific classes, without scanning other classes in the same package unless the package is itself accepted. |
| public ClassGraph | Returns: this (for method chaining).The resource paths, any of which must be present in a classpath element for the classpath element
to be scanned. May contain a wildcard glob ( resourcePaths)'*').Accept classpath elements based on resource paths. |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the jars that should be scanned (e.g. jarLeafNames)"mylib.jar"). May contain a
wildcard glob ("mylib-*.jar").Accept one or more jars. |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the lib/ext jar(s) that should be scanned (e.g. jarLeafNames)"mylib.jar"). May contain
a wildcard glob ('*'). Note that if you call this method with no parameters, all JRE/JDK
"lib/" or "ext/" jars will be accepted.Accept one or more jars in a JRE/JDK "lib/" or "ext/" directory (these directories are not scanned unless
|
| public ClassGraph | Returns: this (for method chaining).The names of the modules that should be scanned. May contain a wildcard glob ( moduleNames)'*').Accept one or more modules for scanning. |
| private void | acceptOrRejectLibOrExtJars(final boolean
if true, add to accept, otherwise add to reject. accept, final String... the jar leaf names to accept jarLeafNames)Add lib or ext jars to accept or reject. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to scan (using '.' as a separator). May include a glob
wildcard ( packageNames)'*').Scan one or more specific packages and their sub-packages. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to scan (with '.' as a separator). May not include a glob
wildcard ( packageNames)'*').Scan one or more specific packages, without recursively scanning sub-packages unless they are themselves accepted. |
| public ClassGraph | Returns: this (for method chaining).The paths to scan, relative to the package root of the classpath element (with '/' as a
separator). May include a glob wildcard ( paths)'*').Scan one or more specific paths, and their sub-directories or nested paths. |
| public ClassGraph | Returns: this (for method chaining).The paths to scan, relative to the package root of the classpath element (with '/' as a
separator). May not include a glob wildcard ( paths)'*').Scan one or more specific paths, without recursively scanning sub-directories or nested paths unless they are themselves accepted. |
| public ClassGraph | Returns: this (for method chaining).The additional ClassLoader to scan. classLoader)Add a ClassLoader to the list of ClassLoaders to scan. |
| public ClassGraph | Returns: this (for method chaining).The additional ModuleLayer to scan. (The parameter is of type moduleLayer)Object for backwards
compatibility with JDK 7 and JDK 8, but the argument should be of type ModuleLayer.)Add a ModuleLayer to the list of ModuleLayers to scan. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of classes to reject (using '.' as a separator). classNames)
Deprecated
Use
rejectClasses(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The resource paths which cause a classpath not to be scanned if any are present in a classpath
element for the classpath element. May contain a wildcard glob ( resourcePaths)'*').
Deprecated
Use
rejectClasspathElementsContainingResourcePath(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the jars that should be scanned (e.g. jarLeafNames)"badlib.jar"). May contain a
wildcard glob ("badlib-*.jar").
Deprecated
Use
rejectJars(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the lib/ext jar(s) that should not be scanned (e.g.
jarLeafNames)"jre/lib/badlib.jar"). May contain a wildcard glob ('*'). If you call this method
with no parameters, all JRE/JDK "lib/" or "ext/" jars will be rejected.
Deprecated
Use
rejectLibOrExtJars(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The names of the modules that should not be scanned. May contain a wildcard glob ( moduleNames)'*').
Deprecated
Use
rejectModules(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to reject (with '.' as a separator). May include a glob
wildcard ( packageNames)'*').
Deprecated
Use
rejectPackages(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The paths to reject (with '/' as a separator). May include a glob wildcard ( paths)'*').
Deprecated
Use
rejectPaths(String. instead.
Use |
| public ClassGraph | |
| public ClassGraph | |
| public ClassGraph | |
| public ClassGraph | Returns: this (for method chaining).Disables the scanning of nested jarfiles (jarfiles within jarfiles). |
| public ClassGraph | Returns: this (for method chaining).Causes only runtime visible annotations to be scanned (causes runtime invisible annotations to be ignored). |
| public ClassGraph | Returns: this (for method chaining).Enables the scanning of all classes, fields, methods, annotations, and static final field constant initializer values, and ignores all visibility modifiers, so that both public and non-public classes, fields and methods are all scanned. |
| public ClassGraph | Returns: this (for method chaining).Enables the saving of annotation info (for class, field, method and method parameter annotations) during the scan. |
| public ClassGraph | Returns: this (for method chaining).Enables the scanning of classfiles, producing |
| public ClassGraph | Returns: this (for method chaining).Causes ClassGraph to return classes that are not in the accepted packages, but that are directly referred to by classes within accepted packages as a superclass, implemented interface or annotation. |
| public ClassGraph | Returns: this (for method chaining).Enables the saving of field info during the scan. |
| public ClassGraph | Returns: this (for method chaining).Enables the determination of inter-class dependencies, which may be read by calling
|
| public ClassGraph | Returns: this (for method chaining).If true, use a |
| public ClassGraph | Returns: this (for method chaining).Enables the saving of method info during the scan. |
| public ClassGraph | Returns: this (for method chaining).If true, provide all versions of a multi-release resource using their multi-release path prefix, instead of just the one the running JVM would select. |
| public ClassGraph | Returns: this (for method chaining).Enables logging by calling |
| public ClassGraph | Returns: this (for method chaining).Enable classpath elements to be fetched from remote ("http:"/"https:") URLs (or URLs with custom schemes). |
| public ClassGraph | Returns: this (for method chaining).Enables the saving of static final field constant initializer values. |
| public ClassGraph | Returns: this (for method chaining).Enables the scanning of system packages ( |
| public ClassGraph | Returns: this (for method chaining).the URL scheme string, e.g. "resource" for a custom "resource:" URL scheme. scheme)Enable classpath elements to be fetched from |
| public ClassGraph | Returns: this (for method chaining).The filter function to use. This function should return true if the classpath element path should
be scanned, and false if not. classpathElementFilterAdd a classpath element filter. |
| public ClassGraph | Returns: this (for method chaining).The filter function to use. This function should return true if the classpath element classpathElementURLFilterURL
should be scanned, and false if not.Add a classpath element filter. |
| public String | Returns: a classpath path string consisting of the unique directories and jarfiles on the classpath, in classpath resolution order.Returns the list of all unique File objects representing directories or zip/jarfiles on the classpath, in classloader resolution order, in the form of a classpath path string. |
| public List | Returns: aList<File> consisting of the unique directories and jarfiles on the classpath, in classpath
resolution order.Returns the list of all unique File objects representing directories or zip/jarfiles on the classpath, in classloader resolution order. |
| pack-priv ScanResult | Returns: aScanResult object representing the result of the scan (can only be used for determining
classpath).The executor service. executorService)Get a |
| public List | Returns: the unique classpath elements and modules, as a list ofURI objects.Returns the ordered list of all unique |
| public List | Returns: the unique classpath elements and modules, as a list ofURL objects.Returns the ordered list of all unique |
| public ModulePathInfo | Returns: TheModulePathInfo.Get the module path info provided on the commandline with |
| public List | Returns: a list ofModuleRef references for all the visible modules.Returns |
| public static String | Returns: the ClassGraph version, or "unknown" if it could not be determined.Get the version number of ClassGraph. |
| public ClassGraph | Returns: this (for method chaining).Causes class visibility to be ignored, enabling private, package-private and protected classes to be scanned. |
| public ClassGraph | Returns: this (for method chaining).Causes field visibility to be ignored, enabling private, package-private and protected fields to be scanned. |
| public ClassGraph | Returns: this (for method chaining).Causes method visibility to be ignored, enabling private, package-private and protected methods to be scanned. |
| public ClassGraph | Returns: this (for method chaining).Ignore parent classloaders (i.e. only obtain paths to scan from classloaders that are not the parent of another classloader). |
| public ClassGraph | Returns: this (for method chaining).Ignore parent module layers (i.e. only scan module layers that are not the parent of another module layer). |
| public ClassGraph | Returns: this (for method chaining).Causes classes loaded using |
| public ClassGraph | Returns: this (for method chaining).The ClassLoaders to scan instead of the automatically-detected ClassLoaders. overrideClassLoaders)Completely override (and ignore) system ClassLoaders and the java.class.path system property. |
| public ClassGraph | Returns: this (for method chaining).The custom classpath to use for scanning, with path elements separated by File.pathSeparatorChar. overrideClasspath)Override the automatically-detected classpath with a custom path, with path elements separated by File.pathSeparatorChar. |
| public ClassGraph | Returns: this (for method chaining).The custom classpath to use for scanning, with path elements separated by File.pathSeparatorChar. overrideClasspathElements)Override the automatically-detected classpath with a custom path. |
| public ClassGraph | Returns: this (for method chaining).The custom classpath to use for scanning, with path elements separated by File.pathSeparatorChar. overrideClasspathElements)Override the automatically-detected classpath with a custom path. |
| public ClassGraph | Returns: this (for method chaining).The ModuleLayers to scan instead of the automatically-detected ModuleLayers. (The parameter is of
type overrideModuleLayers)Object[] for backwards compatibility with JDK 7 and JDK 8, but the argument should be
of type ModuleLayer[].)Completely override (and ignore) the visible ModuleLayers, and instead scan the requested ModuleLayers. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of classes to reject (using '.' as a separator). To match a class name
by glob in any package, you must include a package glob too, e.g. classNames)"*.*Suffix".Specifically reject one or more specific classes, preventing them from being scanned even if they are in a accepted package. |
| public ClassGraph | Returns: this (for method chaining).The resource paths which cause a classpath not to be scanned if any are present in a classpath
element for the classpath element. May contain a wildcard glob ( resourcePaths)'*').Reject classpath elements based on resource paths. |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the jars that should be scanned (e.g. jarLeafNames)"badlib.jar"). May contain a
wildcard glob ("badlib-*.jar").Reject one or more jars, preventing them from being scanned. |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the lib/ext jar(s) that should not be scanned (e.g.
jarLeafNames)"jre/lib/badlib.jar"). May contain a wildcard glob ('*'). If you call this method
with no parameters, all JRE/JDK "lib/" or "ext/" jars will be rejected.Reject one or more jars in a JRE/JDK "lib/" or "ext/" directory, preventing them from being scanned. |
| public ClassGraph | Returns: this (for method chaining).The names of the modules that should not be scanned. May contain a wildcard glob ( moduleNames)'*').Reject one or more modules, preventing them from being scanned. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to reject (with '.' as a separator). May include a glob
wildcard ( packageNames)'*').Prevent the scanning of one or more specific packages and their sub-packages. |
| public ClassGraph | Returns: this (for method chaining).The paths to reject (with '/' as a separator). May include a glob wildcard ( paths)'*').Prevent the scanning of one or more specific paths and their sub-directories / nested paths. |
| public ClassGraph | Returns: this (for method chaining).Remove temporary files, including nested jarfiles (jarfiles within jarfiles, which have to be extracted during scanning in order to be read) from their temporary directory as soon as the scan has completed. |
| public ScanResult | Returns: aScanResult object representing the result of the scan.A custom executorService, final int ExecutorService to use for scheduling worker tasks. This ExecutorService
should start tasks in FIFO order to avoid a deadlock during scan, i.e. be sure to construct the
ExecutorService with a LinkedBlockingQueue as its task queue. (This is the default
for Executors#newFixedThreadPool(int).)The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available. numParallelTasks)Scans the classpath using the requested |
| public ScanResult | Returns: aScanResult object representing the result of the scan.The number of worker threads to start up. numThreads)Scans the classpath with the requested number of threads, blocking until the scan is complete. |
| public ScanResult | Returns: aScanResult object representing the result of the scan.Scans the classpath, blocking until the scan is complete. |
| public void | scanAsync(final ExecutorService
A custom executorService, final int ExecutorService to use for scheduling worker tasks.The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available. numParallelTasks, final ClassGraph.A scanResultProcessor,ScanResultProcessor callback to run on successful scan.A failureHandlerFailureHandler callback to run on failed scan. This is passed any Throwable
thrown during the scan.Asynchronously scans the classpath, calling a |
| private Future | Returns: aFuture<ScanResult>, that when resolved using get() yields a new ScanResult object
representing the result of the scan.If true, performing a scan. If false, only fetching the classpath. performScan, final ExecutorService A custom executorService, final int ExecutorService to use for scheduling worker tasks.The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available. numParallelTasks)Asynchronously scans the classpath for matching files, returning a |
| public Future | Returns: aFuture<ScanResult>, that when resolved using get() yields a new ScanResult object
representing the result of the scan.A custom executorService, final int ExecutorService to use for scheduling worker tasks.The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available. numParallelTasks)Asynchronously scans the classpath for matching files, returning a |
| public ClassGraph | Returns: this (for method chaining).The max RAM size to use for deflated inner jars or downloaded jars. This is the limit per jar, not
for the whole classpath. maxBufferedJarRAMSize)The maximum size of an inner (nested) jar that has been deflated (i.e. compressed, not stored) within an
outer jar, before it has to be spilled to disk rather than stored in a RAM-backed |
| public ClassGraph | |
| public ClassGraph | Returns: this (for method chaining).if true, enable verbose logging. verbose)Switches on verbose logging to System.err if verbose is true. |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of classes to scan (using '.' as a separator). classNames)
Deprecated
Use
acceptClasses(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The resource paths, any of which must be present in a classpath element for the classpath element
to be scanned. May contain a wildcard glob ( resourcePaths)'*').
Deprecated
Use
acceptClasspathElementsContainingResourcePath(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the jars that should be scanned (e.g. jarLeafNames)"mylib.jar"). May contain a
wildcard glob ("mylib-*.jar").
Deprecated
Use
acceptJars(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The leafnames of the lib/ext jar(s) that should be scanned (e.g. jarLeafNames)"mylib.jar"). May contain
a wildcard glob ('*'). Note that if you call this method with no parameters, all JRE/JDK
"lib/" or "ext/" jars will be accepted.
Deprecated
Use
acceptLibOrExtJars(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The names of the modules that should be scanned. May contain a wildcard glob ( moduleNames)'*').
Deprecated
Use
acceptModules(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to scan (using '.' as a separator). May include a glob
wildcard ( packageNames)'*').
Deprecated
Use
acceptPackages(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The fully-qualified names of packages to scan (with '.' as a separator). May not include a glob
wildcard ( packageNames)'*').
Deprecated
Use
acceptPackagesNonRecursive(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The paths to scan, relative to the package root of the classpath element (with '/' as a
separator). May include a glob wildcard ( paths)'*').
Deprecated
Use
acceptPaths(String. instead.
Use |
| public ClassGraph | Returns: this (for method chaining).The paths to scan, relative to the package root of the classpath element (with '/' as a
separator). May not include a glob wildcard ( paths)'*').
Deprecated
Use
acceptPathsNonRecursive(String. instead.
Use |