Class JacksonNode

  • All Implemented Interfaces:
    Node

    class JacksonNode
    extends java.lang.Object
    implements Node
    A Node implementation for Jackson 2.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private com.fasterxml.jackson.databind.JsonNode node  
      private com.fasterxml.jackson.databind.ObjectMapper objectMapper  
    • Constructor Summary

      Constructors 
      Constructor Description
      JacksonNode​(com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.JsonNode node)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.stream.Stream<Node> elements()  
      java.util.Optional<Node> getNode​(java.lang.String name)
      Get the node value with the given name.
      boolean isArray()  
      java.lang.String toString()  
      <T> T toType​(java.lang.reflect.Type type)
      Convert this node into the requested type
      java.lang.Object value​(java.lang.reflect.Type typeHint)
      Get the value of the node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • objectMapper

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

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

      • JacksonNode

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

      • isArray

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

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

        public <T> T toType​(java.lang.reflect.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 java.util.Optional<Node> getNode​(java.lang.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 java.lang.Object value​(java.lang.reflect.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object