FasterXML / FasterXML/jackson3-dev

Change `JsonNode.asXxx()` methods with no defaults to throw exception; add in `TreeNode`

オープン
#6 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
functionality-change
主要言語
言語のデータがありません
スター
6
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently various `asXxx()` methods (like, say, `asInt()`) return default value (like `0` for `int`) in case where no conversion is possible. But it would usually be better to instead throw an exception since there are already variants that allow passing of default value to return in invalid case.
Throwing exception instead would allow caller to avoid potentially odd and unhelpful coercions into default value. Given existence of alternatives with defaults no functionality would be removed.

In addition to this change it would make sense to add (demote) these methods in `TreeNode`, esp. since we can use Java 8 default methods for interfaces.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。