JSON
Version 1.0

org.codehaus.jackson.map.impl
Class ContainerNode

java.lang.Object
  extended by org.codehaus.jackson.map.JsonNode
      extended by org.codehaus.jackson.map.impl.ContainerNode
Direct Known Subclasses:
ArrayNode, ObjectNode

public abstract class ContainerNode
extends JsonNode

This intermediate base class is used for all container nodes, specifically, array and object nodes.


Nested Class Summary
protected static class ContainerNode.NoNodesIterator
           
protected static class ContainerNode.NoStringsIterator
           
 
Constructor Summary
protected ContainerNode()
           
 
Method Summary
abstract  void appendElement(JsonNode node)
           
abstract  JsonNode getElementValue(int index)
          Method for accessing value of the specified element of an array node.
abstract  JsonNode getFieldValue(String fieldName)
          Method for accessing value of the specified field of an object node.
 String getValueAsText()
          Method that will return valid String representation of the container value, if the node is a value node (method JsonNode.isValueNode() returns true), otherwise null.
abstract  void insertElement(int index, JsonNode value)
           
 boolean isContainerNode()
          Method that returns true for container nodes: Arrays and Objects.
abstract  JsonNode removeElement(int index)
           
abstract  JsonNode removeElement(String fieldName)
           
abstract  JsonNode setElement(int index, JsonNode value)
           
abstract  JsonNode setElement(String fieldName, JsonNode value)
           
abstract  int size()
           
 
Methods inherited from class org.codehaus.jackson.map.JsonNode
equals, getBooleanValue, getDecimalValue, getDoubleValue, getElements, getFieldNames, getFieldValues, getIntValue, getLongValue, getNumberValue, getPath, getPath, getTextValue, isArray, isBigDecimal, isBoolean, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isTextual, isValueNode, reportNoArrayMods, reportNoObjectMods, toString, writeTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContainerNode

protected ContainerNode()
Method Detail

isContainerNode

public boolean isContainerNode()
Description copied from class: JsonNode
Method that returns true for container nodes: Arrays and Objects.

Note: one and only one of methods JsonNode.isValueNode(), JsonNode.isContainerNode() and JsonNode.isMissingNode() ever returns true for any given node.

Overrides:
isContainerNode in class JsonNode

getValueAsText

public String getValueAsText()
Description copied from class: JsonNode
Method that will return valid String representation of the container value, if the node is a value node (method JsonNode.isValueNode() returns true), otherwise null.

Note: to serialize nodes of any type, you should call JsonNode.toString() instead.

Specified by:
getValueAsText in class JsonNode

size

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

getElementValue

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

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

getFieldValue

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

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

appendElement

public abstract void appendElement(JsonNode node)
Overrides:
appendElement in class JsonNode

insertElement

public abstract void insertElement(int index,
                                   JsonNode value)
Overrides:
insertElement in class JsonNode

removeElement

public abstract JsonNode removeElement(int index)
Overrides:
removeElement in class JsonNode

removeElement

public abstract JsonNode removeElement(String fieldName)
Overrides:
removeElement in class JsonNode

setElement

public abstract JsonNode setElement(int index,
                                    JsonNode value)
Overrides:
setElement in class JsonNode

setElement

public abstract JsonNode setElement(String fieldName,
                                    JsonNode value)
Overrides:
setElement in class JsonNode

JSON
Version 1.0

Apache License, Version 2.0