Class DiagnosticRenderer
java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<DiagnosticSnapshot, String>
ca.mcscert.jpipe.compiler.steps.transformations.DiagnosticRenderer
- Direct Known Subclasses:
DiagnosticReport, JsonDiagnosticReport
Common base of the
diagnostic command's renderers.
Rendering is exposed as render(DiagnosticSnapshot), callable
directly and not only as a pipeline step. That is what lets a compilation
which aborted still be reported on: a fatal diagnostic stops the pipeline at
the next Transformation.fire(I, CompilationContext) boundary (ADR-0016), so a report that
could only be produced as a step could never describe the very failures it
exists to report.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Transformation
Transformation.Step<I,O> -
Field Summary
Fields inherited from class Transformation
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Stringrender(DiagnosticSnapshot snapshot) Renders a snapshot into the report text.protected final Stringrun(DiagnosticSnapshot input, CompilationContext ctx) Business logic of this step.
-
Constructor Details
-
DiagnosticRenderer
public DiagnosticRenderer()
-
-
Method Details
-
render
Renders a snapshot into the report text.- Parameters:
snapshot- what the compilation produced and reported.- Returns:
- the rendered report.
-
run
Description copied from class:TransformationBusiness logic of this step. Must not returnnull; may throw any exception. Usectxto report non-fatal diagnostics or inspect previously accumulated errors.- Specified by:
runin classTransformation<DiagnosticSnapshot, String>- 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.
-