Class JacksonNode

java.lang.Object
org.junitpioneer.jupiter.json.JacksonNode
All Implemented Interfaces:
Node

class JacksonNode extends Object implements Node
A Node implementation for Jackson 2.
  • Field Details

    • objectMapper

      private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • node

      private final com.fasterxml.jackson.databind.JsonNode node
  • Constructor Details

    • JacksonNode

      JacksonNode(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode node)
  • Method Details

    • isArray

      public boolean isArray()
      Specified by:
      isArray in interface Node
      Returns:
      true if the node represents an array of other nodes
    • elements

      public Stream<Node> elements()
      Specified by:
      elements in interface Node
      Returns:
      all the elements of this potential array node
    • toType

      public <T> T toType(Type type)
      Description copied from interface: Node
      Convert this node into the requested type
      Specified by:
      toType in interface Node
      Type Parameters:
      T - the type
      Parameters:
      type - the type into which this node needs to be converted
      Returns:
      the converted type
    • getNode

      public Optional<Node> getNode(String name)
      Description copied from interface: Node
      Get the node value with the given name.
      Specified by:
      getNode in interface Node
      Parameters:
      name - the name of the node
      Returns:
      the node for the given name
    • value

      public Object value(Type typeHint)
      Description copied from interface: Node
      Get the value of the node.
      Specified by:
      value in interface Node
      Parameters:
      typeHint - the potential type of the value
      Returns:
      the node value
    • toString

      public String toString()
      Overrides:
      toString in class Object