Class ResourceScanner
java.lang.Object
org.jboss.resteasy.core.scanner.ResourceScanner
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceScanner
Creates a new scanner.static ResourceScanner
fromClassPath
(ClassLoader cl, Predicate<Path> filter) Creates a new scanner.Returns the class names for any applications found.Returns all classes annotated with@Provider
.Returns resources that are annotated with@Path
.getTypesAnnotatedWith
(org.jboss.jandex.DotName annotation) Returns the types with the provided annotation.static ResourceScanner
of
(org.jboss.jandex.Index index) Creates a new scanner based on the index.
-
Method Details
-
fromClassPath
Creates a new scanner. This first searches forMETA-INF/jandex.idx
resources on the class path. If no index resources are found, the class path itself is indexed. Note that scanning the class path could have significant performance impacts.- Parameters:
cl
- the class loader to find the indexes on- Returns:
- a new resource scanner
- Throws:
IOException
- if there is an error reading the index
-
fromClassPath
public static ResourceScanner fromClassPath(ClassLoader cl, Predicate<Path> filter) throws IOException Creates a new scanner. This first searches forMETA-INF/jandex.idx
resources on the class path ignoring thefilter
. If no index resources are found, the class path itself is indexed. Note that scanning the class path could have significant performance impacts.A filter can be used to exclude certain paths from being processed. For example if you want only
*.class
files to be processed you could add a filter like:final ResourceScanner.fromClassPath(Thread.currentThread().getContextClassLoader(), (path) -> path.getFileName().toString().endsWith(".class"));
- Parameters:
cl
- the class loader to find the indexes onfilter
- a filter to exclude paths,null
can be passed to use no filter- Returns:
- a new resource scanner
- Throws:
IOException
- if there is an error reading the index
-
of
Creates a new scanner based on the index.- Parameters:
index
- the index to search resources on- Returns:
- a new resource scanner
-
getApplications
-
getProviders
-
getResources
-
getTypesAnnotatedWith
-