- All Implemented Interfaces:
Serializable,Iterable<JsonNode>,TreeNode,JacksonSerializable
- Direct Known Subclasses:
BinaryNode,BooleanNode,NullNode,NumericNode,POJONode,StringNode
- 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
FieldsModifier and TypeFieldDescriptionprotected static final BigDecimalprotected static final BigDecimalprotected static final BigDecimalprotected static final BigDecimalprotected static final BigDecimalprotected static final BigDecimalprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final JsonNodeFields 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.abstract JsonTokenasToken()Method that can be used for efficient type detection when using stream abstraction for traversing nodes.deepCopy()All current value nodes are immutable, so we can just return them as is.final ObjectNodefindParent(String fieldName) Method for finding a JSON Object that contains specified field, within this node or its descendants.findParents(String fieldName, List<JsonNode> foundSoFar) final JsonNodeMethod 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) final JsonNodeget(int index) Method for accessing value of the specified element of an array node.final JsonNodeMethod for accessing value of the specified field of an object node.final booleanhas(int index) Method that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.final booleanMethod that allows checking whether this node is JSON Object node and contains value for specified property.final booleanhasNonNull(int index) Method that is similar toJsonNode.has(int), but that will returnfalsefor explicitly added nulls.final booleanhasNonNull(String fieldName) Method that is similar toJsonNode.has(String), but that will returnfalsefor explicitly added nulls.booleanisEmpty()Convenience method that is functionally same as:final JsonNodepath(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.final 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.voidserializeWithType(JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.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, _valueDesc, _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, hashCode, intValue, intValue, intValueOpt, isEmbeddedValue, isMissingNode, longValue, longValue, longValueOpt, numberType, numberValue, required, required, serialize, shortValue, shortValue, shortValueOpt, stringValue, stringValue, stringValueOpt, toPrettyString, toString, traverse, withArray, withObjectMethods inherited from class tools.jackson.databind.JsonNode
_reportRequiredViolation, _reportUnsupportedOperation, _this, asOptional, asText, asText, at, at, canConvertToExactIntegral, canConvertToInt, canConvertToLong, canConvertToShort, equals, equals, findParents, findValues, findValuesAsString, forEachEntry, getNodeType, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainer, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isObject, isPojo, isShort, isString, isTextual, isValueNode, iterator, optional, optional, properties, propertyNames, propertyStream, require, requiredAt, requiredAt, requireNonNull, size, spliterator, textValue, values, valueStream, withArray, withArray, withArray, withArrayProperty, withObject, withObject, withObject, withObjectPropertyMethods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Field Details
-
BI_MIN_SHORT
-
BI_MAX_SHORT
-
BI_MIN_INTEGER
-
BI_MAX_INTEGER
-
BI_MIN_LONG
-
BI_MAX_LONG
-
BD_MIN_SHORT
-
BD_MAX_SHORT
-
BD_MIN_INTEGER
-
BD_MAX_INTEGER
-
BD_MIN_LONG
-
BD_MAX_LONG
-
MISSING
-
-
Constructor Details
-
ValueNode
protected ValueNode()
-
-
Method Details
-
_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. -
deepCopy
All current value nodes are immutable, so we can just return them as is. -
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
-
serializeWithType
public void serializeWithType(JsonGenerator g, SerializationContext ctxt, 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
-
isEmpty
public boolean isEmpty()Description copied from class:JsonNodeConvenience method that is functionally same as:size() == 0for all node types. -
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(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. -
has
public final boolean has(int index) Description copied from class:JsonNodeMethod that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.Note: array element indexes are 0-based.
This method is equivalent to:
node.get(index) != null
NOTE: this method will return
truefor explicitly added null values. -
hasNonNull
public final boolean hasNonNull(int index) Description copied from class:JsonNodeMethod that is similar toJsonNode.has(int), but that will returnfalsefor explicitly added nulls.This method is equivalent to:
node.get(index) != null && !node.get(index).isNull()
- Overrides:
hasNonNullin classJsonNode
-
get
Description copied from class:JsonNodeMethod 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), or if there is no field with such name, null is returned.NOTE: if the property 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. -
has
Description copied from class:JsonNodeMethod that allows checking whether this node is JSON Object node and contains value for specified property. If this is the case (including properties with explicit null values), returns true; otherwise returns false.This method is equivalent to:
node.get(propertyName) != null
(since return value of get() is node, not value node contains)NOTE: when explicit
nullvalues are added, this method will returntruefor such properties. -
hasNonNull
Description copied from class:JsonNodeMethod that is similar toJsonNode.has(String), but that will returnfalsefor explicitly added nulls.This method is functionally equivalent to:
node.get(propertyName) != null && !node.get(propertyName).isNull()
- Overrides:
hasNonNullin classJsonNode
-
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
-