Package org.jdbi.v3.core.statement
Class MessageFormatTemplateEngine
- java.lang.Object
-
- org.jdbi.v3.core.statement.MessageFormatTemplateEngine
-
- All Implemented Interfaces:
TemplateEngine
@Deprecated public class MessageFormatTemplateEngine extends java.lang.Object implements TemplateEngine
Deprecated.MessageFormatformats integers with decimal separators, e.g.1000→"1,000". This hindsight realization has led us to discourage its use.Uses the equivalent ofMessageFormat.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 mustConfigurable.define(String, Object)as many key/value pairs as there are placeholders in the pattern string. You maydefinekey/value pairs in any order. Keys may contain leading'0's. Any invalid use will trigger anIllegalArgumentException(or subclasses such asNumberFormatException) whenrender(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());
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jdbi.v3.core.statement.TemplateEngine
TemplateEngine.Parsing
-
-
Field Summary
-
Fields inherited from interface org.jdbi.v3.core.statement.TemplateEngine
NOP
-
-
Constructor Summary
Constructors Constructor Description MessageFormatTemplateEngine()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringrender(java.lang.String template, StatementContext ctx)Deprecated.Renders an SQL statement from the given template, using the statement context as needed.private static voidvalidateKeys(java.util.Set<java.lang.String> keySet, int expectedCount)Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.core.statement.TemplateEngine
parse
-
-
-
-
Method Detail
-
render
public java.lang.String render(java.lang.String template, StatementContext ctx)Deprecated.Description copied from interface:TemplateEngineRenders an SQL statement from the given template, using the statement context as needed.- Specified by:
renderin interfaceTemplateEngine- Parameters:
template- The SQL to rewritectx- The statement context for the statement being executed- Returns:
- something which can provide the actual SQL to prepare a statement from and which can bind the correct arguments to that prepared statement
-
validateKeys
private static void validateKeys(java.util.Set<java.lang.String> keySet, int expectedCount)Deprecated.
-
-