Class Checker<I>

java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<I,I>
ca.mcscert.jpipe.compiler.model.Checker<I>
Type Parameters:
I - the type being checked.
Direct Known Subclasses:
CompletenessChecker, ConsistencyChecker, HaltAndCatchFire

public abstract class Checker<I> extends Transformation<I,I>
An idempotent pipeline step: inspects the value without modifying it.

Subclasses implement check(I, CompilationContext). The run(I, CompilationContext) implementation delegates to check and returns the input unchanged, enforcing idempotency by construction.

Checks may report non-fatal diagnostics via ctx rather than throwing, allowing the pipeline to accumulate multiple errors before deciding whether to abort.

  • Constructor Details

    • Checker

      public Checker()
  • Method Details

    • checking

      public static <I> Checker<I> checking(Checker.Check<I> check)
      Create a Checker from a lambda or method reference.
    • run

      protected final I run(I input, CompilationContext ctx)
      Description copied from class: Transformation
      Business logic of this step. Must not return null; may throw any exception. Use ctx to report non-fatal diagnostics or inspect previously accumulated errors.
      Specified by:
      run in class Transformation<I,I>
      Parameters:
      input - the value produced by the previous step.
      ctx - compilation context carrying the source path and diagnostic bag.
      Returns:
      the transformed value — never null.
    • check

      protected abstract void check(I input, CompilationContext ctx)
      Perform the check. Must not modify input. Non-fatal issues should be reported via ctx.error() rather than thrown; throw (or call ctx.fatal()) only for unrecoverable failures.
      Parameters:
      input - the value to inspect.
      ctx - compilation context for reporting diagnostics.