Class AbstractModelExporter
java.lang.Object
ca.mcscert.jpipe.visitor.AbstractModelExporter
- All Implemented Interfaces:
JustificationVisitor<Void>
- Direct Known Subclasses:
DotExporter, JsonExporter, PythonExporter
Abstract base for exporters that serialise a single
JustificationModel to text. Provides the common infrastructure shared
by all single-model exporters:
- A
StringBuilderaccumulator (builder) and the associated reset-before-export pattern. - A
currentModelNamefield populated from the model under export. - A
qualify(String)helper that prefixes element ids with the current model name ("modelName:elementId"). visit(Unit)— rejectsUnitwithUnsupportedOperationException; single-model exporters requireSelectModelto extract a model first.visit(Justification)andvisit(Template)— both delegate toexportModel(JustificationModel).
Subclasses implement exportModel(JustificationModel) to perform the
actual serialisation, setting currentModelName as their first
action. Element visit methods (visit(Conclusion), etc.) are left
abstract so each exporter controls its own output format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringBuilderAccumulates the serialised output.protected StringName of the model currently being exported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidexportModel(JustificationModel<?> model) Performs the actual serialisation ofmodel.protected final StringQualifieselementIdwith the current model name:"currentModelName:elementId".final Voidvisit(Justification justification) Delegates toexportModel(JustificationModel).final VoidDelegates toexportModel(JustificationModel).final VoidRejectsUnit— single-model exporters require a specific model.
-
Field Details
-
builder
Accumulates the serialised output. Reset at the start of each export. -
currentModelName
Name of the model currently being exported. Set byexportModel(JustificationModel)before any element visit methods are called.
-
-
Constructor Details
-
AbstractModelExporter
public AbstractModelExporter()
-
-
Method Details
-
qualify
-
visit
-
visit
Delegates toexportModel(JustificationModel).- Specified by:
visitin interfaceJustificationVisitor<Void>
-
visit
Delegates toexportModel(JustificationModel).- Specified by:
visitin interfaceJustificationVisitor<Void>
-
exportModel
Performs the actual serialisation ofmodel. Implementations must setcurrentModelName= model.getName()before calling any element visit methods.
-