- All Implemented Interfaces:
Serializable,Iterable<JsonNode>,ObjectTreeNode,TreeNode,JacksonSerializable,JsonNodeCreator
- 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
FieldsFields inherited from class tools.jackson.databind.node.ContainerNode
_nodeFactoryFields 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 boolean_childrenEqual(ObjectNode other) Helper method for encapsulating details of accessing child node entries to serialize.protected ObjectNodeprotected StringMethod for implementation classes to return a short description of contained value, to be used in error messages.protected ArrayNode_withArray(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex) protected ArrayNode_withArrayAddTailProperty(JsonPointer tail, boolean preferIndex) protected ObjectNode_withObject(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex) protected ObjectNode_withObjectAddTailProperty(JsonPointer tail, boolean preferIndex) 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.booleanequals(Comparator<JsonNode> comparator, JsonNode o) Entry method for invoking customizable comparison, using passed-inComparatorobject.findParent(String propertyName) Method for finding a JSON Object that contains specified field, within this node or its descendants.findParents(String propertyName, 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 propertyName, List<JsonNode> foundSoFar) findValuesAsString(String propertyName, List<String> foundSoFar) voidforEachEntry(BiConsumer<? super String, ? super JsonNode> action) If this node is anObjectNode, performs the given action for each property (key, value pair) until all entries have been processed or the action throws an exception.get(int index) Method for accessing value of the specified element of an array node.Method for accessing value of the specified field of an object node.Return the type of this nodeinthashCode()booleanisEmpty()Convenience method that is functionally same as:booleanisEmpty(SerializationContext serializers) Method that may be called on instance to determine if it is considered "empty" for purposes of serialization filtering or not.final booleanisObject()Method for accessing value of the specified field of an object node.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.Method to use for accessing all properties (with both names and values) of this JSON Object.Returns a stream of all properties (key, value pairs) of this Node, iff this node is an anObjectNode.Method for setting value of a property to specified String value.Method for setting value of a property to specified binary valueMethod for setting value of a property to specified numeric value.Method for setting value of a property to specified numeric value.Method for setting value of a property to specified numeric value.Method for setting value of a property to specified numeric value.Method for setting value of a property to specified numeric value.Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.Method for setting value of a property to specified numeric value.Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.Method for setting value of a property to specified String value.put(String propertyName, BigDecimal v) Method for setting value of a property to specified numeric value.put(String propertyName, BigInteger v) Method for setting value of a property to specified numeric value.Method that will construct an ArrayNode and add it as a property of thisObjectNode, replacing old value, if any.putIfAbsent(String propertyName, JsonNode value) Method that will set value of specified property if (and only if) it had no set value previously.Method for setting value of a property to explicitnullvalue.Method that will construct an ObjectNode and add it as a property of thisObjectNode, replacing old value, if any.Method for adding an opaque Java value as the value of specified property.putRawValue(String propertyName, RawValue raw) Method for removing a property from thisObjectNode.remove(Collection<String> propertyNames) Method for removing specified properties out of this ObjectNode.Method for removing all properties, such that this ObjectNode will contain no properties after call.Method for removing matching those children (value) nodes container has that match given predicate.Method for replacing value of specific property with passed value, and returning previous value (or null if none).Method is functionally equivalent topath(propertyName).required()and can be used to check that this node is anObjectNode(that is, represents JSON Object value) and has value for specified property with keypropertyName(but note that value may be explicit JSON null value).Method for removing all properties out of this ObjectNode except for ones specified in argument.retain(Collection<String> propertyNames) Method for removing all properties out of this ObjectNode except for ones specified in argument.voidserialize(JsonGenerator g, SerializationContext ctxt) Method that can be called to serialize this node and all of its descendants using specified JSON generator.protected voidserializeFilteredContents(JsonGenerator g, SerializationContext ctxt, boolean trimEmptyArray, boolean skipNulls) Helper method shared and called byserialize(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext)andserializeWithType(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext, tools.jackson.databind.jsontype.TypeSerializer)in cases where actual filtering is needed based on configuration.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.Method that will set specified property, replacing old value, if any.Method for adding given properties to this object node, overriding any existing values for those properties.setAll(ObjectNode other) Method for adding all properties of the given Object, overriding any existing values for those properties.intsize()values()Method for accessing all value nodes of this Node, iff this node is a JSON Array or Object node.Returns a stream of all value nodes of this Node, iff this node is anArrayNodeorObjectNode.Short-cut equivalent to:withArrayProperty(String propName) Method similar toJsonNode.withArray(JsonPointer, OverwriteMode, boolean)-- basically short-cut to:withObject(String exprOrProperty) Method that works in one of possible ways, depending on whetherexprOrPropertyis a validJsonPointerexpression or not (valid expression is either empty String""or starts with leading slash/character).withObjectProperty(String propName) Method similar toJsonNode.withObject(JsonPointer, OverwriteMode, boolean)-- basically short-cut to:Method for removing property from this ObjectNode, and returning instance after removal.without(Collection<String> propertyNames) Method for removing specified properties out of this ObjectNode.Methods inherited from class tools.jackson.databind.node.ContainerNode
arrayNode, arrayNode, binaryNode, binaryNode, booleanNode, isContainer, missingNode, nullNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, objectNode, pojoNode, rawValueNode, removeNulls, stringNodeMethods 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, _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, isMissingNode, longValue, longValue, longValueOpt, numberType, numberValue, required, 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, findParents, findValues, findValuesAsString, has, has, hasNonNull, hasNonNull, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isPojo, isShort, isString, isTextual, isValueNode, iterator, optional, require, requiredAt, requiredAt, requireNonNull, spliterator, textValue, withArray, withArray, withObject, withObjectMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface tools.jackson.databind.node.JsonNodeCreator
textNodeMethods inherited from interface tools.jackson.core.TreeNode
at, at, isArray, isContainer, isEmbeddedValue, isMissingNode, isNull, isValueNode, numberType, traverse
-
Field Details
-
_children
-
-
Constructor Details
-
ObjectNode
-
ObjectNode
-
-
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. -
_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
-
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.
-
withObject
Description copied from class:JsonNodeMethod that works in one of possible ways, depending on whetherexprOrPropertyis a validJsonPointerexpression or not (valid expression is either empty String""or starts with leading slash/character). If it is, works as a short-cut to:withObject(JsonPointer.compile(exprOrProperty));
If it is NOT a validJsonPointerexpression, value is taken as a literal Object property name and calls is alias forwithObjectProperty(exprOrProperty);
- Overrides:
withObjectin classJsonNode- Parameters:
exprOrProperty-JsonPointerexpression to use (if valid as one), or, if not (no leading "/"), property name to match.- Returns:
ObjectNodefound or created
-
withObjectProperty
Description copied from class:JsonNodeMethod similar toJsonNode.withObject(JsonPointer, OverwriteMode, boolean)-- basically short-cut to:withObject(JsonPointer.compile("/"+propName), OverwriteMode.NULLS, false);that is, only matches immediate property onObjectNodeand will either use an existingObjectNodethat is value of the property, or create one if no value or value isNullNode.
Will fail with an exception if:- Node method called on is NOT
ObjectNode - Property has an existing value that is NOT
NullNode(explicitnull)
- Overrides:
withObjectPropertyin classJsonNode- Parameters:
propName- Name of property that has or will haveObjectNodeas value- Returns:
ObjectNodevalue of given property (existing or created)
- Node method called on is NOT
-
withArray
Description copied from class:JsonNodeShort-cut equivalent to:withArray(JsonPointer.compile(expr), overwriteMode, preferIndex);
-
withArrayProperty
Description copied from class:JsonNodeMethod similar toJsonNode.withArray(JsonPointer, OverwriteMode, boolean)-- basically short-cut to:withArray(JsonPointer.compile("/"+propName), OverwriteMode.NULLS, false);that is, only matches immediate property onObjectNodeand will either use an existingArrayNodethat is value of the property, or create one if no value or value isNullNode.
Will fail with an exception if:- Node method called on is NOT
ObjectNode - Property has an existing value that is NOT
NullNode(explicitnull)
- Overrides:
withArrayPropertyin classJsonNode- Parameters:
propName- Name of property that has or will haveArrayNodeas value- Returns:
ArrayNodevalue of given property (existing or created)
- Node method called on is NOT
-
_withObject
protected ObjectNode _withObject(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex) - Specified by:
_withObjectin classContainerNode<ObjectNode>
-
_withArray
protected ArrayNode _withArray(JsonPointer origPtr, JsonPointer currentPtr, JsonNode.OverwriteMode overwriteMode, boolean preferIndex) - Overrides:
_withArrayin classBaseJsonNode
-
_withObjectAddTailProperty
-
_withArrayAddTailProperty
-
isEmpty
Description copied from class:JacksonSerializable.BaseMethod that may be called on instance to determine if it is considered "empty" for purposes of serialization filtering or not.- Overrides:
isEmptyin classJacksonSerializable.Base
-
getNodeType
Description copied from class:JsonNodeReturn the type of this node- Specified by:
getNodeTypein classJsonNode- Returns:
- the node type as a
JsonNodeTypeenum value
-
isObject
public final boolean isObject() -
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 classContainerNode<ObjectNode>
-
size
public int size()- Specified by:
sizein interfaceTreeNode- Specified by:
sizein classContainerNode<ObjectNode>
-
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.- Specified by:
getin interfaceTreeNode- Specified by:
getin classContainerNode<ObjectNode>- Returns:
- Node that represent value of the specified element, if this node is an array and has specified element. Null otherwise.
-
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.- Specified by:
getin interfaceTreeNode- Specified by:
getin classContainerNode<ObjectNode>- Returns:
- Node that represent value of the specified field, if this node is an object and has value for the specified field. Null otherwise.
-
optional
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, emptyOptionalis returned.NOTE: if the property value has been explicitly set as
null(which is different from removal!), an Optional containingNullNodewill 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. -
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. -
required
Description copied from class:JsonNodeMethod is functionally equivalent topath(propertyName).required()and can be used to check that this node is anObjectNode(that is, represents JSON Object value) and has value for specified property with keypropertyName(but note that value may be explicit JSON null value). If this node is Object Node and has value for specified property, matching value is returned; otherwiseIllegalArgumentExceptionis thrown.- Overrides:
requiredin classBaseJsonNode- Parameters:
propertyName- Name of property to access- Returns:
- Value of the specified property of this Object node
-
values
Description copied from class:JsonNodeMethod for accessing all value nodes of this Node, iff this node is a JSON Array or Object node. In case of Object node, field names (keys) are not included, only values. For other types of nodes, returns empty iterator. -
valueStream
Description copied from class:JsonNodeReturns a stream of all value nodes of this Node, iff this node is anArrayNodeorObjectNode. In case ofObjectnode, property names (keys) are not included, only values. For other types of nodes, returns empty stream.- Specified by:
valueStreamin classContainerNode<ObjectNode>
-
propertyNames
- Specified by:
propertyNamesin interfaceTreeNode- Overrides:
propertyNamesin classJsonNode
-
properties
Method to use for accessing all properties (with both names and values) of this JSON Object.- Overrides:
propertiesin classJsonNode- Returns:
- Set of properties, if this node is an
ObjectNode(JsonNode.isObject()returnstrue); emptySetotherwise.
-
propertyStream
Description copied from class:JsonNodeReturns a stream of all properties (key, value pairs) of this Node, iff this node is an anObjectNode. For other types of nodes, returns empty stream.- Overrides:
propertyStreamin classJsonNode
-
forEachEntry
Description copied from class:JsonNodeIf this node is anObjectNode, performs the given action for each property (key, value pair) until all entries have been processed or the action throws an exception. Exceptions thrown by the action are relayed to the caller. For other node types, no action is performed.Actions are performed in the order of properties, same as order returned by method
JsonNode.properties(). This is generally the document order of properties in JSON object.- Overrides:
forEachEntryin classJsonNode- Parameters:
action- Action to perform for each entry
-
equals
Description copied from class:JsonNodeEntry method for invoking customizable comparison, using passed-inComparatorobject. Nodes will handle traversal of structured types (arrays, objects), but defer to comparator for scalar value comparisons. If a "natural"Comparatoris passed -- one that simply callsequals()on one of arguments, passing the other -- implementation is the same as directly callingequals()on node.Default implementation simply delegates to passed in
comparator, withthisas the first argument, andotheras the second argument. -
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()) -
findValues
- Specified by:
findValuesin classJsonNode
-
findValuesAsString
- Specified by:
findValuesAsStringin classJsonNode
-
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:
propertyName- Name of field to look for- Returns:
- Value of first matching node found, if any; null if none
-
findParents
- Specified by:
findParentsin classJsonNode
-
serialize
Method that can be called to serialize this node and all of its descendants using specified JSON generator.- Specified by:
serializein interfaceJacksonSerializable- Specified by:
serializein classBaseJsonNode- Throws:
JacksonException
-
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
-
serializeFilteredContents
protected void serializeFilteredContents(JsonGenerator g, SerializationContext ctxt, boolean trimEmptyArray, boolean skipNulls) throws JacksonException Helper method shared and called byserialize(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext)andserializeWithType(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext, tools.jackson.databind.jsontype.TypeSerializer)in cases where actual filtering is needed based on configuration.- Throws:
JacksonException
-
_contentsToSerialize
Helper method for encapsulating details of accessing child node entries to serialize.- Since:
- 2.16
-
set
Method that will set specified property, replacing old value, if any. Note that this is identical toreplace(String, JsonNode), except for return value.- Parameters:
propertyName- Name of property to setvalue- Value to set property to; if null, will be converted to aNullNodefirst (to remove a property, callremove(java.lang.String)instead)- Returns:
- This node after adding/replacing property value (to allow chaining)
-
setAll
Method for adding given properties to this object node, overriding any existing values for those properties.NOTE:
nullkeys are not allowed; (nullvalues get converted to aNullNode).- Parameters:
properties- Properties to add- Returns:
- This node after adding/replacing property values (to allow chaining)
-
setAll
Method for adding all properties of the given Object, overriding any existing values for those properties.- Parameters:
other- Object of which properties to add to this object- Returns:
- This node after addition (to allow chaining)
-
replace
Method for replacing value of specific property with passed value, and returning previous value (or null if none).- Parameters:
propertyName- Property of which value to replace: must not benullvalue- Value to set property to, replacing old value if any- Returns:
- Old value of the property; null if there was no such property with value
-
without
Method for removing property from this ObjectNode, and returning instance after removal.- Returns:
- This node after removing property (if any)
-
without
Method for removing specified properties out of this ObjectNode.- Parameters:
propertyNames- Names of properties to remove- Returns:
- This node after removing entries
-
putIfAbsent
Method that will set value of specified property if (and only if) it had no set value previously. Note that explicitly setnullis a value. Functionally equivalent to:if (get(propertyName) == null) { set(propertyName, value); return null; } else { return get(propertyName); }- Parameters:
propertyName- Name of property to set (must not benull)value- Value to set to property (if and only if it had no value previously); if null, will be converted to aNullNodefirst.- Returns:
- Old value of the property, if any (in which case value was not changed); null if there was no old value (in which case value is now set)
-
remove
Method for removing a property from thisObjectNode. Will return previous value of the property, if such property existed; null if not.- Returns:
- Value of specified property, if it existed; null if not
-
remove
Method for removing specified properties out of this ObjectNode.- Parameters:
propertyNames- Names of properties to remove- Returns:
- This node after removing entries
-
removeAll
Method for removing all properties, such that this ObjectNode will contain no properties after call.- Specified by:
removeAllin classContainerNode<ObjectNode>- Returns:
- This node after removing all entries
-
removeIf
Description copied from class:ContainerNodeMethod for removing matching those children (value) nodes container has that match given predicate.- Specified by:
removeIfin classContainerNode<ObjectNode>- Parameters:
predicate- Predicate to use for matching: anything matching will be removed- Returns:
- Container node itself (to allow method call chaining)
-
retain
Method for removing all properties out of this ObjectNode except for ones specified in argument.- Parameters:
propertyNames- Properties to retain in this ObjectNode- Returns:
- This node (to allow call chaining)
-
retain
Method for removing all properties out of this ObjectNode except for ones specified in argument.- Parameters:
propertyNames- Properties to retain in this ObjectNode- Returns:
- This node (to allow call chaining)
-
putArray
Method that will construct an ArrayNode and add it as a property of thisObjectNode, replacing old value, if any.NOTE: Unlike all put(...) methods, return value is NOT this
ObjectNode, but the newly createdArrayNodeinstance.- Returns:
- Newly constructed ArrayNode (NOT the old value,
which could be of any type, nor
thisnode)
-
putObject
Method that will construct an ObjectNode and add it as a property of thisObjectNode, replacing old value, if any.NOTE: Unlike all put(...) methods, return value is NOT this
ObjectNode, but the newly createdObjectNodeinstance.- Returns:
- Newly constructed ObjectNode (NOT the old value,
which could be of any type, nor
thisnode)
-
putPOJO
Method for adding an opaque Java value as the value of specified property. Value can be serialized like any other property, as long as Jackson can serialize it. Despite term "POJO" this allows use of about any Java type, includingMaps,Collections, as well as Beans (POJOs), primitives/wrappers and evenJsonNodes. Method is most commonly useful when composing content to serialize from heterogenous sources.NOTE: if using
JsonNode.toString()(orJsonNode.toPrettyString()support for serialization may be more limited, compared to serializing node with specifically configuredObjectMapper.- Parameters:
propertyName- Name of property to set.pojo- Java value to set as the property value- Returns:
- This
ObjectNode(to allow chaining)
-
putRawValue
-
putNull
Method for setting value of a property to explicitnullvalue.- Parameters:
propertyName- Name of property to set.- Returns:
- This
ObjectNode(to allow chaining)
-
put
Method for setting value of a property to specified numeric value.- Returns:
- This node (to allow chaining)
-
put
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value. The underlyingJsonNodethat will be added is constructed usingJsonNodeFactory.numberNode(int), and may be "smaller" (likeShortNode) in cases where value fits within range of a smaller integral numeric value.- Returns:
- This node (to allow chaining)
-
put
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value. The underlyingJsonNodethat will be added is constructed usingJsonNodeFactory.numberNode(long), and may be "smaller" (likeIntNode) in cases where value fits within range of a smaller integral numeric value.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value. The underlyingJsonNodethat will be added is constructed usingJsonNodeFactory.numberNode(Long), and may be "smaller" (likeIntNode) in cases where value fits within range of a smaller integral numeric value.Note that this is alternative to
put(String, long)needed to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value.- Returns:
- This node (to allow chaining)
-
put
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value.- Returns:
- This node (to allow chaining)
-
put
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified numeric value.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified String value.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified String value.- Returns:
- This node (to allow chaining)
-
put
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.- Returns:
- This node (to allow chaining)
-
put
Method for setting value of a property to specified binary value- Returns:
- This node (to allow chaining)
-
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. -
_childrenEqual
-
hashCode
public int hashCode()- Specified by:
hashCodein classBaseJsonNode
-
_put
-