Package com.blazebit.persistence.spi
Class TemplateRenderer
java.lang.Object
com.blazebit.persistence.spi.TemplateRenderer
A template renderer is a thread safe string renderer that can bind values to parameters.
It is not as sophisticated as
MessageFormat
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
Modifier and TypeClassDescriptionstatic class
A context for a template renderer that supports binding function arguments or plain strings as values for placeholders. -
Constructor Summary
ConstructorDescriptionTemplateRenderer
(String template) Creates a new template renderer from the given template. -
Method Summary
Modifier and TypeMethodDescriptionstart
(FunctionRenderContext context) Starts a new context for the given FunctionRenderContext for building parameter bindings.
-
Constructor Details
-
TemplateRenderer
Creates a new template renderer from the given template.- Parameters:
template
- The template on which this renderer is based.
-
-
Method Details
-
start
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
-