PassthroughRenderer class
A no-op String renderer. This is rarely or never the right thing to use in production, but it's handy for tests.
class PassthroughRenderer extends AbstractRenderer<String> { static PassthroughRenderer _instance; /** * Returns the instance of the no-op renderer. */ factory PassthroughRenderer.instance() { if (_instance == null) { _instance = new PassthroughRenderer(); } return _instance; } PassthroughRenderer(); String render(String object) { return object; } }
Extends
AbstractRenderer<String> > PassthroughRenderer
Constructors
new PassthroughRenderer() #
factory PassthroughRenderer.instance() #
Returns the instance of the no-op renderer.
factory PassthroughRenderer.instance() { if (_instance == null) { _instance = new PassthroughRenderer(); } return _instance; }
Methods
String render(String 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)); }