public class CheckRegistry extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
java.lang.Class<? extends IGlobalExtractionPhase<?,?>> |
getCheckPhase(java.lang.String phaseName)
Returns the check phase class with the given full qualified name or
null if no such phase exists. |
java.util.Collection<CheckInfo> |
getChecksInfos()
Returns a list of all registered checks.
|
static CheckRegistry |
getInstance()
Returns the singleton instance.
|
java.util.Collection<CheckInstance> |
instantiateChecks(java.util.List<java.lang.String> identifiers)
Creates check instances for the given check identifiers.
|
void |
loadChecksFromJar(java.io.File jarFile)
Loads custom checks from the given Jar file.
|
void |
registerCheckDirectory(java.io.File customChecksDirectory)
Searches the given directory for Jar files or classes directories containing
custom checks.
|
void |
registerChecksByServiceLoader(java.lang.String fullPackageName)
Registers custom checks from the given package.
|
void |
registerChecksFromClasspathDirectory(java.io.File classesDirectory)
Registers the given bundle and loads all classes from the given bundle that
implement
CheckImplementationBase and are annotated with
Check . |
public static CheckRegistry getInstance()
public void registerChecksByServiceLoader(java.lang.String fullPackageName)
Check
.
Uses the current thread's class loader for loading the checks. This means the classes directory needs to be already on the class path.
public void registerChecksFromClasspathDirectory(java.io.File classesDirectory)
CheckImplementationBase
and are annotated with
Check
.
Uses the current thread's class loader for loading the checks. This means the classes directory needs already on the class path.
public void registerCheckDirectory(java.io.File customChecksDirectory)
This supports registering Jars as well as compiled classes in a 'classes' directory (e.g. from an Eclipse project). Both are searched recursively, but whenever a folder contains a classes directory scanning for Jars and further classes directories is skipped. The restriction results from jar files being placed e.g by Gradle in the 'build' output of source projects, which would then be picked up and lead to problems. The same applies to the classes folder in the Gradle build output.
The found jars and classes directories will be put on the classpath (using a separate classloader).
public void loadChecksFromJar(java.io.File jarFile)
public java.lang.Class<? extends IGlobalExtractionPhase<?,?>> getCheckPhase(java.lang.String phaseName)
null
if no such phase exists.public java.util.Collection<CheckInstance> instantiateChecks(java.util.List<java.lang.String> identifiers) throws CheckException
CheckException
- if there is no check for one of the given identifierspublic java.util.Collection<CheckInfo> getChecksInfos()