Package org.codehaus.jackson.node
Class ValueNode
java.lang.Object
org.codehaus.jackson.JsonNode
org.codehaus.jackson.node.BaseJsonNode
org.codehaus.jackson.node.ValueNode
- All Implemented Interfaces:
Iterable<JsonNode>
,JsonSerializable
,JsonSerializableWithType
- Direct Known Subclasses:
BinaryNode
,BooleanNode
,NullNode
,NumericNode
,POJONode
,TextNode
This intermediate base class is used for all leaf nodes, that is,
all non-container (array or object) nodes, except for the
"missing node".
-
Field Summary
Fields inherited from class org.codehaus.jackson.JsonNode
NO_NODES, NO_STRINGS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract JsonToken
asToken()
Method that can be used for efficient type detection when using stream abstraction for traversing nodes.boolean
Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path.path
(int index) This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned.This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned.void
serializeWithType
(JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer) Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.toString()
Note: marked as abstract to ensure all implementation classes define it properly.Methods inherited from class org.codehaus.jackson.node.BaseJsonNode
findParent, findParents, findPath, findValue, findValues, findValuesAsText, getNumberType, serialize, traverse
Methods inherited from class org.codehaus.jackson.JsonNode
asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, equals, findParents, findValues, findValuesAsText, get, get, getBigIntegerValue, getBinaryValue, getBooleanValue, getDecimalValue, getDoubleValue, getElements, getFieldNames, getFields, getIntValue, getLongValue, getNumberValue, getPath, getPath, getTextValue, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsText, has, has, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isTextual, iterator, size, with
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ValueNode
protected ValueNode()
-
-
Method Details
-
isValueNode
public boolean isValueNode()Description copied from class:JsonNode
Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path. Such value nodes represent String, Number, Boolean and null values from JSON.Note: one and only one of methods
JsonNode.isValueNode()
,JsonNode.isContainerNode()
andJsonNode.isMissingNode()
ever returns true for any given node.- Overrides:
isValueNode
in classJsonNode
-
asToken
Description copied from class:BaseJsonNode
Method that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the firstJsonToken
that equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)- Specified by:
asToken
in classBaseJsonNode
-
serializeWithType
public void serializeWithType(JsonGenerator jg, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException Description copied from class:BaseJsonNode
Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.- Specified by:
serializeWithType
in interfaceJsonSerializableWithType
- Specified by:
serializeWithType
in classBaseJsonNode
- Throws:
IOException
JsonProcessingException
-
path
Description copied from class:JsonNode
This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned. This allows for convenient and safe chained access via path calls. -
path
Description copied from class:JsonNode
This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned. This allows for convenient and safe chained access via path calls. -
toString
Description copied from class:JsonNode
Note: marked as abstract to ensure all implementation classes define it properly.
-