It would be great to get some comments on this, if anyone has opinions.
Initially I was bit concerned on adding mutability methods (add, remove) in JsonNode, which for now has only contained read-methods. But after thinking about it a bit, I think that it is acceptable trade-off (with proper failure modes) between convenience and purity.
But the return value is something I still feel ambivalent about. Most other methods allow "fail-safe" operation: for example, using "node.path("someField")" will never fail OR return null -- if no such property exists, a `MissingNode` instance is returned; node which may still be traversed, but never evaluates to anything.
In same way, one could suggest that `add()` and/or `remove()` could quietly ignore operations that are not applicable (add/remove on scalar value node, or even MissingNode), and either return normally (where 'this' is returned), return bogus node ('MissingNode'), or perhaps use boolean value to indicate success/fail of the operation.
Alternatively, one may choose to throw an exception on invalid operation. There are some benefits to doing this as well.
Regardless, I think this is a great addition; and in the end in absence of suggestions otherwise we may just proceed with proposed implementation as-is. So I take absence of comments to be tacit LGTM. :)
-+ Tatu +-