Class CompositeChecker<O>

  • Type Parameters:
    O - The checked object type.
    All Implemented Interfaces:
    cdc.util.debug.Printable

    public class CompositeChecker<O>
    extends AbstractChecker<O>
    Specialization of AbstractChecker that aggregates checkers dedicated to the same object type.

    This checker does nothing by itself, it delegates checks to its components.

    Author:
    Damien Carbonne
    • Constructor Detail

      • CompositeChecker

        public CompositeChecker​(SnapshotManager manager,
                                Class<O> objectClass)
        Creates an empty composite checker.
        Parameters:
        manager - The manager.
        objectClass - The object class.
      • CompositeChecker

        @SafeVarargs
        public CompositeChecker​(SnapshotManager manager,
                                Class<O> objectClass,
                                AbstractChecker<? super O>... components)
        Creates a composite checker with some components.
        Parameters:
        manager - The manager.
        objectClass - The object class.
        components - The components (checkers).
    • Method Detail

      • add

        protected CompositeChecker<O> add​(AbstractChecker<? super O> component)
        Add a component checker to this composite checker.
        Parameters:
        component - The component checker.
        Returns:
        This composite checker.
      • getComponents

        public final List<AbstractChecker<? super O>> getComponents()
        Returns:
        The components.
      • isEnabled

        public final boolean isEnabled()
        Specified by:
        isEnabled in class AbstractChecker<O>
        Returns:
        true if this checker is enabled.
      • check

        public final CheckResult check​(CheckContext context,
                                       O object,
                                       Location location)
        Description copied from class: AbstractChecker
        Method that must be specialized to check an object.

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

        Specified by:
        check in class AbstractChecker<O>
        Parameters:
        context - The context.
        object - The object to check.
        location - The object location.
        Returns:
        The check result.
      • print

        public void print​(PrintStream out,
                          int level)