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?
精彩评论