Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.node

public abstract Class ContainerNode<T extends ContainerNode<T>>

extends BaseJsonNode
implements JsonNodeCreator
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.databind.node.JsonNodeCreator
Known Direct Subclasses
com.fasterxml.jackson.databind.node.ObjectNode, com.fasterxml.jackson.databind.node.ArrayNode
Imports
java.math.BigDecimal, .BigInteger, com.fasterxml.jackson.core.*, com.fasterxml.jackson.databind.JsonNode, com.fasterxml.jackson.databind.util.RawValue

This intermediate base class is used for all container nodes, specifically, array and object nodes.

Field Summary

Modifier and TypeField and Description
protected final JsonNodeFactory
_nodeFactory

We will keep a reference to the Object (usually TreeMapper) that can construct instances of nodes to add to this container node.

private static final long

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract ObjectNode
public final ArrayNode
arrayNode()

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.arrayNode.

Factory method that constructs and returns an empty ArrayNode Construction is done using registered JsonNodeFactory.

public final ArrayNode
arrayNode(int
the initial capacity of the ArrayNode
capacity
)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.arrayNode.

Factory method that constructs and returns an ArrayNode with an initial capacity Construction is done using registered JsonNodeFactory

public String
asText()

Implements abstract com.fasterxml.jackson.databind.JsonNode.asText.

Method that will return a valid String representation of the container value, if the node is a value node (method isValueNode returns true), otherwise empty String.

public abstract JsonToken
asToken()

Redeclares com.fasterxml.jackson.core.TreeNode.asToken.

Implements abstract com.fasterxml.jackson.databind.node.BaseJsonNode.asToken.

Method that can be used for efficient type detection when using stream abstraction for traversing nodes.

public final BinaryNode
public final BinaryNode
binaryNode(byte[] data, int offset, int length)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.binaryNode.

public final BooleanNode
public abstract JsonNode
get(int
Index of the Array node element to access
index
)

Redeclares com.fasterxml.jackson.core.TreeNode.get.

Implements abstract com.fasterxml.jackson.databind.JsonNode.get.

Method for accessing value of the specified element of an array node.

public abstract JsonNode
get(String
Name of the field (of Object node) to access
fieldName
)

Redeclares com.fasterxml.jackson.core.TreeNode.get.

Overrides com.fasterxml.jackson.databind.JsonNode.get.

Method for accessing value of the specified field of an object node.

public JsonNode
public final NullNode
public final NumericNode
public final NumericNode
public final NumericNode
public final NumericNode
public final NumericNode
public final NumericNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ValueNode
public final ObjectNode
objectNode()

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.objectNode.

Factory method that constructs and returns an empty ObjectNode Construction is done using registered JsonNodeFactory.

public final ValueNode
public final ValueNode
rawValueNode(RawValue value)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.rawValueNode.

Factory method to use for adding "raw values"; pre-encoded values that are included exactly as-is when node is serialized.

public abstract T

Returns:

Container node itself (to allow method call chaining)
removeAll
()

Method for removing all children container has (if any)

public abstract int
size()

Redeclares com.fasterxml.jackson.core.TreeNode.size.

Overrides com.fasterxml.jackson.databind.JsonNode.size.

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.

public final TextNode
Inherited from com.fasterxml.jackson.databind.node.BaseJsonNode:
_bigIntFromBigDec_jsonPointerIfValid_reportWrongNodeOperation_reportWrongNodeType_withArray_withXxxMayReplace_withXxxVerifyReplacefindPathhashCodenumberTyperequiredrequiredserializeserializeWithTypetoPrettyStringtoStringtraversetraversewithArraywithObject

Field Detail

_nodeFactoryback to summary
protected final JsonNodeFactory _nodeFactory

We will keep a reference to the Object (usually TreeMapper) that can construct instances of nodes to add to this container node.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.node.BaseJsonNode.serialVersionUID.

Constructor Detail

ContainerNodeback to summary
protected ContainerNode(JsonNodeFactory nc)
ContainerNodeback to summary
protected ContainerNode()

Method Detail

_withObjectback to summary
protected abstract ObjectNode _withObject(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex)

Overrides com.fasterxml.jackson.databind.node.BaseJsonNode._withObject.

Annotations
@Override
arrayNodeback to summary
public final ArrayNode arrayNode()

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.arrayNode.

Factory method that constructs and returns an empty ArrayNode Construction is done using registered JsonNodeFactory.

Annotations
@Override
arrayNodeback to summary
public final ArrayNode arrayNode(int capacity)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.arrayNode.

Factory method that constructs and returns an ArrayNode with an initial capacity Construction is done using registered JsonNodeFactory

Parameters
capacity:int

the initial capacity of the ArrayNode

Annotations
@Override
asTextback to summary
public String asText()

Implements abstract com.fasterxml.jackson.databind.JsonNode.asText.

Doc from com.fasterxml.jackson.databind.JsonNode.asText.

Method that will return a valid String representation of the container value, if the node is a value node (method isValueNode returns true), otherwise empty String.

Annotations
@Override
asTokenback to summary
public abstract JsonToken asToken()

Redeclares com.fasterxml.jackson.core.TreeNode.asToken.

Implements abstract com.fasterxml.jackson.databind.node.BaseJsonNode.asToken.

Doc from com.fasterxml.jackson.databind.node.BaseJsonNode.asToken.

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)

Returns:JsonToken

Doc from com.fasterxml.jackson.core.TreeNode.asToken.

JsonToken that is most closely associated with the node type

Annotations
@Override
binaryNodeback to summary
public final BinaryNode binaryNode(byte[] data)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.binaryNode.

Annotations
@Override
binaryNodeback to summary
public final BinaryNode binaryNode(byte[] data, int offset, int length)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.binaryNode.

Annotations
@Override
booleanNodeback to summary
public final BooleanNode booleanNode(boolean v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.booleanNode.

Annotations
@Override
getback to summary
public abstract JsonNode get(int index)

Redeclares com.fasterxml.jackson.core.TreeNode.get.

Implements abstract com.fasterxml.jackson.databind.JsonNode.get.

Doc from com.fasterxml.jackson.databind.JsonNode.get.

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 com.fasterxml.jackson.databind.node.NullNode will be returned, not null.

Parameters
index:int

Doc from com.fasterxml.jackson.core.TreeNode.get.

Index of the Array node element to access

Returns:JsonNode

Node that represent value of the specified element, if this node is an array and has specified element. Null otherwise.

Annotations
@Override
getback to summary
public abstract JsonNode get(String fieldName)

Redeclares com.fasterxml.jackson.core.TreeNode.get.

Overrides com.fasterxml.jackson.databind.JsonNode.get.

Doc from com.fasterxml.jackson.databind.JsonNode.get.

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 com.fasterxml.jackson.databind.node.NullNode will be returned, not null.

Parameters
fieldName:String

Doc from com.fasterxml.jackson.core.TreeNode.get.

Name of the field (of Object node) to access

Returns:JsonNode

Node that represent value of the specified field, if this node is an object and has value for the specified field. Null otherwise.

Annotations
@Override
missingNodeback to summary
public JsonNode missingNode()
nullNodeback to summary
public final NullNode nullNode()

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.nullNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(byte v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(short v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(int v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(long v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(float v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final NumericNode numberNode(double v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(BigInteger v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(BigDecimal v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Byte v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Short v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Integer v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Long v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Float v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
numberNodeback to summary
public final ValueNode numberNode(Double v)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.numberNode.

Annotations
@Override
objectNodeback to summary
public final ObjectNode objectNode()

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.objectNode.

Factory method that constructs and returns an empty ObjectNode Construction is done using registered JsonNodeFactory.

Annotations
@Override
pojoNodeback to summary
public final ValueNode pojoNode(Object pojo)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.pojoNode.

Annotations
@Override
rawValueNodeback to summary
public final ValueNode rawValueNode(RawValue value)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.rawValueNode.

Doc from com.fasterxml.jackson.databind.node.JsonNodeCreator.rawValueNode.

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.

Annotations
@Override
removeAllback to summary
public abstract T removeAll()

Method for removing all children container has (if any)

Returns:T

Container node itself (to allow method call chaining)

sizeback to summary
public abstract int size()

Redeclares com.fasterxml.jackson.core.TreeNode.size.

Overrides com.fasterxml.jackson.databind.JsonNode.size.

Doc from com.fasterxml.jackson.core.TreeNode.size.

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.

Returns:int

For non-container nodes returns 0; for arrays number of contained elements, and for objects number of fields.

Annotations
@Override
textNodeback to summary
public final TextNode textNode(String text)

Implements com.fasterxml.jackson.databind.node.JsonNodeCreator.textNode.

Annotations
@Override