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

public Class ArrayNode

extends ContainerNode<ArrayNode>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.IOException, java.math.BigDecimal, .BigInteger, java.util.*, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.type.WritableTypeId, com.fasterxml.jackson.databind.JsonNode, .SerializerProvider, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.util.RawValue

Node class that represents Arrays mapped from JSON content.

Note

class was final temporarily for Jackson 2.2.

Field Summary

Modifier and TypeField and Description
private final List<JsonNode>
private static final long
Inherited from com.fasterxml.jackson.databind.node.ContainerNode:
_nodeFactory

Constructor Summary

AccessConstructor and Description
public
public
ArrayNode(JsonNodeFactory nf, int capacity)

public

Method Summary

Modifier and TypeMethod and Description
protected ArrayNode
_add(JsonNode node)

protected JsonNode
_at(JsonPointer
Path expression to use
ptr
)

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

Helper method used by other methods for traversing the next step of given path expression, and returning matching value node if any: if no match, null is returned.

protected boolean
protected ArrayNode
_insert(int index, JsonNode node)

protected ArrayNode
_set(int index, JsonNode node)

protected ArrayNode
protected ArrayNode
_withArrayAddTailElement(JsonPointer tail, boolean preferIndex)

protected ObjectNode
_withObject(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex)

Implements abstract com.fasterxml.jackson.databind.node.ContainerNode._withObject.

protected ObjectNode
_withObjectAddTailElement(JsonPointer tail, boolean preferIndex)

protected void
public ArrayNode

Returns:

This node, to allow chaining
add
(JsonNode value)

Method for adding specified node at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(short v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Short v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(int v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Integer v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(long v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Long v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(float v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Float v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(double v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Double v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(BigDecimal v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(BigInteger v)

Method for adding specified number at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(String v)

Method for adding specified String value at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(boolean v)

Method for adding specified boolean value at the end of this array.

public ArrayNode

Returns:

This array node, to allow chaining
add
(Boolean v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
add
(byte[] v)

Method for adding specified binary value at the end of this array (note: when serializing as JSON, will be output Base64 encoded)

public ArrayNode

Returns:

This node (to allow chaining)
addAll
(ArrayNode
Array to add contents from
other
)

Method for adding all child nodes of given Array, appending to child nodes this array contains

public ArrayNode

Returns:

This node (to allow chaining)
addAll
(Collection<? extends JsonNode>
Nodes to add
nodes
)

Method for adding given nodes as child nodes of this array node.

public ArrayNode

Returns:

Newly constructed ArrayNode (NOTE: NOT `this` ArrayNode)
addArray
()

Method that will construct an ArrayNode and add it at the end of this array node.

public ArrayNode

Returns:

This array node, to allow chaining
addNull
()

Method that will add a null value at the end of this array node.

public ObjectNode

Returns:

Newly constructed ObjectNode (NOTE: NOT `this` ArrayNode)
addObject
()

Method that will construct an ObjectNode and add it at the end of this array node.

public ArrayNode

Returns:

This array node, to allow chaining
addPOJO
(Object pojo)

Method that will construct a POJONode and add it at the end of this array node.

public ArrayNode

Returns:

This array node, to allow chaining
addRawValue
(RawValue raw)

public JsonToken
asToken()

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

Implements com.fasterxml.jackson.core.TreeNode.asToken.

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

public ArrayNode
deepCopy()

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

Method that can be called to get a node that is guaranteed not to allow changing of this node through mutators on this node or any of its children.

public Iterator<JsonNode>
elements()

Overrides com.fasterxml.jackson.databind.JsonNode.elements.

Method for accessing all value nodes of this Node, iff this node is a JSON Array or Object node.

public boolean
equals(Comparator<JsonNode>
Object called to compare two scalar JsonNode instances, and return either 0 (are equals) or non-zero (not equal)
comparator
,
JsonNode o)

Overrides com.fasterxml.jackson.databind.JsonNode.equals.

Entry method for invoking customizable comparison, using passed-in Comparator object.

public boolean
equals(Object
the reference object with which to compare.
o
)

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

Equality for node objects is defined as full (deep) value equality.

public ObjectNode
findParent(String
Name of field to look for
fieldName
)

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

Method for finding a JSON Object that contains specified field, within this node or its descendants.

public List<JsonNode>
public JsonNode
findValue(String
Name of field to look for
fieldName
)

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

Method for finding the first JSON Object field with specified name in this node or its child nodes, and returning value it has.

public List<JsonNode>
public List<String>
public JsonNode
get(int
Index of the Array node element to access
index
)

Implements abstract com.fasterxml.jackson.databind.node.ContainerNode.get.

Implements com.fasterxml.jackson.core.TreeNode.get.

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

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

Implements abstract com.fasterxml.jackson.databind.node.ContainerNode.get.

Implements com.fasterxml.jackson.core.TreeNode.get.

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

public JsonNodeType
getNodeType()

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

Return the type of this node

public int
hashCode()

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

Returns a hash code value for this object.

public ArrayNode

Returns:

This node (to allow chaining)
insert
(int index, JsonNode value)

Method for inserting specified child node as an element of this Array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, short v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Short value)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, int v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Integer v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, long v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Long v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, float v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Float v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, double v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Double v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, BigDecimal v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, BigInteger v)

Method that will insert specified numeric value at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, String v)

Method that will insert specified String at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, boolean v)

Method that will insert specified String at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, Boolean value)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This array node, to allow chaining
insert
(int index, byte[] v)

Method that will insert specified binary value at specified position in this array (note: when written as JSON, will be Base64 encoded)

public ArrayNode

Returns:

Newly constructed ArrayNode (note! NOT `this` ArrayNode)
insertArray
(int index)

Method for creating an array node, inserting it at the specified point in the array, and returning the newly created array (note: NOT 'this' array)

public ArrayNode

Returns:

This array node, to allow chaining
insertNull
(int index)

Method that will insert a null value at specified position in this array.

public ObjectNode

Returns:

Newly constructed ObjectNode (note! NOT `this` ArrayNode)
insertObject
(int index)

Method for creating an ObjectNode, appending it at the end of this array, and returning the newly created node (note: NOT 'this' array)

public ArrayNode

Returns:

This array node, to allow chaining
insertPOJO
(int index, Object pojo)

Method that will construct a POJONode and insert it at specified position in this array.

public ArrayNode

Returns:

This array node, to allow chaining
insertRawValue
(int index, RawValue raw)

public boolean
isArray()

Overrides com.fasterxml.jackson.databind.JsonNode.isArray.

Implements com.fasterxml.jackson.core.TreeNode.isArray.

Method that returns true if this node is an Array node, false otherwise.

public boolean
isEmpty(SerializerProvider serializers)

Overrides com.fasterxml.jackson.databind.JsonSerializable.Base.isEmpty.

Method that may be called on instance to determine if it is considered "empty" for purposes of serialization filtering or not.

public boolean
isEmpty()

Overrides com.fasterxml.jackson.databind.JsonNode.isEmpty.

Convenience method that is functionally same as:

    size() == 0
public JsonNode
path(String
Name of the field (of Object node) to access
fieldName
)

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

Implements com.fasterxml.jackson.core.TreeNode.path.

This method is similar to 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 isMissingNode) will be returned.

public JsonNode
path(int
Index of the Array node element to access
index
)

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

Implements com.fasterxml.jackson.core.TreeNode.path.

This method is similar to 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 isMissingNode) will be returned.

public JsonNode

Returns:

Node removed, if any; null if none
remove
(int index)

Method for removing an entry from this ArrayNode.

public ArrayNode

Returns:

This node (to allow chaining)
removeAll
()

Implements abstract com.fasterxml.jackson.databind.node.ContainerNode.removeAll.

Method for removing all elements of this array, leaving the array empty.

public JsonNode
required(int
Index of the value of this Array node to access
index
)

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

Method is functionally equivalent to path(index).required() and can be used to check that this node is an ArrayNode (that is, represents JSON Array value) and has value for specified index (but note that value may be explicit JSON null value).

public void
serialize(JsonGenerator g, SerializerProvider provider)

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

Implements com.fasterxml.jackson.databind.JsonSerializable.serialize.

Method called to serialize node instances using given generator.

public void
serializeWithType(JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer)

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

Implements com.fasterxml.jackson.databind.JsonSerializable.serializeWithType.

Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.

public JsonNode

Returns:

Old value of the field, if any; null if there was no old value.
set
(int index, JsonNode
to set field to; if null, will be converted to a NullNode first (to remove field entry, call remove instead)
value
)

Method that will set specified field, replacing old value, if any.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, short v)

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Short v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, int v)

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Integer v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, long v)

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Long v)

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, float v)

Method for setting value of a field to specified numeric value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Float v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, double v)

Method for setting value of a field to specified numeric value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Double v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, BigDecimal v)

Method for setting value of a field to specified numeric value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, BigInteger v)

Method for setting value of a field to specified numeric value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, String v)

Method for setting value of a field to specified String value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, boolean v)

Method for setting value of a field to specified String value.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, Boolean v)

Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.

public ArrayNode

Returns:

This node (to allow chaining)
set
(int index, byte[] v)

Method for setting value of a field to specified binary value

public ArrayNode

Returns:

This node (to allow chaining)
setNull
(int index)

public ArrayNode

Returns:

This array node, to allow chaining
setPOJO
(int index, Object pojo)

public ArrayNode

Returns:

This array node, to allow chaining
setRawValue
(int index, RawValue raw)

public int
size()

Implements abstract com.fasterxml.jackson.databind.node.ContainerNode.size.

Implements 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.

public ObjectNode
with(String exprOrProperty)

Overrides com.fasterxml.jackson.databind.JsonNode.with.

Deprecated

Method that works in one of possible ways, depending on whether exprOrProperty is a valid JsonPointer expression or not (valid expression is either empty String "" or starts with leading slash / character).

public ArrayNode
withArray(String
Either JsonPointer expression for full access (if valid pointer expression), or the name of property for the ArrayNode.
exprOrProperty
)

Overrides com.fasterxml.jackson.databind.JsonNode.withArray.

Method that works in one of possible ways, depending on whether exprOrProperty is a valid JsonPointer expression or not (valid expression is either empty String "" or starts with leading slash / character).

Inherited from com.fasterxml.jackson.databind.node.ContainerNode:
arrayNodearrayNodeasTextbinaryNodebinaryNodebooleanNodemissingNodenullNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodenumberNodeobjectNodepojoNoderawValueNodetextNode