Class ContainerNode<T extends ContainerNode<T>>

    • Method Detail

      • asToken

        public abstract 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 TreeNode
        Specified by:
        asToken in class BaseJsonNode
        Returns:
        JsonToken that is most closely associated with the node type
      • asText

        public java.lang.String asText()
        Description copied from class: JsonNode
        Method that will return a valid String representation of the container value, if the node is a value node (method JsonNode.isValueNode() returns true), otherwise empty String.
        Specified by:
        asText in class JsonNode
      • size

        public abstract int size()
        Description copied from interface: TreeNode
        Method that returns number of child nodes this node contains: for Array nodes, number of child elements, for Object nodes, number of fields, and for all other nodes 0.
        Specified by:
        size in interface TreeNode
        Overrides:
        size in class JsonNode
        Returns:
        For non-container nodes returns 0; for arrays number of contained elements, and for objects number of fields.
      • get

        public abstract 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 TreeNode
        Specified by:
        get in class JsonNode
        Parameters:
        index - Index of the Array node element to access
        Returns:
        Node that represent value of the specified element, if this node is an array and has specified element. Null otherwise.
      • get

        public abstract 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 TreeNode
        Overrides:
        get in class JsonNode
        Parameters:
        fieldName - Name of the field (of Object node) to access
        Returns:
        Node that represent value of the specified field, if this node is an object and has value for the specified field. Null otherwise.
      • missingNode

        public JsonNode missingNode()
      • arrayNode

        public final ArrayNode arrayNode​(int capacity)
        Factory method that constructs and returns an ArrayNode with an initial capacity Construction is done using registered JsonNodeFactory
        Specified by:
        arrayNode in interface JsonNodeCreator
        Parameters:
        capacity - the initial capacity of the ArrayNode
      • rawValueNode

        public final ValueNode rawValueNode​(RawValue value)
        Description copied from interface: JsonNodeCreator
        Factory method to use for adding "raw values"; pre-encoded values that are included exactly as-is when node is serialized. This may be used, for example, to include fully serialized JSON sub-trees. Note that the concept may not work with all backends, and since no translation of any kinds is done it will not work when converting between data formats.
        Specified by:
        rawValueNode in interface JsonNodeCreator
      • removeAll

        public abstract T removeAll()
        Method for removing all children container has (if any)
        Returns:
        Container node itself (to allow method call chaining)