Package com.blazebit.persistence.spi
Class TemplateRenderer
- java.lang.Object
-
- com.blazebit.persistence.spi.TemplateRenderer
-
public class TemplateRenderer extends Object
A template renderer is a thread safe string renderer that can bind values to parameters. It is not as sophisticated asMessageFormat
but in contrast can be shared between threads because it is immutable. Parameters are denoted by a question mark directly followed by the parameter index. The following example should illustrate the usage.new TemplateRenderer("?1 limit ?2") .start(context) .addArgument(1) .addArgument(2) .build();
- Since:
- 1.0.6
- Author:
- Christian Beikov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TemplateRenderer.Context
A context for a template renderer that supports binding function arguments or plain strings as values for placeholders.
-
Constructor Summary
Constructors Constructor Description TemplateRenderer(String template)
Creates a new template renderer from the given template.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateRenderer.Context
start(FunctionRenderContext context)
Starts a new context for the given FunctionRenderContext for building parameter bindings.
-
-
-
Constructor Detail
-
TemplateRenderer
public TemplateRenderer(String template)
Creates a new template renderer from the given template.- Parameters:
template
- The template on which this renderer is based.
-
-
Method Detail
-
start
public TemplateRenderer.Context start(FunctionRenderContext context)
Starts a new context for the given FunctionRenderContext for building parameter bindings.- Parameters:
context
- The render context for the function- Returns:
- A context for binding parameter values
-
-