Class AbstractChecker<O>

    • Constructor Detail

      • AbstractChecker

        protected AbstractChecker​(SnapshotManager manager,
                                  Class<O> objectClass)
        Create a checker.
        Parameters:
        manager - The manager.
        objectClass - The object class.
    • Method Detail

      • getObjectClass

        public final Class<O> getObjectClass()
        Returns:
        The class of checked objects.
      • isEnabled

        public abstract boolean isEnabled()
        Returns:
        true if this checker is enabled.
      • addStat

        protected final void addStat​(Location location,
                                     CheckResult result)
        Add statistics entry.
        Parameters:
        location - The checked object.
        result - The check result.
      • accepts

        public boolean accepts​(O object)
        Returns true if the passed object must be checked.

        A check may be applied to an object only if some conditions are met.
        This may be overridden to define such conditions.
        The default implementation always returns true.

        Parameters:
        object - The object to test.
        Returns:
        true if this checker accepts object.
      • check

        public abstract CheckResult check​(CheckContext context,
                                          O object,
                                          Location location)
        Method that must be specialized to check an object.

        It is this method responsibility to store detected issues into the associated manager.

        Parameters:
        context - The context.
        object - The object to check.
        location - The object location.
        Returns:
        The check result.