public abstract class JsonNode
extends java.lang.Object
A node (leaf or otherwise) in a JSON document.
Supplies methods for examining the node, and also examining and navigating the hierarchy at and below this node.
 Methods for navigating the hierarchy are of the form getXXXValue(Object... pathElements).
For example, getStringValue(Object...) takes a series of Strings and
 Integers as its argument which tell it how to navigate down a hierarchy to a particular JSON string.
 The Strings tell it to select a field with the given name from an object, and the Integers
 tell it to select an element with the given index from an array.  If no field of that name exists, or the field
 exists, but it isn't a JSON string, an IllegalArgumentException is thrown.
Methods for examining the hierarchy work on the same principal as the
 getXXXValue(Object... pathElements) methods, but return a boolean indicating whether
 or not the element at the given path exists and is of the type specified, for example,
 getStringValue("my field") returns true if the node has a field called
 "my field", and its value is a JSON string.
| Modifier and Type | Method and Description | 
|---|---|
| java.util.List<JsonNode> | getArrayNode(java.lang.Object... pathElements)Gets a  ListofJsonNodes, representing a JSON array, by navigating the hierarchy below this node. | 
| java.lang.Boolean | getBooleanValue(java.lang.Object... pathElements)Gets a  Booleanby navigating the hierarchy below this node. | 
| abstract java.util.List<JsonNode> | getElements() | 
| abstract java.util.List<JsonField> | getFieldList()Gets the fields associated with this node as a list of  JsonFields. | 
| abstract java.util.Map<JsonStringNode,JsonNode> | getFields()Gets the fields associated with this node as a map of name to value. | 
| JsonNode | getNode(java.lang.Object... pathElements)Gets a  JsonNodeby navigating the hierarchy below this node. | 
| java.util.List<JsonNode> | getNullableArrayNode(java.lang.Object... pathElements)Gets a  ListofJsonNodes, representing a JSON array, ornullby navigating the hierarchy below this node. | 
| java.lang.Boolean | getNullableBooleanValue(java.lang.Object... pathElements)Gets a  Booleanornullby navigating the hierarchy below this node. | 
| java.lang.String | getNullableNumberValue(java.lang.Object... pathElements)Gets a numeric  Stringornullby navigating the hierarchy below this node. | 
| java.util.Map<JsonStringNode,JsonNode> | getNullableObjectNode(java.lang.Object... pathElements)Gets a  MapofStringfield names toJsonNodes, representing a JSON object, ornullby navigating the hierarchy below this node. | 
| java.lang.String | getNullableStringValue(java.lang.Object... pathElements)Gets a  Stringornullby navigating the hierarchy below this node. | 
| JsonNode | getNullNode(java.lang.Object... pathElements)Gets a  JsonNoderepresenting null by navigating the hierarchy below this node. | 
| java.lang.String | getNumberValue(java.lang.Object... pathElements)Gets a numeric  Stringby navigating the hierarchy below this node. | 
| java.util.Map<JsonStringNode,JsonNode> | getObjectNode(java.lang.Object... pathElements)Gets a  MapofStringfield names toJsonNodes, representing a JSON object, by navigating the hierarchy below this node. | 
| java.lang.String | getStringValue(java.lang.Object... pathElements)Gets a  Stringby navigating the hierarchy below this node. | 
| abstract java.lang.String | getText() | 
| abstract JsonNodeType | getType() | 
| abstract boolean | hasElements() | 
| abstract boolean | hasFields() | 
| abstract boolean | hasText() | 
| boolean | isArrayNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON array. | 
| boolean | isBooleanValue(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON boolean. | 
| boolean | isNode(java.lang.Object... pathElements)Determines whether the node at the given path exists. | 
| boolean | isNullableArrayNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON array or a JSON null. | 
| boolean | isNullableBooleanValue(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON boolean or a JSON null. | 
| boolean | isNullableNumberNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON number or a JSON null. | 
| boolean | isNullableObjectNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON object or a JSON null. | 
| boolean | isNullableStringValue(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON string or a JSON null. | 
| boolean | isNullNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON null. | 
| boolean | isNumberValue(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON number. | 
| boolean | isObjectNode(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON object. | 
| boolean | isStringValue(java.lang.Object... pathElements)Determines whether the node at the given path exists and is a JSON string. | 
| abstract void | visit(JsonNodeVisitor jsonNodeVisitor)Executes a callback to the method corresponding to the type of this  JsonNode. | 
public abstract JsonNodeType getType()
public abstract boolean hasText()
public abstract java.lang.String getText()
java.lang.IllegalStateException - if hasText() returns false, indicating this type of node doesn't have text.public abstract boolean hasFields()
public abstract java.util.Map<JsonStringNode,JsonNode> getFields()
java.lang.IllegalStateException - if hasFields() returns false, indicating this type of node doesn't support fields.public abstract java.util.List<JsonField> getFieldList()
JsonFields.  This method allows
 the retrieval of all fields in an object even when the fields have duplicate keys.  This method
 also preserves the order of the fields.java.lang.IllegalStateException - if hasFields() returns false, indicating this type of node doesn't support fields.public abstract boolean hasElements()
public abstract java.util.List<JsonNode> getElements()
java.lang.IllegalStateException - if hasElements() returns false, indicating this type of node doesn't support elements.public boolean isNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public JsonNode getNode(java.lang.Object... pathElements)
JsonNode by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.JsonNode at the path given.java.lang.IllegalArgumentException - if there is no node at the given path.public final boolean isBooleanValue(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.Boolean getBooleanValue(java.lang.Object... pathElements)
Boolean by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.Boolean at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON boolean.public final boolean isNullableBooleanValue(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.Boolean getNullableBooleanValue(java.lang.Object... pathElements)
Boolean or null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.Boolean at the path given, or null, if there is a JSON null at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON boolean or a JSON null.public final boolean isStringValue(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.String getStringValue(java.lang.Object... pathElements)
String by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.String at the path givenjava.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON string.public final boolean isNullableStringValue(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.String getNullableStringValue(java.lang.Object... pathElements)
String or null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.String at the path given, or null, if there is a JSON null at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON string or a JSON null.public final boolean isNumberValue(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.String getNumberValue(java.lang.Object... pathElements)
String by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.String at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON number.public final boolean isNullableNumberNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.lang.String getNullableNumberValue(java.lang.Object... pathElements)
String or null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.String at the path given, or null, if there is a JSON null at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON number or a JSON null.public final boolean isNullNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final JsonNode getNullNode(java.lang.Object... pathElements)
JsonNode representing null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.JsonNode representing null.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON null.public final boolean isObjectNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.util.Map<JsonStringNode,JsonNode> getObjectNode(java.lang.Object... pathElements)
Map of String field names to JsonNodes, representing a JSON object, by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.Map of String field names to JsonNodes representing a JSON object.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON object.public final boolean isNullableObjectNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.util.Map<JsonStringNode,JsonNode> getNullableObjectNode(java.lang.Object... pathElements)
Map of String field names to JsonNodes, representing a JSON object, or null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.Map of String field names to JsonNodes representing a JSON object at the path given, or null, if there is a JSON null at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON object or a JSON null.public final boolean isArrayNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.util.List<JsonNode> getArrayNode(java.lang.Object... pathElements)
List of JsonNodes, representing a JSON array, by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.List of JsonNodes representing a JSON array.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON array.public final boolean isNullableArrayNode(java.lang.Object... pathElements)
pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.public final java.util.List<JsonNode> getNullableArrayNode(java.lang.Object... pathElements)
List of JsonNodes, representing a JSON array, or null by navigating the hierarchy below this node.pathElements - a series of Strings, representing the names of fields on objects, and Integers, representing elements of arrays indicating how to navigate from this node.List of JsonNodes representing a JSON array, or null, if there is a JSON null at the path given.java.lang.IllegalArgumentException - if there is no node at the given path, or the node at the given path is not a JSON array or a JSON null.public abstract void visit(JsonNodeVisitor jsonNodeVisitor)
JsonNode.jsonNodeVisitor - the JsonNodeVisitor to call back.