Class JsonFragment

java.lang.Object
com.northconcepts.datapipeline.json.builder.JsonNode
com.northconcepts.datapipeline.json.builder.JsonFragment
Direct Known Subclasses:
JsonConditionalNode, JsonDetailMarker, JsonTemplate

public class JsonFragment extends JsonNode
Base class for template nodes that write only their children, not JSON of their own, and take their type from the parent node.
  • Constructor Details

    • JsonFragment

      public JsonFragment(JsonNode parentNode)
  • Method Details

    • getParentNode

      public JsonNode getParentNode()
    • getType

      public JsonNodeType getType()
      Description copied from class: JsonNode
      Returns the kind of JSON this node represents, which determines the child nodes it accepts.
      Specified by:
      getType in class JsonNode
    • writeStartImpl

      protected void writeStartImpl(ExpressionContext context, com.fasterxml.jackson.core.JsonGenerator generator) throws Throwable
      Description copied from class: JsonNode
      Writes this node's opening output, if any: a start-object or start-array token, a field name or a scalar value.
      Specified by:
      writeStartImpl in class JsonNode
      Throws:
      Throwable
    • writeEndImpl

      protected void writeEndImpl(ExpressionContext context, com.fasterxml.jackson.core.JsonGenerator generator) throws Throwable
      Description copied from class: JsonNode
      Writes this node's closing output, if any (such as an end-object or end-array token), after its children.
      Specified by:
      writeEndImpl in class JsonNode
      Throws:
      Throwable
    • when

      public JsonConditionalNode when(String condition)
      Description copied from class: JsonNode
      Adds and returns a fragment whose nodes are written only when the given logical expression is true.
      Overrides:
      when in class JsonNode
    • detail

      public JsonDetailMarker detail()
      Description copied from class: JsonNode
      Adds and returns the detail marker; the nodes added to it are written once for each record.
      Overrides:
      detail in class JsonNode
    • exception

      protected DataException exception(Throwable e)
      Description copied from class: JsonNode
      Wraps the throwable in a DataException with this node's type, class and children; subclasses add their own details.
      Overrides:
      exception in class JsonNode