开发者

Save creation of DecimalFormat with local and Rounding Mode

I want create an instance of an NumberFormater with local (german) and rounding mode (Half Down) without cast and without any may unsave method or cast.

Up to now I was doing

NumberFormat format = NumberFormat.getIns开发者_高级运维tance(Locale.GERMAN);
format.setRoundingMode(RoundingMode.HALF_DOWN);

But then Findbugs nag:

DMI_UNSUPPORTED_METHOD

Call to unsupported method java.text.NumberFormat.setRoundingMode(RoundingMode) in new Demo()

All targets of this method invocation throw an UnsupportedOperationException.

Is there any other way to create such an instance without warning, than cast NumberFormat to Decimal Format or Disable this warning?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜