JSON
Version 1.0

org.codehaus.jackson.map.impl
Class MissingNode

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

public final class MissingNode
extends JsonNode

This singleton node class is generated to denote "missing nodes" along paths that do not exist. For example, if a path via element of an array is requested for an element outside range of elements in the array; or for a non-array value, result will be reference to this node.


Method Summary
 boolean equals(Object o)
          Let's mark this standard method as abstract to ensure all implementation classes define it
static MissingNode getInstance()
           
 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.
 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.
 boolean isMissingNode()
          Method that returns true for "virtual" nodes which represent missing entries constructed by path accessor methods when there is no actual node matching given criteria.
 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.JsonNode
appendElement, getBooleanValue, getDecimalValue, getDoubleValue, getElements, getElementValue, getFieldNames, getFieldValue, getFieldValues, getIntValue, getLongValue, getNumberValue, getTextValue, insertElement, isArray, isBigDecimal, isBoolean, isContainerNode, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isObject, isTextual, isValueNode, removeElement, removeElement, reportNoArrayMods, reportNoObjectMods, setElement, setElement, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static MissingNode getInstance()

isMissingNode

public boolean isMissingNode()
Description copied from class: JsonNode
Method that returns true for "virtual" nodes which represent missing entries constructed by path accessor methods when there is no actual node matching given criteria.

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

Overrides:
isMissingNode 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

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

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

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