public class ScanSpec extends Object
Modifier and Type | Field and Description |
---|---|
RetentionPolicy |
annotationVisibility
Annotation retention visibility: RetentionPolicy.CLASS matches all annotations (both RuntimeVisible and
RuntimeInvisible); RetentionPolicy.RUNTIME matches only RuntimeVisible annotations.
|
boolean |
disableRecursiveScanning
Whether to disable recursive scanning (enabled by default).
|
boolean |
enableFieldAnnotationIndexing
If true, index field annotations.
|
boolean |
enableFieldInfo
If true, enables the saving of field info during the scan.
|
boolean |
enableFieldTypeIndexing
If true, index types of fields.
|
boolean |
enableMethodAnnotationIndexing
If true, index method annotations.
|
boolean |
enableMethodInfo
If true, enables the saving of method info during the scan.
|
boolean |
ignoreFieldVisibility
If true, ignore field visibility (affects finding classes with fields of a given type, and matching of static
final fields with constant initializers).
|
boolean |
ignoreMethodVisibility
If true, ignore method visibility (affects finding methods with annotations of a given type).
|
boolean |
initializeLoadedClasses
If true, classes loaded with Class.forName() are initialized before passing class references to
MatchProcessors.
|
boolean |
removeTemporaryFilesAfterScan
If true, nested jarfiles (jarfiles within jarfiles) that are extracted during scanning are removed from their
temporary directory (e.g.
|
boolean |
strictWhitelist
If true, remove "external" classes from consideration (i.e.
|
Constructor and Description |
---|
ScanSpec(String[] scanSpec,
LogNode log)
Parses the scanning specification that was passed to the FastClasspathScanner constructor, and finds all
ClassLoaders.
|
Modifier and Type | Method and Description |
---|---|
void |
addClassLoader(ClassLoader classLoader)
Add a ClassLoader to the list of ClassLoaders to scan.
|
void |
callMatchProcessors(ScanResult scanResult)
Run the MatchProcessors after a scan has completed.
|
MultiMapKeyToSet<String,String> |
getClassNameToStaticFinalFieldsToMatch() |
boolean |
hasMatchProcessors()
Return true if any MatchProcessors have been added.
|
void |
ignoreParentClassLoaders(boolean ignoreParentClassloaders) |
void |
matchAllAnnotationClasses(ClassMatchProcessor classMatchProcessor)
Calls the provided ClassMatchProcessor for all annotation classes (annotation definitions) found in
whitelisted packages on the classpath.
|
void |
matchAllClasses(ClassMatchProcessor classMatchProcessor)
Calls the provided ClassMatchProcessor for all standard classes, interfaces and annotations found in
whitelisted packages on the classpath.
|
void |
matchAllInterfaceClasses(ClassMatchProcessor classMatchProcessor)
Calls the provided ClassMatchProcessor for all interface classes (interface definitions) found in whitelisted
packages on the classpath.
|
void |
matchAllStandardClasses(ClassMatchProcessor classMatchProcessor)
Calls the provided ClassMatchProcessor for all standard classes (i.e.
|
<T> void |
matchClassesImplementing(Class<T> implementedInterface,
ImplementingClassMatchProcessor<T> implementingClassMatchProcessor)
Calls the provided InterfaceMatchProcessor for classes on the classpath that implement the specified
interface or a subinterface, or whose superclasses implement the specified interface or a sub-interface.
|
void |
matchClassesWithAnnotation(Class<?> annotation,
ClassAnnotationMatchProcessor classAnnotationMatchProcessor)
Calls the provided ClassAnnotationMatchProcessor if classes are found on the classpath that have the
specified annotation.
|
void |
matchClassesWithFieldAnnotation(Class<? extends Annotation> annotation,
FieldAnnotationMatchProcessor fieldAnnotationMatchProcessor)
Calls the provided FieldAnnotationMatchProcessor if classes are found on the classpath that have one or more
fields with the specified annotation.
|
<T> void |
matchClassesWithFieldOfType(Class<T> fieldType,
ClassMatchProcessor classMatchProcessor)
Calls the provided ClassMatchProcessor for classes on the classpath that have a field of the given type.
|
void |
matchClassesWithMethodAnnotation(Class<? extends Annotation> annotation,
MethodAnnotationMatchProcessor methodAnnotationMatchProcessor)
Calls the provided MethodAnnotationMatchProcessor if classes are found on the classpath that have one or more
methods with the specified annotation.
|
void |
matchFilenameExtension(String extensionToMatch,
FileMatchContentsProcessor fileMatchContentsProcessor)
Calls the given FileMatchProcessor if files are found on the classpath that have the given file extension.
|
void |
matchFilenameExtension(String extensionToMatch,
FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
Calls the given FileMatchProcessorWithContext if files are found on the classpath that have the given file
extension.
|
void |
matchFilenameExtension(String extensionToMatch,
FileMatchProcessor fileMatchProcessor)
Calls the given FileMatchProcessor if files are found on the classpath that have the given file extension.
|
void |
matchFilenameExtension(String extensionToMatch,
FileMatchProcessorWithContext fileMatchProcessorWithContext)
Calls the given FileMatchProcessorWithContext if files are found on the classpath that have the given file
extension.
|
void |
matchFilenamePath(String relativePathToMatch,
FileMatchContentsProcessor fileMatchContentsProcessor)
Calls the given FileMatchContentsProcessor if files are found on the classpath that exactly match the given
relative path.
|
void |
matchFilenamePath(String relativePathToMatch,
FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
Calls the given FileMatchContentsProcessorWithContext if files are found on the classpath that exactly match
the given relative path.
|
void |
matchFilenamePath(String relativePathToMatch,
FileMatchProcessor fileMatchProcessor)
Calls the given FileMatchProcessor if files are found on the classpath that exactly match the given relative
path.
|
void |
matchFilenamePath(String relativePathToMatch,
FileMatchProcessorWithContext fileMatchProcessorWithContext)
Calls the given FileMatchProcessorWithContext if files are found on the classpath that exactly match the
given relative path.
|
void |
matchFilenamePathLeaf(String pathLeafToMatch,
FileMatchContentsProcessor fileMatchContentsProcessor)
Calls the given FileMatchContentsProcessor if files are found on the classpath that exactly match the given
path leafname.
|
void |
matchFilenamePathLeaf(String pathLeafToMatch,
FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
Calls the given FileMatchContentsProcessorWithContext if files are found on the classpath that exactly match
the given path leafname.
|
void |
matchFilenamePathLeaf(String pathLeafToMatch,
FileMatchProcessor fileMatchProcessor)
Calls the given FileMatchProcessor if files are found on the classpath that exactly match the given path
leafname.
|
void |
matchFilenamePathLeaf(String pathLeafToMatch,
FileMatchProcessorWithContext fileMatchProcessorWithContext)
Calls the given FileMatchProcessorWithContext if files are found on the classpath that exactly match the
given path leafname.
|
void |
matchFilenamePattern(String pathRegexp,
FileMatchContentsProcessor fileMatchContentsProcessor)
Calls the given FileMatchContentsProcessor if files are found on the classpath with the given regexp pattern
in their path.
|
void |
matchFilenamePattern(String pathRegexp,
FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
Calls the given FileMatchContentsProcessorWithContext if files are found on the classpath with the given
regexp pattern in their path.
|
void |
matchFilenamePattern(String pathRegexp,
FileMatchProcessor fileMatchProcessor)
Calls the given FileMatchProcessor if files are found on the classpath with the given regexp pattern in their
path.
|
void |
matchFilenamePattern(String pathRegexp,
FileMatchProcessorWithContext fileMatchProcessorWithContext)
Calls the given FileMatchProcessorWithContext if files are found on the classpath with the given regexp
pattern in their path.
|
void |
matchStaticFinalFieldNames(Set<String> fullyQualifiedStaticFinalFieldNames,
StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
Calls the given StaticFinalFieldMatchProcessor if classes are found on the classpath that contain static
final fields that match one of a set of fully-qualified field names, e.g.
|
void |
matchStaticFinalFieldNames(String[] fullyQualifiedStaticFinalFieldNames,
StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
Calls the given StaticFinalFieldMatchProcessor if classes are found on the classpath that contain static
final fields that match one of a list of fully-qualified field names, e.g.
|
void |
matchStaticFinalFieldNames(String fullyQualifiedStaticFinalFieldName,
StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
Calls the given StaticFinalFieldMatchProcessor if classes are found on the classpath that contain static
final fields that match a fully-qualified field name, e.g.
|
<T> void |
matchSubclassesOf(Class<T> superclass,
SubclassMatchProcessor<T> subclassMatchProcessor)
Calls the provided SubclassMatchProcessor if classes are found on the classpath that extend the specified
superclass.
|
<T> void |
matchSubinterfacesOf(Class<T> superinterface,
SubinterfaceMatchProcessor<T> subinterfaceMatchProcessor)
Calls the provided SubinterfaceMatchProcessor if an interface that extends a given superinterface is found on
the classpath.
|
void |
overrideClassLoaders(ClassLoader... overrideClassLoaders)
Completely override the list of ClassLoaders to scan.
|
void |
overrideClasspath(String overrideClasspath)
Override the automatically-detected classpath with a custom search path.
|
void |
registerClassLoaderHandler(Class<? extends ClassLoaderHandler> classLoaderHandler)
Register an extra ClassLoaderHandler.
|
public boolean enableFieldTypeIndexing
public boolean enableMethodAnnotationIndexing
public boolean enableFieldAnnotationIndexing
public boolean enableFieldInfo
public boolean enableMethodInfo
public boolean strictWhitelist
public boolean ignoreFieldVisibility
public boolean ignoreMethodVisibility
public RetentionPolicy annotationVisibility
public boolean disableRecursiveScanning
public boolean initializeLoadedClasses
public boolean removeTemporaryFilesAfterScan
public MultiMapKeyToSet<String,String> getClassNameToStaticFinalFieldsToMatch()
public void registerClassLoaderHandler(Class<? extends ClassLoaderHandler> classLoaderHandler)
public void overrideClasspath(String overrideClasspath)
public void addClassLoader(ClassLoader classLoader)
public void overrideClassLoaders(ClassLoader... overrideClassLoaders)
public void ignoreParentClassLoaders(boolean ignoreParentClassloaders)
public boolean hasMatchProcessors()
public void callMatchProcessors(ScanResult scanResult)
public void matchAllClasses(ClassMatchProcessor classMatchProcessor)
classMatchProcessor
- the ClassMatchProcessor to call when a match is found.public void matchAllStandardClasses(ClassMatchProcessor classMatchProcessor)
classMatchProcessor
- the ClassMatchProcessor to call when a match is found.public void matchAllInterfaceClasses(ClassMatchProcessor classMatchProcessor)
classMatchProcessor
- the ClassMatchProcessor to call when a match is found.public void matchAllAnnotationClasses(ClassMatchProcessor classMatchProcessor)
classMatchProcessor
- the ClassMatchProcessor to call when a match is found.public <T> void matchSubclassesOf(Class<T> superclass, SubclassMatchProcessor<T> subclassMatchProcessor)
superclass
- The superclass to match (i.e. the class that subclasses need to extend to match).subclassMatchProcessor
- the SubclassMatchProcessor to call when a match is found.public <T> void matchSubinterfacesOf(Class<T> superinterface, SubinterfaceMatchProcessor<T> subinterfaceMatchProcessor)
superinterface
- The superinterface to match (i.e. the interface that subinterfaces need to extend to match).subinterfaceMatchProcessor
- the SubinterfaceMatchProcessor to call when a match is found.public <T> void matchClassesImplementing(Class<T> implementedInterface, ImplementingClassMatchProcessor<T> implementingClassMatchProcessor)
implementedInterface
- The interface that classes need to implement.implementingClassMatchProcessor
- the ClassMatchProcessor to call when a match is found.public <T> void matchClassesWithFieldOfType(Class<T> fieldType, ClassMatchProcessor classMatchProcessor)
fieldType
- The type of the field to match..classMatchProcessor
- the ClassMatchProcessor to call when a match is found.public void matchClassesWithAnnotation(Class<?> annotation, ClassAnnotationMatchProcessor classAnnotationMatchProcessor)
annotation
- The class annotation to match.classAnnotationMatchProcessor
- the ClassAnnotationMatchProcessor to call when a match is found.public void matchClassesWithMethodAnnotation(Class<? extends Annotation> annotation, MethodAnnotationMatchProcessor methodAnnotationMatchProcessor)
annotation
- The method annotation to match.methodAnnotationMatchProcessor
- the MethodAnnotationMatchProcessor to call when a match is found.public void matchClassesWithFieldAnnotation(Class<? extends Annotation> annotation, FieldAnnotationMatchProcessor fieldAnnotationMatchProcessor)
annotation
- The method annotation to match.fieldAnnotationMatchProcessor
- the FieldAnnotationMatchProcessor to call when a match is found.public void matchStaticFinalFieldNames(Set<String> fullyQualifiedStaticFinalFieldNames, StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
fullyQualifiedStaticFinalFieldNames
- The set of fully-qualified static field names to match.staticFinalFieldMatchProcessor
- the StaticFinalFieldMatchProcessor to call when a match is found.public void matchStaticFinalFieldNames(String fullyQualifiedStaticFinalFieldName, StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
fullyQualifiedStaticFinalFieldName
- The fully-qualified static field name to matchstaticFinalFieldMatchProcessor
- the StaticFinalFieldMatchProcessor to call when a match is found.public void matchStaticFinalFieldNames(String[] fullyQualifiedStaticFinalFieldNames, StaticFinalFieldMatchProcessor staticFinalFieldMatchProcessor)
fullyQualifiedStaticFinalFieldNames
- The list of fully-qualified static field names to match.staticFinalFieldMatchProcessor
- the StaticFinalFieldMatchProcessor to call when a match is found.public void matchFilenamePattern(String pathRegexp, FileMatchProcessor fileMatchProcessor)
pathRegexp
- The regexp to match, e.g. "app/templates/.\*\.html"fileMatchProcessor
- The FileMatchProcessor to call when each match is found.public void matchFilenamePattern(String pathRegexp, FileMatchContentsProcessor fileMatchContentsProcessor)
pathRegexp
- The regexp to match, e.g. "app/templates/.\*\.html"fileMatchContentsProcessor
- The FileMatchContentsProcessor to call when each match is found.public void matchFilenamePattern(String pathRegexp, FileMatchProcessorWithContext fileMatchProcessorWithContext)
pathRegexp
- The regexp to match, e.g. "app/templates/.\*\.html"fileMatchProcessorWithContext
- The FileMatchProcessorWithContext to call when each match is found.public void matchFilenamePattern(String pathRegexp, FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
pathRegexp
- The regexp to match, e.g. "app/templates/.\*\.html"fileMatchContentsProcessorWithContext
- The FileMatchContentsProcessorWithContext to call when each match is found.public void matchFilenamePath(String relativePathToMatch, FileMatchProcessor fileMatchProcessor)
relativePathToMatch
- The complete path to match relative to the classpath entry, e.g.
"app/templates/WidgetTemplate.html"fileMatchProcessor
- The FileMatchProcessor to call when each match is found.public void matchFilenamePath(String relativePathToMatch, FileMatchContentsProcessor fileMatchContentsProcessor)
relativePathToMatch
- The complete path to match relative to the classpath entry, e.g.
"app/templates/WidgetTemplate.html"fileMatchContentsProcessor
- The FileMatchContentsProcessor to call when each match is found.public void matchFilenamePath(String relativePathToMatch, FileMatchProcessorWithContext fileMatchProcessorWithContext)
relativePathToMatch
- The complete path to match relative to the classpath entry, e.g.
"app/templates/WidgetTemplate.html"fileMatchProcessorWithContext
- The FileMatchProcessorWithContext to call when each match is found.public void matchFilenamePath(String relativePathToMatch, FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
relativePathToMatch
- The complete path to match relative to the classpath entry, e.g.
"app/templates/WidgetTemplate.html"fileMatchContentsProcessorWithContext
- The FileMatchContentsProcessorWithContext to call when each match is found.public void matchFilenamePathLeaf(String pathLeafToMatch, FileMatchProcessor fileMatchProcessor)
pathLeafToMatch
- The complete path leaf to match, e.g. "WidgetTemplate.html"fileMatchProcessor
- The FileMatchProcessor to call when each match is found.public void matchFilenamePathLeaf(String pathLeafToMatch, FileMatchContentsProcessor fileMatchContentsProcessor)
pathLeafToMatch
- The complete path leaf to match, e.g. "WidgetTemplate.html"fileMatchContentsProcessor
- The FileMatchContentsProcessor to call when each match is found.public void matchFilenamePathLeaf(String pathLeafToMatch, FileMatchProcessorWithContext fileMatchProcessorWithContext)
pathLeafToMatch
- The complete path leaf to match, e.g. "WidgetTemplate.html"fileMatchProcessorWithContext
- The FileMatchProcessorWithContext to call when each match is found.public void matchFilenamePathLeaf(String pathLeafToMatch, FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
pathLeafToMatch
- The complete path leaf to match, e.g. "WidgetTemplate.html"fileMatchContentsProcessorWithContext
- The FileMatchContentsProcessorWithContext to call when each match is found.public void matchFilenameExtension(String extensionToMatch, FileMatchProcessor fileMatchProcessor)
extensionToMatch
- The extension to match, e.g. "html" matches "WidgetTemplate.html" and "WIDGET.HTML".fileMatchProcessor
- The FileMatchProcessor to call when each match is found.public void matchFilenameExtension(String extensionToMatch, FileMatchContentsProcessor fileMatchContentsProcessor)
extensionToMatch
- The extension to match, e.g. "html" matches "WidgetTemplate.html".fileMatchContentsProcessor
- The FileMatchContentsProcessor to call when each match is found.public void matchFilenameExtension(String extensionToMatch, FileMatchProcessorWithContext fileMatchProcessorWithContext)
extensionToMatch
- The extension to match, e.g. "html" matches "WidgetTemplate.html" and "WIDGET.HTML".fileMatchProcessorWithContext
- The FileMatchProcessorWithContext to call when each match is found.public void matchFilenameExtension(String extensionToMatch, FileMatchContentsProcessorWithContext fileMatchContentsProcessorWithContext)
extensionToMatch
- The extension to match, e.g. "html" matches "WidgetTemplate.html".fileMatchContentsProcessorWithContext
- The FileMatchContentsProcessorWithContext to call when each match is found.Copyright © 2017. All rights reserved.