Class JsonTemplate
java.lang.Object
com.northconcepts.datapipeline.json.builder.JsonNode
com.northconcepts.datapipeline.json.builder.JsonFragment
com.northconcepts.datapipeline.json.builder.JsonTemplate
Describes the JSON a
JsonWriter produces: nodes before the JsonFragment.detail() marker form the header, the
marker's nodes are written once per record and the remaining nodes form the footer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarray()Adds an anonymous array element and returns it; only arrays (and the template root) accept one.voidbuildDetail(Record record, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) Writes the detail marker's nodes for the given record; throws aDataExceptionifbuildHeader(JsonGenerator)found no detail marker.voidbuildFooter(com.fasterxml.jackson.core.JsonGenerator jsonGenerator) Writes the nodes after the detail marker, closing the objects and arrays the header opened.voidbuildHeader(com.fasterxml.jackson.core.JsonGenerator jsonGenerator) Writes the nodes that come before the detail marker; call it once before writing records.object()Adds an anonymous object element and returns it; only arrays (and the template root) accept one.voidSets a named value that the template's expressions, including per-record ones, can reference.voidSets a named value of the given type that the template's expressions, including per-record ones, can reference.Methods inherited from class com.northconcepts.datapipeline.json.builder.JsonFragment
detail, exception, getParentNode, getType, when, writeEndImpl, writeStartImpl
-
Constructor Details
-
JsonTemplate
public JsonTemplate()
-
-
Method Details
-
setValue
Sets a named value that the template's expressions, including per-record ones, can reference. -
setValue
Sets a named value of the given type that the template's expressions, including per-record ones, can reference. -
buildHeader
Writes the nodes that come before the detail marker; call it once before writing records.- Throws:
IOException
-
buildDetail
public void buildDetail(Record record, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException Writes the detail marker's nodes for the given record; throws aDataExceptionifbuildHeader(JsonGenerator)found no detail marker.- Throws:
IOException
-
object
Description copied from class:JsonNodeAdds an anonymous object element and returns it; only arrays (and the template root) accept one. -
array
Description copied from class:JsonNodeAdds an anonymous array element and returns it; only arrays (and the template root) accept one.
-