You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is concept of "missing" node (impl MissingNode, detectable via JsonNode.isMissingNode()), returned in cases where Java 8Optional.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() for MissingNode
Optional.of(this) for all other JsonNode types
that is, Optional.ofNullable(this.isMissingNode() ? null : this) if implemented at JsonNode level
The text was updated successfully, but these errors were encountered:
(note: part of https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-3 changes)
Currently there is concept of "missing" node (impl
MissingNode
, detectable viaJsonNode.isMissingNode()
), returned in cases whereJava 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
which will return
Optional.empty()
forMissingNode
Optional.of(this)
for all otherJsonNode
typesOptional.ofNullable(this.isMissingNode() ? null : this)
if implemented atJsonNode
levelThe text was updated successfully, but these errors were encountered: