-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or later
Milestone
Description
(note: part of https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-3 changes)
Currently there is concept of "missing" node (impl MissingNode
, detectable via JsonNode.isMissingNode()
), returned in cases where Java 8
Optional.empty()
would commonly be used. Partly this is due to "missing node" concept predating Jackson using Java 8 as base line, and partly due to wanting to avoid extra layering for common case of "not-missing" nodes.
Be that as it may, use of Optional
is convenient with Java 8 Stream methods, so it makes sense to add some support.
To this end, let's add method
Optional<JsonNode> asOptional();
which will return
Optional.empty()
forMissingNode
Optional.of(this)
for all otherJsonNode
types- that is,
Optional.ofNullable(this.isMissingNode() ? null : this)
if implemented atJsonNode
level
Metadata
Metadata
Assignees
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or later