|
||||||||||
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 |
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(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(float v)
Method for setting value of a field to specified numeric value. |
void |
add(int v)
Method for setting value of a field to specified numeric value. |
void |
add(JsonNode value)
|
void |
add(long v)
Method for setting value of a field to specified numeric value. |
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. |
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)
Note: marked as abstract to ensure all implementation classes define it properly. |
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,
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,
float v)
Method for setting value of a field to specified numeric value. |
void |
insert(int index,
int v)
Method for setting value of a field to specified numeric value. |
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,
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. |
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, 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 |
---|
getNumberType, serializeWithType, traverse, writeTo |
Methods inherited from class org.codehaus.jackson.JsonNode |
---|
getBigIntegerValue, getBinaryValue, getBooleanValue, getDecimalValue, getDoubleValue, getElementValue, getFieldNames, getFieldValue, getIntValue, getLongValue, getNumberValue, getPath, getPath, getTextValue, isBigDecimal, isBigInteger, isBinary, isBoolean, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isTextual, isValueNode, iterator |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArrayNode(JsonNodeFactory nc)
Method Detail |
---|
public JsonToken asToken()
BaseJsonNode
JsonToken
that equivalent
stream event would produce (for most nodes there is just
one token but for structured/container types multiple)
asToken
in class ContainerNode
public boolean isArray()
isArray
in class JsonNode
public int size()
JsonNode
size
in class ContainerNode
public Iterator<JsonNode> getElements()
JsonNode
getElements
in class JsonNode
public 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 ContainerNode
public JsonNode get(String fieldName)
JsonNode
get
in class ContainerNode
public JsonNode path(String fieldName)
JsonNode
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
in class JsonNode
public JsonNode path(int index)
JsonNode
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.
path
in class JsonNode
public final void serialize(JsonGenerator jg, SerializerProvider provider) throws IOException, JsonProcessingException
BaseJsonNode
serialize
in interface JsonSerializable
serialize
in class BaseJsonNode
IOException
JsonProcessingException
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 ContainerNode
public ArrayNode addArray()
public ObjectNode addObject()
public void addPOJO(Object value)
public void addNull()
public void add(int v)
public void add(long v)
public void add(float v)
public void add(double v)
public void add(BigDecimal v)
public void add(String v)
public void add(boolean v)
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, long v)
public void insert(int index, float v)
public void insert(int index, double v)
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, byte[] v)
public boolean equals(Object o)
JsonNode
Note: marked as abstract to ensure all implementation classes define it properly.
equals
in class JsonNode
public int hashCode()
hashCode
in class Object
public String toString()
JsonNode
Note: 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 |