IntegerRenderer class
A localized renderer based on {@link NumberFormat#getDecimalFormat}.
class IntegerRenderer extends AbstractRenderer<int> { static IntegerRenderer _INSTANCE; /** * Returns the instance. */ factory IntegerRenderer.instance() { if (_INSTANCE == null) { _INSTANCE = new IntegerRenderer(); } return _INSTANCE; } IntegerRenderer(); String render(int object) { if (object == null) { return ""; } return NumberFormat.getDecimalFormat().formatInt(object); } }
Extends
AbstractRenderer<int> > IntegerRenderer
Constructors
new IntegerRenderer() #
factory IntegerRenderer.instance() #
Returns the instance.
factory IntegerRenderer.instance() { if (_INSTANCE == null) { _INSTANCE = new IntegerRenderer(); } return _INSTANCE; }
Methods
String render(int 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)); }