JSON
Version 1.0

org.codehaus.jackson.map.impl
Class ObjectNode

java.lang.Object
  extended by org.codehaus.jackson.map.JsonNode
      extended by org.codehaus.jackson.map.impl.ContainerNode
          extended by org.codehaus.jackson.map.impl.ObjectNode

public final class ObjectNode
extends ContainerNode


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.impl.ContainerNode
ContainerNode.NoNodesIterator, ContainerNode.NoStringsIterator
 
Constructor Summary
protected ObjectNode()
           
 
Method Summary
 void appendElement(JsonNode node)
           
 boolean equals(Object o)
          Let's mark this standard method as abstract to ensure all implementation classes define it
 JsonNode getElementValue(int index)
          Method for accessing value of the specified element of an array node.
 Iterator<String> getFieldNames()
           
 JsonNode getFieldValue(String fieldName)
          Method for accessing value of the specified field of an object node.
 Iterator<JsonNode> getFieldValues()
           
 JsonNode getPath(int index)
          This method is similar to JsonNode.getElementValue(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 getPath(String fieldName)
          This method is similar to JsonNode.getFieldValue(java.lang.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.
 void insertElement(int index, JsonNode value)
           
 boolean isObject()
           
 JsonNode removeElement(int index)
           
 JsonNode removeElement(String fieldName)
           
 JsonNode setElement(int index, JsonNode value)
           
 JsonNode setElement(String fieldName, JsonNode value)
           
 int size()
           
 String toString()
          Let's mark this standard method as abstract to ensure all implementation classes define it
 void writeTo(JsonGenerator jg)
          Method that can be called to serialize this node and all of its descendants using specified JSON generator.
 
Methods inherited from class org.codehaus.jackson.map.impl.ContainerNode
getValueAsText, isContainerNode
 
Methods inherited from class org.codehaus.jackson.map.JsonNode
getBooleanValue, getDecimalValue, getDoubleValue, getElements, getIntValue, getLongValue, getNumberValue, getTextValue, isArray, isBigDecimal, isBoolean, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isTextual, isValueNode, reportNoArrayMods, reportNoObjectMods
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectNode

protected ObjectNode()
Method Detail

isObject

public boolean isObject()
Overrides:
isObject in class JsonNode

size

public int size()
Specified by:
size in class ContainerNode
Returns:
For non-container nodes returns 0; for arrays number of contained elements, and for objects number of fields.

getElementValue

public JsonNode getElementValue(int index)
Description copied from class: JsonNode
Method for accessing value of the specified element of an array node. If this node is not an array (or index is out of range), null will be returned.

Specified by:
getElementValue in class ContainerNode
Returns:
Node that represent value of the specified element, if this node is an array and has specified element. Null otherwise.

getFieldValue

public JsonNode getFieldValue(String fieldName)
Description copied from class: JsonNode
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), null is returned.

Specified by:
getFieldValue in class ContainerNode
Returns:
Node that represent value of the specified field, if this node is an object and has value for the specified field. Null otherwise.

getFieldNames

public Iterator<String> getFieldNames()
Overrides:
getFieldNames in class JsonNode

getFieldValues

public Iterator<JsonNode> getFieldValues()
Overrides:
getFieldValues in class JsonNode

getPath

public JsonNode getPath(int index)
Description copied from class: JsonNode
This method is similar to JsonNode.getElementValue(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.

Specified by:
getPath in class JsonNode

getPath

public JsonNode getPath(String fieldName)
Description copied from class: JsonNode
This method is similar to JsonNode.getFieldValue(java.lang.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.

Specified by:
getPath in class JsonNode

appendElement

public void appendElement(JsonNode node)
Specified by:
appendElement in class ContainerNode

insertElement

public void insertElement(int index,
                          JsonNode value)
Specified by:
insertElement in class ContainerNode

removeElement

public JsonNode removeElement(int index)
Specified by:
removeElement in class ContainerNode

removeElement

public JsonNode removeElement(String fieldName)
Specified by:
removeElement in class ContainerNode

setElement

public JsonNode setElement(int index,
                           JsonNode value)
Specified by:
setElement in class ContainerNode

setElement

public JsonNode setElement(String fieldName,
                           JsonNode value)
Specified by:
setElement in class ContainerNode

writeTo

public void writeTo(JsonGenerator jg)
             throws IOException,
                    JsonGenerationException
Description copied from class: JsonNode
Method that can be called to serialize this node and all of its descendants using specified JSON generator.

Specified by:
writeTo in class JsonNode
Throws:
IOException
JsonGenerationException

equals

public boolean equals(Object o)
Description copied from class: JsonNode
Let's mark this standard method as abstract to ensure all implementation classes define it

Specified by:
equals in class JsonNode

toString

public String toString()
Description copied from class: JsonNode
Let's mark this standard method as abstract to ensure all implementation classes define it

Specified by:
toString in class JsonNode

JSON
Version 1.0

Apache License, Version 2.0