|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.jackson.JsonNode
org.codehaus.jackson.node.BaseJsonNode
org.codehaus.jackson.node.ContainerNode
org.codehaus.jackson.node.ArrayNode
public final class ArrayNode
Node class that represents Arrays mapped from Json content.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.codehaus.jackson.node.ContainerNode |
|---|
ContainerNode.NoNodesIterator, ContainerNode.NoStringsIterator |
| Field Summary | |
|---|---|
protected ArrayList<JsonNode> |
_children
|
| Fields inherited from class org.codehaus.jackson.JsonNode |
|---|
NO_NODES, NO_STRINGS |
| Constructor Summary | |
|---|---|
ArrayNode(JsonNodeFactory nc)
|
|
| Method Summary | |
|---|---|
JsonNode |
_set(int index,
JsonNode value)
|
void |
add(BigDecimal v)
Method for setting value of a field to specified numeric value. |
void |
add(boolean v)
Method for setting value of a field to specified String value. |
void |
add(Boolean value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
add(byte[] v)
Method for setting value of a field to specified binary value |
void |
add(double v)
Method for setting value of a field to specified numeric value. |
void |
add(Double value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
add(float v)
Method for setting value of a field to specified numeric value. |
void |
add(Float value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
add(int v)
Method for setting value of a field to specified numeric value. |
void |
add(Integer value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
add(JsonNode value)
|
void |
add(long v)
Method for setting value of a field to specified numeric value. |
void |
add(Long value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
add(String v)
Method for setting value of a field to specified String value. |
JsonNode |
addAll(ArrayNode other)
Method for adding all child nodes of given Array, appending to child nodes this array contains |
JsonNode |
addAll(Collection<JsonNode> nodes)
Method for adding given nodes as child nodes of this array node. |
ArrayNode |
addArray()
Method that will construct an ArrayNode and add it as a field of this ObjectNode, replacing old value, if any. |
protected void |
addContentsTo(List<JsonNode> dst)
|
void |
addNull()
|
ObjectNode |
addObject()
Method that will construct an ObjectNode and add it at the end of this array node. |
void |
addPOJO(Object value)
Method that will construct a POJONode and add it at the end of this array node. |
JsonToken |
asToken()
Method that can be used for efficient type detection when using stream abstraction for traversing nodes. |
boolean |
equals(Object o)
Equality for node objects is defined as full (deep) value equality. |
ObjectNode |
findParent(String fieldName)
Method for finding a JSON Object that contains specified field, within this node or its descendants. |
List<JsonNode> |
findParents(String fieldName,
List<JsonNode> foundSoFar)
|
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. |
List<JsonNode> |
findValues(String fieldName,
List<JsonNode> foundSoFar)
|
List<String> |
findValuesAsText(String fieldName,
List<String> foundSoFar)
|
JsonNode |
get(int index)
Method for accessing value of the specified element of an array node. |
JsonNode |
get(String fieldName)
Method for accessing value of the specified field of an object node. |
Iterator<JsonNode> |
getElements()
Method for accessing all value nodes of this Node, iff this node is a JSON Array or Object node. |
int |
hashCode()
|
void |
insert(int index,
BigDecimal v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
boolean v)
Method for setting value of a field to specified String value. |
void |
insert(int index,
Boolean value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
insert(int index,
byte[] v)
Method for setting value of a field to specified binary value |
void |
insert(int index,
double v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
Double value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
insert(int index,
float v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
Float value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
insert(int index,
int v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
Integer value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
insert(int index,
JsonNode value)
Method for inserting specified child node as an element of this Array. |
void |
insert(int index,
long v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
Long value)
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing. |
void |
insert(int index,
String v)
Method for setting value of a field to specified String value. |
ArrayNode |
insertArray(int index)
|
void |
insertNull(int index)
|
ObjectNode |
insertObject(int index)
Method that will construct an ObjectNode and add it at the end of this array node. |
void |
insertPOJO(int index,
Object value)
Method that will construct a POJONode and add it at the end of this array node. |
boolean |
isArray()
|
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(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. |
JsonNode |
remove(int index)
Method for removing an entry from this ArrayNode. |
ArrayNode |
removeAll()
Method for removing all children container has (if any) |
void |
serialize(JsonGenerator jg,
SerializerProvider provider)
Method called to serialize node instances using given generator. |
void |
serializeWithType(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. |
JsonNode |
set(int index,
JsonNode value)
Method that will set specified field, replacing old value, if any. |
int |
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. |
String |
toString()
Note: marked as abstract to ensure all implementation classes define it properly. |
| Methods inherited from class org.codehaus.jackson.node.ContainerNode |
|---|
arrayNode, asText, binaryNode, binaryNode, booleanNode, getValueAsText, isContainerNode, nullNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, objectNode, POJONode, textNode |
| Methods inherited from class org.codehaus.jackson.node.BaseJsonNode |
|---|
findPath, getNumberType, traverse |
| Methods inherited from class org.codehaus.jackson.JsonNode |
|---|
asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, findParents, findValues, findValuesAsText, getBigIntegerValue, getBinaryValue, getBooleanValue, getDecimalValue, getDoubleValue, getFieldNames, getFields, getIntValue, getLongValue, getNumberValue, getPath, getPath, getTextValue, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, has, has, isBigDecimal, isBigInteger, isBinary, isBoolean, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isTextual, isValueNode, iterator, with |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<JsonNode> _children
| Constructor Detail |
|---|
public ArrayNode(JsonNodeFactory nc)
| Method Detail |
|---|
public JsonToken asToken()
BaseJsonNodeJsonToken that equivalent
stream event would produce (for most nodes there is just
one token but for structured/container types multiple)
asToken in class ContainerNodepublic boolean isArray()
isArray in class JsonNodepublic int size()
JsonNode
size in class ContainerNodepublic Iterator<JsonNode> getElements()
JsonNode
getElements in class JsonNodepublic JsonNode get(int index)
JsonNode
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.
get in class ContainerNodepublic JsonNode get(String fieldName)
JsonNode
get in class ContainerNodepublic JsonNode path(String fieldName)
JsonNodeJsonNode.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 in class JsonNodepublic JsonNode path(int index)
JsonNodeJsonNode.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.
path in class JsonNode
public final void serialize(JsonGenerator jg,
SerializerProvider provider)
throws IOException,
JsonProcessingException
BaseJsonNode
serialize in interface JsonSerializableserialize in class BaseJsonNodeIOException
JsonProcessingException
public void serializeWithType(JsonGenerator jg,
SerializerProvider provider,
TypeSerializer typeSer)
throws IOException,
JsonProcessingException
BaseJsonNode
serializeWithType in interface JsonSerializableWithTypeserializeWithType in class BaseJsonNodeIOException
JsonProcessingExceptionpublic JsonNode findValue(String fieldName)
JsonNode
findValue in class ContainerNodefieldName - Name of field to look for
public List<JsonNode> findValues(String fieldName,
List<JsonNode> foundSoFar)
findValues in class ContainerNode
public List<String> findValuesAsText(String fieldName,
List<String> foundSoFar)
findValuesAsText in class ContainerNodepublic ObjectNode findParent(String fieldName)
JsonNode
findParent in class ContainerNodefieldName - Name of field to look for
public List<JsonNode> findParents(String fieldName,
List<JsonNode> foundSoFar)
findParents in class ContainerNode
public JsonNode set(int index,
JsonNode value)
value - to set field to; if null, will be converted
to a NullNode first (to remove field entry, call
remove(int) instead)
public void add(JsonNode value)
public JsonNode addAll(ArrayNode other)
other - Array to add contents from
public JsonNode addAll(Collection<JsonNode> nodes)
nodes - Nodes to add
public void insert(int index,
JsonNode value)
public JsonNode remove(int index)
public ArrayNode removeAll()
ContainerNode
removeAll in class ContainerNodepublic ArrayNode addArray()
public ObjectNode addObject()
public void addPOJO(Object value)
public void addNull()
public void add(int v)
public void add(Integer value)
public void add(long v)
public void add(Long value)
public void add(float v)
public void add(Float value)
public void add(double v)
public void add(Double value)
public void add(BigDecimal v)
public void add(String v)
public void add(boolean v)
public void add(Boolean value)
public void add(byte[] v)
public ArrayNode insertArray(int index)
public ObjectNode insertObject(int index)
public void insertPOJO(int index,
Object value)
public void insertNull(int index)
public void insert(int index,
int v)
public void insert(int index,
Integer value)
public void insert(int index,
long v)
public void insert(int index,
Long value)
public void insert(int index,
float v)
public void insert(int index,
Float value)
public void insert(int index,
double v)
public void insert(int index,
Double value)
public void insert(int index,
BigDecimal v)
public void insert(int index,
String v)
public void insert(int index,
boolean v)
public void insert(int index,
Boolean value)
public void insert(int index,
byte[] v)
protected void addContentsTo(List<JsonNode> dst)
public boolean equals(Object o)
JsonNode
Note: marked as abstract to ensure all implementation
classes define it properly and not rely on definition
from Object.
equals in class JsonNodepublic int hashCode()
hashCode in class Objectpublic String toString()
JsonNodeNote: marked as abstract to ensure all implementation classes define it properly.
toString in class JsonNode
public JsonNode _set(int index,
JsonNode value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||