DoubleRenderer class
A localized renderer based on {@link NumberFormat#getDecimalFormat}.
class DoubleRenderer extends AbstractRenderer<double> { static DoubleRenderer _INSTANCE; /** * Returns the instance. */ factory DoubleRenderer.instance() { if (_INSTANCE == null) { _INSTANCE = new DoubleRenderer(); } return _INSTANCE; } DoubleRenderer(); String render(double object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().formatDouble(object); } }
Extends
AbstractRenderer<double> > DoubleRenderer
Constructors
new DoubleRenderer() #
factory DoubleRenderer.instance() #
Returns the instance.
factory DoubleRenderer.instance() { if (_INSTANCE == null) { _INSTANCE = new DoubleRenderer(); } return _INSTANCE; }
Methods
String render(double object) #
void renderTo(T object, Appendable appendable) #
inherited from AbstractRenderer
Renders {@code object} as plain text, appended directly to {@code appendable}. Should never throw any exceptions except if {@code appendable} throws an {@code IOException}.
void renderTo(T object, Appendable appendable) { appendable.append(render(object)); }