Class ModuleReflectionUtil


  • public final class ModuleReflectionUtil
    extends java.lang.Object
    Contains utility methods for module reflection.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<java.lang.Class<?>> getCheckstyleModules​(java.util.Collection<java.lang.String> packages, java.lang.ClassLoader loader)
      Gets checkstyle's modules (directly, not recursively) in the given packages.
      static boolean isAuditListener​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle audit listener module.
      static boolean isCheckstyleModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as a checkstyle module.
      static boolean isCheckstyleTreeWalkerCheck​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle check which has TreeWalker as a parent.
      static boolean isFileFilterModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle file filter.
      static boolean isFileSetModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle file set.
      static boolean isFilterModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle filter.
      static boolean isRootModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle root module.
      static boolean isTreeWalkerFilterModule​(java.lang.Class<?> clazz)
      Checks whether a class may be considered as the checkstyle TreeWalker filter.
      static boolean isValidCheckstyleClass​(java.lang.Class<?> clazz)
      Checks whether a class extends 'AutomaticBean', is non-abstract, and has a default constructor.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCheckstyleModules

        public static java.util.Set<java.lang.Class<?>> getCheckstyleModules​(java.util.Collection<java.lang.String> packages,
                                                                             java.lang.ClassLoader loader)
                                                                      throws java.io.IOException
        Gets checkstyle's modules (directly, not recursively) in the given packages.
        Parameters:
        packages - the collection of package names to use
        loader - the class loader used to load Checkstyle package names
        Returns:
        the set of checkstyle's module classes
        Throws:
        java.io.IOException - if the attempt to read class path resources failed
        See Also:
        isCheckstyleModule(Class)
      • isCheckstyleModule

        public static boolean isCheckstyleModule​(java.lang.Class<?> clazz)
        Checks whether a class may be considered as a checkstyle module. Checkstyle's modules are non-abstract classes, which are either checkstyle's checks, file sets, filters, file filters, TreeWalker filters, audit listener, or root module.
        Parameters:
        clazz - class to check.
        Returns:
        true if the class may be considered as the checkstyle module.
      • isValidCheckstyleClass

        public static boolean isValidCheckstyleClass​(java.lang.Class<?> clazz)
        Checks whether a class extends '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.
      • isCheckstyleTreeWalkerCheck

        public static boolean isCheckstyleTreeWalkerCheck​(java.lang.Class<?> clazz)
        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

        public static boolean isFileSetModule​(java.lang.Class<?> clazz)
        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

        public static boolean isFilterModule​(java.lang.Class<?> clazz)
        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

        public static boolean isFileFilterModule​(java.lang.Class<?> clazz)
        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

        public static boolean isAuditListener​(java.lang.Class<?> clazz)
        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

        public static boolean isRootModule​(java.lang.Class<?> clazz)
        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

        public static boolean isTreeWalkerFilterModule​(java.lang.Class<?> clazz)
        Checks whether a class may be considered as the checkstyle TreeWalker filter. Checkstyle's TreeWalker filters are classes which implement 'TreeWalkerFilter' interface.
        Parameters:
        clazz - class to check.
        Returns:
        true if a class may be considered as the checkstyle TreeWalker filter.