- All Implemented Interfaces:
Serializable,Iterable<JsonNode>,TreeNode,JacksonSerializable
In most respects this placeholder node will act as NullNode;
for example, for purposes of value conversions, value is considered
to be null and represented as value zero when used for numeric
conversions.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.JsonNode
JsonNode.OverwriteModeNested classes/interfaces inherited from interface tools.jackson.databind.JacksonSerializable
JacksonSerializable.Base -
Field Summary
Fields inherited from class tools.jackson.databind.node.BaseJsonNode
OPT_FALSE, OPT_TRUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected JsonNode_at(JsonPointer ptr) Helper method used by other methods for traversing the next step of given path expression, and returning matching value node if any: if no match,nullis returned.protected StringMethod for implementation classes to return a short description of contained value, to be used in error messages.asToken()Method that can be used for efficient type detection when using stream abstraction for traversing nodes.deepCopy()Method that can be called to get a node that is guaranteed not to allow changing of this node through mutators on this node or any of its children.booleanEquality for node objects is defined as full (deep) value equality.findParent(String fieldName) Method for finding a JSON Object that contains specified field, within this node or its descendants.findParents(String fieldName, List<JsonNode> foundSoFar) Method for finding the first JSON Object field with specified name in this node or its child nodes, and returning value it has.findValues(String fieldName, List<JsonNode> foundSoFar) findValuesAsString(String fieldName, List<String> foundSoFar) get(int index) Method for accessing value of the specified element of an array node.static MissingNodeReturn the type of this nodeinthashCode()final booleanpath(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.protected Objectrequire()Method that may be called to verify thatthisnode is NOT so-called "missing node": that is, one for whichJsonNode.isMissingNode()returnstrue.Method that may be called to verify thatthisnode is neither so-called "missing node" (that is, one for whichJsonNode.isMissingNode()returnstrue) nor "null node" (one for whichJsonNode.isNull()returnstrue).final voidserialize(JsonGenerator g, SerializationContext provider) Method called to serialize node instances using given generator.voidserializeWithType(JsonGenerator g, SerializationContext provider, TypeSerializer typeSer) Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.Alternative toJsonNode.toString()that will serialize this node using Jackson default pretty-printer.toString()Method that will produce (as of Jackson 2.10) valid JSON using default settings of databind, as String.Methods inherited from class tools.jackson.databind.node.BaseJsonNode
_asBoolean, _asString, _jsonPointerIfValid, _reportBigDecimalCoercionNaNFail, _reportBigIntegerCoercionFractionFail, _reportBigIntegerCoercionNaNFail, _reportCoercionFail, _reportDoubleCoercionRangeFail, _reportFloatCoercionRangeFail, _reportIntCoercionFractionFail, _reportIntCoercionNaNFail, _reportIntCoercionRangeFail, _reportLongCoercionFractionFail, _reportLongCoercionNaNFail, _reportLongCoercionRangeFail, _reportShortCoercionFractionFail, _reportShortCoercionRangeFail, _reportWrongNodeType, _withArray, _withObject, _withXxxMayReplace, _withXxxVerifyReplace, asBigInteger, asBigInteger, asBigIntegerOpt, asBoolean, asBoolean, asBooleanOpt, asDecimal, asDecimal, asDecimalOpt, asDouble, asDouble, asDoubleOpt, asFloat, asFloat, asFloatOpt, asInt, asInt, asIntOpt, asLong, asLong, asLongOpt, asShort, asShort, asShortOpt, asString, asString, asStringOpt, bigIntegerValue, bigIntegerValue, bigIntegerValueOpt, binaryValue, booleanValue, booleanValue, booleanValueOpt, decimalValue, decimalValue, decimalValueOpt, doubleValue, doubleValue, doubleValueOpt, findPath, floatValue, floatValue, floatValueOpt, intValue, intValue, intValueOpt, isEmbeddedValue, longValue, longValue, longValueOpt, numberType, numberValue, required, required, shortValue, shortValue, shortValueOpt, stringValue, stringValue, stringValueOpt, traverse, withArray, withObjectMethods inherited from class tools.jackson.databind.JsonNode
_reportRequiredViolation, _reportUnsupportedOperation, _this, asText, asText, at, at, canConvertToExactIntegral, canConvertToInt, canConvertToLong, canConvertToShort, equals, findParents, findValues, findValuesAsString, forEachEntry, get, has, has, hasNonNull, hasNonNull, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainer, isDouble, isEmpty, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isObject, isPojo, isShort, isString, isTextual, isValueNode, iterator, optional, optional, properties, propertyNames, propertyStream, requiredAt, requiredAt, size, spliterator, textValue, values, valueStream, withArray, withArray, withArray, withArrayProperty, withObject, withObject, withObject, withObjectPropertyMethods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Constructor Details
-
MissingNode
protected MissingNode()
-
-
Method Details
-
readResolve
-
deepCopy
Description copied from class:JsonNodeMethod that can be called to get a node that is guaranteed not to allow changing of this node through mutators on this node or any of its children. This means it can either make a copy of this node (and all mutable children and grand children nodes), or node itself if it is immutable.Note: return type is guaranteed to have same type as the node method is called on; which is why method is declared with local generic type.
-
getInstance
-
getNodeType
Description copied from class:JsonNodeReturn the type of this node- Specified by:
getNodeTypein classJsonNode- Returns:
- the node type as a
JsonNodeTypeenum value
-
isMissingNode
public final boolean isMissingNode()- Specified by:
isMissingNodein interfaceTreeNode- Overrides:
isMissingNodein classBaseJsonNode
-
asToken
Description copied from class:BaseJsonNodeMethod that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the firstJsonTokenthat equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)- Specified by:
asTokenin interfaceTreeNode- Specified by:
asTokenin classBaseJsonNode
-
_valueDesc
Description copied from class:BaseJsonNodeMethod for implementation classes to return a short description of contained value, to be used in error messages.- Specified by:
_valueDescin classBaseJsonNode
-
asOptional
Description copied from class:JsonNodeMethod that will return aJsonNodewrapped in Java'sOptional. All nodes except ofMissingNodewill return non-emptyOptional;MissingNodewill return emptyOptional.- Overrides:
asOptionalin classJsonNode- Returns:
Optional<JsonNode>containing this node, orOptional.empty()if this is aMissingNode.
-
require
Description copied from class:JsonNodeMethod that may be called to verify thatthisnode is NOT so-called "missing node": that is, one for whichJsonNode.isMissingNode()returnstrue. If not missing node,thisis returned to allow chaining; otherwise exception is thrown. -
requireNonNull
Description copied from class:JsonNodeMethod that may be called to verify thatthisnode is neither so-called "missing node" (that is, one for whichJsonNode.isMissingNode()returnstrue) nor "null node" (one for whichJsonNode.isNull()returnstrue). If non-null non-missing node,thisis returned to allow chaining; otherwise exception is thrown.- Overrides:
requireNonNullin classJsonNode- Returns:
thisnode to allow chaining
-
get
Description copied from class:JsonNodeMethod for accessing value of the specified element of an array node. For other nodes, null is always returned.For array nodes, index specifies exact location within array and allows for efficient iteration over child elements (underlying storage is guaranteed to be efficiently indexable, i.e. has random-access to elements). If index is less than 0, or equal-or-greater than
node.size(), null is returned; no exception is thrown for any index.NOTE: if the element value has been explicitly set as
null(which is different from removal!), aNullNodewill be returned, not null. -
path
Description copied from class:JsonNodeThis 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:JsonNodeThis 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. -
_at
Description copied from class:JsonNodeHelper method used by other methods for traversing the next step of given path expression, and returning matching value node if any: if no match,nullis returned. -
findValue
Description copied from class:JsonNodeMethod for finding the first JSON Object field with specified name in this node or its child nodes, and returning value it has. If no matching field is found in this node or its descendants, returns null.Note that traversal is done in document order (that is, order in which nodes are iterated if using
JsonNode.values()) -
findParent
Description copied from class:JsonNodeMethod for finding a JSON Object that contains specified field, within this node or its descendants. If no matching field is found in this node or its descendants, returns null.- Specified by:
findParentin classJsonNode- Parameters:
fieldName- Name of field to look for- Returns:
- Value of first matching node found, if any; null if none
-
findValues
- Specified by:
findValuesin classJsonNode
-
findValuesAsString
- Specified by:
findValuesAsStringin classJsonNode
-
findParents
- Specified by:
findParentsin classJsonNode
-
serialize
Description copied from class:BaseJsonNodeMethod called to serialize node instances using given generator.- Specified by:
serializein interfaceJacksonSerializable- Specified by:
serializein classBaseJsonNode- Throws:
JacksonException
-
serializeWithType
public void serializeWithType(JsonGenerator g, SerializationContext provider, TypeSerializer typeSer) throws JacksonException Description copied from class:BaseJsonNodeType information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.- Specified by:
serializeWithTypein interfaceJacksonSerializable- Specified by:
serializeWithTypein classBaseJsonNode- Throws:
JacksonException
-
equals
Description copied from class:JsonNodeEquality for node objects is defined as full (deep) value equality. This means that it is possible to compare complete JSON trees for equality by comparing equality of root nodes.Note: marked as abstract to ensure all implementation classes define it properly and not rely on definition from
Object. -
hashCode
public int hashCode()- Specified by:
hashCodein classBaseJsonNode
-
toString
Description copied from class:JsonNodeMethod that will produce (as of Jackson 2.10) valid JSON using default settings of databind, as String. If you want other kinds of JSON output (or output formatted using one of other Jackson-supported data formats) make sure to useObjectMapperorObjectWriterto serialize an instance, for example:String json = objectMapper.writeValueAsString(rootNode);
Note: method defined as abstract to ensure all implementation classes explicitly implement method, instead of relying on
Object.toString()definition.- Overrides:
toStringin classBaseJsonNode
-
toPrettyString
Description copied from class:JsonNodeAlternative toJsonNode.toString()that will serialize this node using Jackson default pretty-printer.- Overrides:
toPrettyStringin classBaseJsonNode
-