Package org.springframework.data.util
Interface TypeScanner
public interface TypeScanner
A scanner that searches the classpath for matching types within given target packages.
- Since:
- 3.0
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionObtain the scan result.void
Performs the given action for each element found while scanning.default TypeScanner
forTypesAnnotatedWith
(Class<? extends Annotation>... annotations) Define annotations identifying types to include in the scan result.forTypesAnnotatedWith
(Collection<Class<? extends Annotation>> annotations) Define annotations identifying types to include in the scan result.Define what happens in the case of aClassNotFoundException
.default TypeScanner
scanPackages
(String... packageNames) Collects thenames
of packages to scan.scanPackages
(Collection<String> packageNames) Collects thenames
of packages to scan.static TypeScanner
typeScanner
(ClassLoader classLoader) Create a newTypeScanner
using the givenClassLoader
.static TypeScanner
typeScanner
(ApplicationContext context) Create a newTypeScanner
using the givenApplicationContext
.static TypeScanner
typeScanner
(ResourceLoader resourceLoader) Create a newTypeScanner
using the givenResourceLoader
.
-
Method Details
-
typeScanner
Create a newTypeScanner
using the givenClassLoader
.- Parameters:
classLoader
- must not be null.- Returns:
- new instance of
TypeScanner
.
-
typeScanner
Create a newTypeScanner
using the givenResourceLoader
.- Parameters:
resourceLoader
- must not be null.- Returns:
- new instance of
TypeScanner
.
-
typeScanner
Create a newTypeScanner
using the givenApplicationContext
.- Parameters:
context
- must not be null.- Returns:
- new instance of
TypeScanner
.
-
scanPackages
Collects thenames
of packages to scan.- Parameters:
packageNames
- array ofpackage names
to scan; Must not be null.- Returns:
- new instance of
TypeScanner
. - See Also:
-
scanPackages
Collects thenames
of packages to scan.- Parameters:
packageNames
-Collection
ofpackage names
to scan.- Returns:
- new instance of
TypeScanner
. - See Also:
-
forTypesAnnotatedWith
Define annotations identifying types to include in the scan result.- Parameters:
annotations
- must not be null.- Returns:
- new instance of
TypeScanner
. - See Also:
-
forTypesAnnotatedWith
Define annotations identifying types to include in the scan result.- Parameters:
annotations
- must not be null.- Returns:
- new instance of
TypeScanner
.
-
onClassNotFound
Define what happens in the case of aClassNotFoundException
.- Parameters:
action
- must not be null.- Returns:
-
collectAsSet
Obtain the scan result.- Returns:
- never null.
-
forEach
Performs the given action for each element found while scanning.- Parameters:
action
- must not be null.
-