Class MessageFormatTemplateEngine

java.lang.Object
org.jdbi.v3.core.statement.MessageFormatTemplateEngine
All Implemented Interfaces:
TemplateEngine

@Deprecated public class MessageFormatTemplateEngine extends Object implements TemplateEngine
Deprecated.
MessageFormat formats integers with decimal separators, e.g. 1000"1,000". This hindsight realization has led us to discourage its use.
Uses the equivalent of MessageFormat.format(String, Object...) as a template engine. You must use "0", "1", "2", etc as keys: start at 0, increment by 1. Keys must be numerically unique. You must Configurable.define(String, Object) as many key/value pairs as there are placeholders in the pattern string. You may define key/value pairs in any order. Keys may contain leading '0's. Any invalid use will trigger an IllegalArgumentException (or subclasses such as NumberFormatException) when render(String, StatementContext) is called – typically when the statement is about to be executed. Example usage:

     // select bar from foo where col = 'abc'
     jdbi.useHandle(handle -> handle.createCall("select {1} from {0} where col = ''{2}''")
         .setTemplateEngine(MessageFormatTemplateEngine.INSTANCE)
         .define("0", "foo")
         .define("1", "bar")
         .define("2", "abc")
         .invoke());