Skip to content

Commit

Permalink
Update JsonNode.java (#4476)
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim authored and cowtowncoder committed Apr 8, 2024
1 parent 01f24af commit b632c47
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/com/fasterxml/jackson/databind/JsonNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,17 +631,18 @@ public byte[] binaryValue() throws IOException {
public abstract String asText();

/**
* Method similar to {@link #asText()}, except that it will return
* <code>defaultValue</code> in cases where null value would be returned;
* either for missing nodes (trying to access missing property, or element
* at invalid item for array) or explicit nulls.
* Returns the text value of this node or the provided {@code defaultValue} if this node
* does not have a text value. Useful for nodes that are {@link MissingNode} or
* {@link com.fasterxml.jackson.databind.node.NullNode}, ensuring a default value is returned instead of null or missing indicators.
*
*<p>
* NOTE: deprecated since 2.17 because {@link #asText()} very rarely returns
* {@code null} for any node types -- in fact, neither {@link MissingNode}
* nor {@code NullNode} return {@code null} from {@link #asText()}.
*
* @param defaultValue The default value to return if this node's text value is absent.
* @return The text value of this node, or defaultValue if the text value is absent.
* @since 2.4
*
* @deprecated Since 2.17, to be removed from 3.0
*/
@Deprecated // @since 2.17
Expand Down

0 comments on commit b632c47

Please sign in to comment.