MCPcopy Index your code
hub / github.com/antlr/codebuff / NumberRenderer

Class NumberRenderer

output/java8/1.4.17/NumberRenderer.java:44–53  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

42
43
44public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected