Array of nodes java

Array of nodes java

Node class that represents Arrays mapped from JSON content. Note: class was final temporarily for Jackson 2.2.

Nested Class Summary

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

Field Summary

Fields inherited from class com.fasterxml.jackson.databind.node.ContainerNode

Constructor Summary

Method Summary

Methods
Modifier and Type Method and Description
protected ArrayNode _add(JsonNode node)
protected JsonNode _at(JsonPointer ptr)
protected boolean _childrenEqual(ArrayNode other)
protected ArrayNode _insert(int index, JsonNode node)
ArrayNode add(BigDecimal v)

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

Method that will construct an ArrayNode and add it as a field of this ObjectNode, replacing old value, if any.

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

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.

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

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

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)

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

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

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

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

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

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

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

Methods inherited from class java.lang.Object

Constructor Detail

ArrayNode

ArrayNode

Method Detail

_at

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. This means it can either make a copy of this node (and all mutable children and grand children nodes), or node itself if it is immutable. Note: return type is guaranteed to have same type as the node method is called on; which is why method is declared with local generic type.

isEmpty

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

getNodeType

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)

size

elements

Method for accessing all value nodes of this Node, iff this node is a JSON Array or Object node. In case of Object node, field names (keys) are not included, only values. For other types of nodes, returns empty iterator.

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 NullNode will be returned, not null.

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 NullNode will be returned, not null.

path

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.

path

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.

equals

public boolean equals(ComparatorJsonNode> comparator, JsonNode o)

Entry method for invoking customizable comparison, using passed-in Comparator object. Nodes will handle traversal of structured types (arrays, objects), but defer to comparator for scalar value comparisons. If a «natural» Comparator is passed — one that simply calls equals() on one of arguments, passing the other — implementation is the same as directly calling equals() on node. Default implementation simply delegates to passed in comparator , with this as the first argument, and other as the second argument.

serialize

public void serialize(JsonGenerator f, SerializerProvider provider) throws IOException

serializeWithType

public void serializeWithType(JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer) throws IOException

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

findValue

public JsonNode findValue(String fieldName)

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.

findValues

public ListJsonNode> findValues(String fieldName, ListJsonNode> foundSoFar)

findValuesAsText

public ListString> findValuesAsText(String fieldName, ListString> foundSoFar)

findParent

public ObjectNode findParent(String fieldName)

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.

findParents

public ListJsonNode> findParents(String fieldName, ListJsonNode> foundSoFar)

set

public JsonNode set(int index, JsonNode value)

add

addAll

addAll

public ArrayNode addAll(CollectionJsonNode> nodes)

insert

public ArrayNode insert(int index, JsonNode value)

Method for inserting specified child node as an element of this Array. If index is 0 or less, it will be inserted as the first element; if >= size(), appended at the end, and otherwise inserted before existing element in specified index. No exceptions are thrown for any index.

remove

Method for removing an entry from this ArrayNode. Will return value of the entry at specified index, if entry existed; null if not.

removeAll

addArray

Method that will construct an ArrayNode and add it as a field of this ObjectNode, replacing old value, if any.

addObject

addPOJO

addRawValue

addNull

add

add

add

add

add

add

add

add

add

add

add

add

add

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

insertArray

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)

insertObject

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

insertPOJO

public ArrayNode insertPOJO(int index, Object value)

insertNull

insert

insert

public ArrayNode insert(int index, Integer value)

insert

insert

public ArrayNode insert(int index, Long value)

insert

insert

public ArrayNode insert(int index, Float value)

insert

insert

public ArrayNode insert(int index, Double value)

insert

public ArrayNode insert(int index, BigDecimal v)

insert

insert

public ArrayNode insert(int index, boolean v)

insert

public ArrayNode insert(int index, Boolean value)

insert

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

equals

Equality for node objects is defined as full (deep) value equality. This means that it is possible to compare complete JSON trees for equality by comparing equality of root nodes. Note: marked as abstract to ensure all implementation classes define it properly and not rely on definition from Object .

_childrenEqual

hashCode

toString

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.

_add

_insert

protected ArrayNode _insert(int index, JsonNode node)

Источник

Читайте также:  Javascript alert all object
Оцените статью