com.fasterxml.jackson.databind.node

## Class ValueNode

- java.lang.Object
- - com.fasterxml.jackson.databind.JsonSerializable.Base
  - - com.fasterxml.jackson.databind.JsonNode
    - - com.fasterxml.jackson.databind.node.BaseJsonNode
      - - com.fasterxml.jackson.databind.node.ValueNode

- All Implemented Interfaces:
    com.fasterxml.jackson.core.TreeNode, JsonSerializable, java.lang.Iterable<JsonNode>
  Direct Known Subclasses:
    BinaryNode, BooleanNode, MissingNode, NullNode, NumericNode, POJONode, TextNode

      public abstract class ValueNode
      extends BaseJsonNode

  This intermediate base class is used for all leaf nodes, that is, all non-container (array or object) nodes, except for the "missing node".

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.JsonSerializable

      `JsonSerializable.Base`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ValueNode()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JsonNode` | `_at(com.fasterxml.jackson.core.JsonPointer ptr)`
    `abstract com.fasterxml.jackson.core.JsonToken` | `asToken()` Method that can be used for efficient type detection when using stream abstraction for traversing nodes.
    `<T extends JsonNode> T` | `deepCopy()` All current value nodes are immutable, so we can just return them as is.
    `ObjectNode` | `findParent(java.lang.String fieldName)` Method for finding a JSON Object that contains specified field, within this node or its descendants.
    `java.util.List<JsonNode>` | `findParents(java.lang.String fieldName, java.util.List<JsonNode> foundSoFar)`
    `JsonNode` | `findValue(java.lang.String fieldName)` Method for finding a JSON Object field with specified name in this node or its child nodes, and returning value it has.
    `java.util.List<JsonNode>` | `findValues(java.lang.String fieldName, java.util.List<JsonNode> foundSoFar)`
    `java.util.List<java.lang.String>` | `findValuesAsText(java.lang.String fieldName, java.util.List<java.lang.String> foundSoFar)`
    `JsonNode` | `get(int index)` Method for accessing value of the specified element of an array node.
    `JsonNode` | `get(java.lang.String fieldName)` Method for accessing value of the specified field of an object node.
    `boolean` | `has(int index)` Method that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.
    `boolean` | `has(java.lang.String fieldName)` Method that allows checking whether this node is JSON Object node and contains value for specified property.
    `boolean` | `hasNonNull(int index)` Method that is similar to `JsonNode.has(int)`, but that will return `false` for explicitly added nulls.
    `boolean` | `hasNonNull(java.lang.String fieldName)` Method that is similar to `JsonNode.has(String)`, but that will return `false` for explicitly added nulls.
    `JsonNode` | `path(int index)` This method is similar to `JsonNode.get(int)`, except that instead of returning null if no such element exists (due to index being out of range, or this node not being an array), a "missing node" (node that returns true for `JsonNode.isMissingNode()`) will be returned.
    `JsonNode` | `path(java.lang.String fieldName)` This method is similar to `JsonNode.get(String)`, except that instead of returning null if no such value exists (due to this node not being an object, or object not having value for the specified field), a "missing node" (node that returns true for `JsonNode.isMissingNode()`) will be returned.
    `void` | `serializeWithType(com.fasterxml.jackson.core.JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer)` Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.
    `java.lang.String` | `toString()` Method that will produce developer-readable representation of the node; which may or may not be as valid JSON.

    - ### Methods inherited from class com.fasterxml.jackson.databind.node.BaseJsonNode

      `findPath, hashCode, numberType, serialize, traverse, traverse`

    - ### Methods inherited from class com.fasterxml.jackson.databind.JsonNode

      `asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, asText, at, at, bigIntegerValue, binaryValue, booleanValue, canConvertToInt, canConvertToLong, decimalValue, doubleValue, elements, equals, equals, fieldNames, fields, findParents, findValues, findValuesAsText, floatValue, getNodeType, intValue, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isShort, isTextual, isValueNode, iterator, longValue, numberValue, shortValue, size, textValue, with, withArray`

    - ### Methods inherited from class com.fasterxml.jackson.databind.JsonSerializable.Base

      `isEmpty`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ValueNode

          protected ValueNode()

  - ### Method Detail

    - #### _at

          protected JsonNode _at(com.fasterxml.jackson.core.JsonPointer ptr)

      Specified by:
        `_at` in class `JsonNode`

    - #### deepCopy

          public <T extends JsonNode> T deepCopy()

      All current value nodes are immutable, so we can just return them as is.
      Specified by:
        `deepCopy` in class `JsonNode`
      Returns:
        Node that is either a copy of this node (and all non-leaf children); or, for immutable leaf nodes, node itself.

    - #### asToken

          public abstract com.fasterxml.jackson.core.JsonToken asToken()

      Description copied from class: `BaseJsonNode`
      Method that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the first `JsonToken` that equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)
      Specified by:
        `asToken` in interface `com.fasterxml.jackson.core.TreeNode`
      Specified by:
        `asToken` in class `BaseJsonNode`

    - #### serializeWithType

          public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator jg,
                               SerializerProvider provider,
                               TypeSerializer typeSer)
                                 throws java.io.IOException,
                                        com.fasterxml.jackson.core.JsonProcessingException

      Description copied from class: `BaseJsonNode`
      Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.
      Specified by:
        `serializeWithType` in interface `JsonSerializable`
      Specified by:
        `serializeWithType` in class `BaseJsonNode`
      Throws:
        `java.io.IOException`
        `com.fasterxml.jackson.core.JsonProcessingException`

    - #### toString

          public java.lang.String toString()

      Description copied from class: `JsonNode`
      Method that will produce developer-readable representation of the node; which may or may not be as valid JSON. If you want valid JSON output (or output formatted using one of other Jackson supported data formats) make sure to use `ObjectMapper` or `ObjectWriter` to serialize an instance, for example:

             String json = objectMapper.writeValueAsString(rootNode);

      Note: method defined as abstract to ensure all implementation classes explicitly implement method, instead of relying on `Object.toString()` definition.

      Specified by:
        `toString` in class `JsonNode`

    - #### get

          public final JsonNode get(int index)

      Description copied from class: `JsonNode`
      Method for accessing value of the specified element of an array node. For other nodes, null is always returned.

      For array nodes, index specifies exact location within array and allows for efficient iteration over child elements (underlying storage is guaranteed to be efficiently indexable, i.e. has random-access to elements). If index is less than 0, or equal-or-greater than `node.size()`, null is returned; no exception is thrown for any index.

      NOTE: if the element value has been explicitly set as `null` (which is different from removal!), a `NullNode` will be returned, not null.

      Specified by:
        `get` in interface `com.fasterxml.jackson.core.TreeNode`
      Specified by:
        `get` in class `JsonNode`
      Returns:
        Node that represent value of the specified element, if this node is an array and has specified element. Null otherwise.

    - #### path

          public final JsonNode path(int index)

      Description copied from class: `JsonNode`
      This method is similar to `JsonNode.get(int)`, except that instead of returning null if no such element exists (due to index being out of range, or this node not being an array), a "missing node" (node that returns true for `JsonNode.isMissingNode()`) will be returned. This allows for convenient and safe chained access via path calls.
      Specified by:
        `path` in interface `com.fasterxml.jackson.core.TreeNode`
      Specified by:
        `path` in class `JsonNode`

    - #### has

          public final boolean has(int index)

      Description copied from class: `JsonNode`
      Method that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.

      Note: array element indexes are 0-based.

      This method is equivalent to:

             node.get(index) != null

      NOTE: this method will return `true` for explicitly added null values.

      Overrides:
        `has` in class `JsonNode`
      Parameters:
        `index` - Index to check
      Returns:
        True if this node is a JSON Object node, and has a property entry with specified name (with any value, including null value)

    - #### hasNonNull

          public final boolean hasNonNull(int index)

      Description copied from class: `JsonNode`
      Method that is similar to `JsonNode.has(int)`, but that will return `false` for explicitly added nulls.

      This method is equivalent to:

             node.get(index) != null << !node.get(index).isNull()

      Overrides:
        `hasNonNull` in class `JsonNode`

    - #### get

          public final JsonNode get(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      Method for accessing value of the specified field of an object node. If this node is not an object (or it does not have a value for specified field name), or if there is no field with such name, null is returned.

      NOTE: if the property value has been explicitly set as `null` (which is different from removal!), a `NullNode` will be returned, not null.

      Specified by:
        `get` in interface `com.fasterxml.jackson.core.TreeNode`
      Overrides:
        `get` in class `JsonNode`
      Returns:
        Node that represent value of the specified field, if this node is an object and has value for the specified field. Null otherwise.

    - #### path

          public final JsonNode path(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      This method is similar to `JsonNode.get(String)`, except that instead of returning null if no such value exists (due to this node not being an object, or object not having value for the specified field), a "missing node" (node that returns true for `JsonNode.isMissingNode()`) will be returned. This allows for convenient and safe chained access via path calls.
      Specified by:
        `path` in interface `com.fasterxml.jackson.core.TreeNode`
      Specified by:
        `path` in class `JsonNode`

    - #### has

          public final boolean has(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      Method that allows checking whether this node is JSON Object node and contains value for specified property. If this is the case (including properties with explicit null values), returns true; otherwise returns false.

      This method is equivalent to:

             node.get(fieldName) != null

      (since return value of get() is node, not value node contains)

      NOTE: when explicit `null` values are added, this method will return `true` for such properties.

      Overrides:
        `has` in class `JsonNode`
      Parameters:
        `fieldName` - Name of element to check
      Returns:
        True if this node is a JSON Object node, and has a property entry with specified name (with any value, including null value)

    - #### hasNonNull

          public final boolean hasNonNull(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      Method that is similar to `JsonNode.has(String)`, but that will return `false` for explicitly added nulls.

      This method is functionally equivalent to:

             node.get(fieldName) != null << !node.get(fieldName).isNull()

      Overrides:
        `hasNonNull` in class `JsonNode`

    - #### findValue

          public final JsonNode findValue(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      Method for finding a JSON Object field with specified name in this node or its child nodes, and returning value it has. If no matching field is found in this node or its descendants, returns null.
      Specified by:
        `findValue` in class `JsonNode`
      Parameters:
        `fieldName` - Name of field to look for
      Returns:
        Value of first matching node found, if any; null if none

    - #### findParent

          public final ObjectNode findParent(java.lang.String fieldName)

      Description copied from class: `JsonNode`
      Method for finding a JSON Object that contains specified field, within this node or its descendants. If no matching field is found in this node or its descendants, returns null.
      Specified by:
        `findParent` in class `JsonNode`
      Parameters:
        `fieldName` - Name of field to look for
      Returns:
        Value of first matching node found, if any; null if none

    - #### findValues

          public final java.util.List<JsonNode> findValues(java.lang.String fieldName,
                                            java.util.List<JsonNode> foundSoFar)

      Specified by:
        `findValues` in class `JsonNode`

    - #### findValuesAsText

          public final java.util.List<java.lang.String> findValuesAsText(java.lang.String fieldName,
                                                          java.util.List<java.lang.String> foundSoFar)

      Specified by:
        `findValuesAsText` in class `JsonNode`

    - #### findParents

          public final java.util.List<JsonNode> findParents(java.lang.String fieldName,
                                             java.util.List<JsonNode> foundSoFar)

      Specified by:
        `findParents` in class `JsonNode`