| Modifier and Type | Class and Description |
|---|---|
| private static class | ScanResult.
A class to hold a serialized ScanResult along with the ScanSpec that was used to scan. |
| Modifier and Type | Field and Description |
|---|---|
| private ResourceList | allAcceptedResourcesCached
A list of all files that were found in accepted packages. |
| private ClassGraphClassLoader | classGraphClassLoader
A custom ClassLoader that can load classes found during the scan. |
| pack-priv Map | classNameToClassInfo
The map from class name to |
| pack-priv ClasspathFinder | |
| private List | classpathOrder
The order of classpath elements, after inner jars have been extracted to temporary files, etc. |
| private final AtomicBoolean | closed
If true, this ScanResult has already been closed. |
| private static final String | CURRENT_SERIALIZATION_FORMAT
The current serialization format. |
| private Map | fileToLastModified
The file, directory and jarfile resources timestamped during a scan, along with their timestamp at the time of the scan. |
| private final AtomicInteger | getResourcesWithPathCallCount
The number of times |
| private static final AtomicBoolean | initialized
If true, ScanResult#staticInit() has been run. |
| private boolean | isObtainedFromDeserialization
If true, this |
| private Map | moduleNameToModuleInfo
The map from class name to |
| private NestedJarHandler | nestedJarHandler
The nested jar handler instance. |
| private static Set | nonClosedWeakReferences
The set of WeakReferences to non-closed ScanResult objects. |
| private Map | packageNameToPackageInfo
The map from package name to |
| private Map | pathToAcceptedResourcesCached
The map from path (relative to package root) to a list of |
| private List | rawClasspathEltOrderStrs
The order of raw classpath elements. |
| protected ReflectionUtils | |
| pack-priv ScanSpec | scanSpec
The scan spec. |
| private final LogNode | topLevelLog
The toplevel log. |
| private final WeakReference | weakReference
The |
| Access | Constructor and Description |
|---|---|
| pack-priv | ScanResult(final ScanSpec
the scan spec scanSpec, final List<ClasspathElement> the classpath order classpathOrder, final List<String> the raw classpath element order rawClasspathEltOrderStrs, final ClasspathFinder the classpathFinder, final Map<String, ClassInfo> ClasspathFindera map from class name to class info classNameToClassInfo, final Map<String, PackageInfo> a map from package name to package info packageNameToPackageInfo, final Map<String, ModuleInfo> a map from module name to module info moduleNameToModuleInfo, final Map<File, Long> a map from file to last modified time fileToLastModified, final NestedJarHandler the nested jar handler nestedJarHandler, final LogNode the toplevel log topLevelLog)The result of a scan. |
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: the maximum last-modified time for accepted files/directories/jars encountered during the scan.Find the maximum last-modified timestamp of any accepted file/directory/jarfile encountered during the scan. |
| public boolean | Returns: true if the classpath contents have been modified since the last scan.Determine whether the classpath contents have been modified since the last scan. |
| public void | close()
Implements java. Free any temporary files created by extracting jars or files from within jars. |
| public static void | |
| public static ScanResult | Returns: The deserializedScanResult.The JSON string for the serialized json)ScanResult.Deserialize a ScanResult from previously-serialized JSON. |
| public ClassInfoList | Returns: A list of all annotation classes found during the scan, or the empty list if none.Get all annotation classes found during the scan. |
| public ClassInfoList | Returns: A list of all accepted classes found during the scan, or the empty list if none.Get all classes, interfaces and annotations found during the scan. |
| public Map | Returns: The map from class name toClassInfo object for all classes, interfaces and annotations found
during the scan.Get a map from class name to |
| public ClassInfoList | Returns: A list of allEnum classes found during the scan, or the empty list if none.Get all |
| public ClassInfoList | Returns: A list of all accepted interfaces found during the scan, or the empty list if none.Get all interface classes found during the scan (not including annotations, which are also technically interfaces). |
| public ClassInfoList | Returns: A list of all accepted interfaces found during the scan, or the empty list if none.Get all interface or annotation classes found during the scan. |
| public ClassInfoList | Returns: A list of allrecord classes found during the scan, or the empty list if none.Get all |
| public ResourceList | Returns: A list of all resources (including classfiles and non-classfiles) found in accepted packages.Get the list of all resources. |
| public Map | Returns: The map from resource path toResource for all resources (including classfiles and
non-classfiles) found in accepted packages.Get a map from resource path to |
| public ClassInfoList | Returns: A list of all accepted standard classes found during the scan, or the empty list if none.Get all standard (non-interface/non-annotation) classes found during the scan. |
| public ClassInfoList | Returns: A list of all annotation classes that were found with the named class annotation during the scan, or the empty list if none.The name of the class. className)Get annotations on the named class. |
| public Map | Returns: A map from aClassInfo object for each accepted class to a list of the classes referenced by
that class (i.e. returns a map from dependents to dependencies). Each map value is the result of
calling ClassInfo#getClassDependencies() on the corresponding key.Get a map from the |
| public ClassInfoList | Returns: A list of all classes that implement the interface, or the empty list if none.The interface class. interfaceClass)Get all classes that implement (or have superclasses that implement) the interface (or one of its subinterfaces). |
| public ClassInfoList | Returns: A list of all classes that implement the named interface, or the empty list if none.The interface name. interfaceName)Get all classes that implement (or have superclasses that implement) the named interface (or one of its subinterfaces). |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with any of the class annotations during the scan, or the empty list if none.The class annotations or meta-annotations. annotations)Get classes with all of the specified class annotations or meta-annotation. |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with all of the named class annotations during the scan, or the empty list if none.The name of the class annotations or meta-annotations. annotationNames)Get classes with all of the named class annotations or meta-annotation. |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with the class annotation during the scan, or the empty list if none.The class annotation or meta-annotation. annotation)Get classes with the class annotation or meta-annotation. |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with the named class annotation during the scan, or the empty list if none.The name of the class annotation or meta-annotation. annotationName)Get classes with the named class annotation or meta-annotation. |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with any of the class annotations during the scan, or the empty list if none.The class annotations or meta-annotations. annotations)Get classes with any of the specified class annotations or meta-annotation. |
| public ClassInfoList | Returns: A list of all non-annotation classes that were found with any of the named class annotations during the scan, or the empty list if none.The name of the class annotations or meta-annotations. annotationNames)Get classes with any of the named class annotations or meta-annotation. |
| public ClassInfoList | Returns: A list of classes that have a field with an annotation of the named type, or the empty list if none.the field annotation. fieldAnnotation)Get classes that have a field with an annotation of the named type. |
| public ClassInfoList | Returns: A list of classes that have a field with an annotation of the named type, or the empty list if none.the name of the field annotation. fieldAnnotationName)Get classes that have a field with an annotation of the named type. |
| public ClassInfoList | Returns: A list of classes with a method that has an annotation of the named type, or the empty list if none.the method annotation. methodAnnotation)Get classes that have a method with an annotation of the named type. |
| public ClassInfoList | Returns: A list of classes with a method that has an annotation of the named type, or the empty list if none.the name of the method annotation. methodAnnotationName)Get classes that have a method with an annotation of the named type. |
| public ClassInfoList | Returns: A list of classes that have a method with a parameter annotated with the named annotation type, or the empty list if none.the method parameter annotation. methodParameterAnnotation)Get classes that have a method with a parameter that is annotated with an annotation of the named type. |
| public ClassInfoList | Returns: A list of classes that have a method with a parameter annotated with the named annotation type, or the empty list if none.the name of the method parameter annotation. methodParameterAnnotationName)Get classes that have a method with a parameter that is annotated with an annotation of the named type. |
| public ClassInfo | Returns: TheClassInfo object for the named class, or null if the class was not found.The class name. className)Get the |
| pack-priv ClassLoader[] | Returns: the class loader order.Get the ClassLoader order, respecting parent-first/parent-last delegation order. |
| public String | Returns: a the unique directories and jarfiles on the classpath, in classpath resolution order, as a path string.Returns all unique directories or zip/jarfiles on the classpath, in classloader resolution order, as a classpath string, delineated with the standard path separator character. |
| public List | Returns: The unique classpath elements.Returns the list of File objects for unique classpath elements (directories or jarfiles), in classloader resolution order. |
| public List | Returns: The unique classpath element and module URIs.Returns an ordered list of unique classpath element and module URIs. |
| public List | Returns: The unique classpath element and module URLs.Returns an ordered list of unique classpath element and module URLs. |
| public ClassInfoList | Returns: A list of interfaces implemented by the named class (or superinterfaces extended by the named interface), or the empty list if none.The class name. className)Get all interfaces implemented by the named class or by one of its superclasses, if the named class is a standard class, or the superinterfaces extended by this interface, if it is an interface. |
| public ClassInfoList | Returns: A list of interfaces implemented by the given class (or superinterfaces extended by the given interface), or the empty list if none.The class. classRef)Get all interfaces implemented by the class or by one of its superclasses, if the given class is a standard class, or the superinterfaces extended by this interface, if it is an interface. |
| public ModuleInfo | Returns: TheModuleInfo object for the named module, or null if the module was not found.The module name. moduleName)Get the |
| public ModuleInfoList | Returns: A list of all modules found during the scan, or the empty list if none.Get all modules found during the scan. |
| public ModulePathInfo | Returns: TheModulePathInfo.Get the module path info provided on the commandline with |
| public List | Returns: ModuleRef references for all visible modules.Get |
| public PackageInfo | Returns: ThePackageInfo object for the named package, or null if the package was not found.The package name. packageName)Get the |
| public PackageInfoList | Returns: A list of all packages found during the scan, or the empty list if none.Get all packages found during the scan. |
| public ResourceList | Returns: A list of all resources found in accepted packages that have a path matching the requested pattern.A pattern to match pattern)Resource paths with.Get the list of all resources found in accepted packages that have a path matching the requested regex pattern. |
| public ResourceList | Returns: A list of all resources found in accepted packages that have a path matching the requested wildcard string.A wildcard (glob) pattern to match wildcardString)Resource paths with.Get the list of all resources found in accepted packages that have a path matching the requested wildcard string. |
| public ResourceList | Returns: A list of all resources found in accepted packages that have the requested filename extension.A filename extension, e.g. "xml" to match all resources ending in ".xml". extension)Get the list of all resources found in accepted packages that have the requested filename extension. |
| public ResourceList | Returns: A list of all resources found in accepted packages that have the requested leafname.A resource leaf filename. leafName)Get the list of all resources found in accepted packages that have the requested leafname. |
| public ResourceList | Returns: A list of all resources found in accepted packages that have the given path, relative to the package root of the classpath element. May match several resources, up to one per classpath element.A complete resource path, relative to the classpath entry package root. resourcePath)Get the list of all resources found in accepted packages that have the given path, relative to the package root of the classpath element. |
| public ResourceList | Returns: A list of all resources found in any classpath element, whether in accepted packages or not (as long as the resource is not rejected), that have the given path, relative to the package root of the classpath element. May match several resources, up to one per classpath element.A complete resource path, relative to the classpath entry package root. resourcePath)Get the list of all resources found in any classpath element, whether in accepted packages or not (as long as the resource is not rejected), that have the given path, relative to the package root of the classpath element. |
| public ResourceList | Returns: A list of all resources found in any classpath element, whether in accepted packages or not (as long as the resource is not rejected), that have the given path, relative to the package root of the classpath element. May match several resources, up to one per classpath element.A complete resource path, relative to the classpath entry package root. resourcePath)
Deprecated
Use
getResourcesWithPathIgnoringAccept(String) instead.
Use |
| public Map | Returns: A map from aClassInfo object for each dependency class (accepted or not) to a list of the
accepted classes that referenced that class as a dependency (i.e. returns a map from dependencies to
dependents).Get the reverse class dependency map, i.e. a map from the |
| public ClassInfoList | Returns: A list of subclasses of the superclass, or the empty list if none.The superclass. superclass)Get all subclasses of the superclass. |
| public ClassInfoList | Returns: A list of subclasses of the named superclass, or the empty list if none.The name of the superclass. superclassName)Get all subclasses of the named superclass. |
| public ClassInfoList | Returns: A list of superclasses of the named subclass, or the empty list if none.The name of the subclass. subclassName)Get superclasses of the named subclass. |
| public ClassInfoList | Returns: A list of superclasses of the named subclass, or the empty list if none.The subclass. subclass)Get superclasses of the subclass. |
| private void | |
| pack-priv static void | init(final ReflectionUtils reflectionUtils)
Static initialization (warm up classloading), called when the ClassGraph class is initialized. |
| public boolean | Returns: true if this ScanResult has been closedReturns whether this ScanResult has been closed yet or not. |
| public boolean | Returns: True if thisScanResult was obtained from JSON by deserialization.Checks if this |
| public Class | Returns: a reference to the loaded class, or null if the class could not be loaded and ignoreExceptions is true.the class to load. className, final boolean If true, null is returned if there was an exception during classloading, otherwise
IllegalArgumentException is thrown if a class could not be loaded. returnNullIfClassNotFound)Load a class given a class name. |
| public < the superclass or interface type. T> Class | Returns: a reference to the loaded class, or null if the class could not be loaded and ignoreExceptions is true.the class to load. className, final Class<T> The class type to cast the result to. superclassOrInterfaceType, final boolean If true, null is returned if there was an exception during classloading, otherwise
IllegalArgumentException is thrown if a class could not be loaded. returnNullIfClassNotFound)Load a class given a class name. |
| public String | Returns: ThisScanResult, serialized as a JSON string.If greater than 0, JSON will be formatted (indented), otherwise it will be minified (un-indented). indentWidth)Serialize a ScanResult to JSON. |
| public String | Returns: ThisScanResult, serialized as a JSON string.Serialize a ScanResult to minified (un-indented) JSON. |