Class ModuleReflectionUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtil
Contains utility methods for module reflection.
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptiongetCheckstyleModules(Collection<String> packages, ClassLoader loader) Gets checkstyle's modules classes (directly, not recursively) in the given packages.private static booleanhasDefaultConstructor(Class<?> clazz) Checks if the class has a default constructor.static booleanisAuditListener(Class<?> clazz) Checks whether a class may be considered as the checkstyle audit listener module.static booleanisCheckstyleModule(Class<?> clazz) Checks whether a class may be considered as a checkstyle module.static booleanisCheckstyleTreeWalkerCheck(Class<?> clazz) Checks whether a class may be considered as the checkstyle check which has TreeWalker as a parent.static booleanisFileFilterModule(Class<?> clazz) Checks whether a class may be considered as the checkstyle file filter.static booleanisFileSetModule(Class<?> clazz) Checks whether a class may be considered as the checkstyle file set.static booleanisFilterModule(Class<?> clazz) Checks whether a class may be considered as the checkstyle filter.private static booleanisNotXpathFileGenerator(Class<?> clazz) Checks whether a class isXpathFileGeneratorAstFilterorXpathFileGeneratorAuditListener.static booleanisRootModule(Class<?> clazz) Checks whether a class may be considered as the checkstyle root module.static booleanisTreeWalkerFilterModule(Class<?> clazz) Checks whether a class may be considered as the checkstyleTreeWalkerfilter. 
- 
Constructor Details
- 
ModuleReflectionUtil
private ModuleReflectionUtil()Prevent instantiation. 
 - 
 - 
Method Details
- 
getCheckstyleModules
public static Set<Class<?>> getCheckstyleModules(Collection<String> packages, ClassLoader loader) throws IOException Gets checkstyle's modules classes (directly, not recursively) in the given packages.- Parameters:
 packages- the collection of package names to useloader- the class loader used to load Checkstyle package names- Returns:
 - the set of checkstyle's module classes
 - Throws:
 IOException- if the attempt to read class path resources failed- See Also:
 
 - 
isCheckstyleModule
Checks whether a class may be considered as a checkstyle module. Checkstyle's modules are classes which extend 'AutomaticBean', is non-abstract, and has a default constructor.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered a valid production class.
 
 - 
hasDefaultConstructor
Checks if the class has a default constructor.- Parameters:
 clazz- class to check- Returns:
 - true if the class has a default constructor.
 
 - 
isCheckstyleTreeWalkerCheck
Checks whether a class may be considered as the checkstyle check which has TreeWalker as a parent. Checkstyle's checks are classes which implement 'AbstractCheck' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle check.
 
 - 
isFileSetModule
Checks whether a class may be considered as the checkstyle file set. Checkstyle's file sets are classes which implement 'AbstractFileSetCheck' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle file set.
 
 - 
isFilterModule
Checks whether a class may be considered as the checkstyle filter. Checkstyle's filters are classes which implement 'Filter' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle filter.
 
 - 
isFileFilterModule
Checks whether a class may be considered as the checkstyle file filter. Checkstyle's file filters are classes which implement 'BeforeExecutionFileFilter' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle file filter.
 
 - 
isAuditListener
Checks whether a class may be considered as the checkstyle audit listener module. Checkstyle's audit listener modules are classes which implement 'AuditListener' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle audit listener module.
 
 - 
isRootModule
Checks whether a class may be considered as the checkstyle root module. Checkstyle's root modules are classes which implement 'RootModule' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle root module.
 
 - 
isTreeWalkerFilterModule
Checks whether a class may be considered as the checkstyleTreeWalkerfilter. Checkstyle'sTreeWalkerfilters are classes which implement 'TreeWalkerFilter' interface.- Parameters:
 clazz- class to check.- Returns:
 - true if a class may be considered as the checkstyle 
TreeWalkerfilter. 
 - 
isNotXpathFileGenerator
Checks whether a class isXpathFileGeneratorAstFilterorXpathFileGeneratorAuditListener. See issue #102- Parameters:
 clazz- class to check.- Returns:
 - true if a class name starts with `XpathFileGenerator`.
 
 
 -