Works with Byte, Short, Integer, Long, and BigInteger as well as Float, Double, and BigDecimal. You pass in a format string suitable for Formatter#format. For example, %10d emits a number as a decimal int paddin
| 42 | |
| 43 | |
| 44 | public class NumberRenderer implements AttributeRenderer { |
| 45 | @Override |
| 46 | public String toString(Object o, String formatString, Locale locale) { |
| 47 | // o will be instanceof Number |
| 48 | if (formatString==null ) return o.toString(); |
| 49 | Formatter f = new Formatter(locale); |
| 50 | f.format(formatString, o); |
| 51 | return f.toString(); |
| 52 | } |
| 53 | } |
nothing calls this directly
no outgoing calls
no test coverage detected