Class StringSubstitutorTemplateEngine

java.lang.Object
org.jdbi.v3.commonstext.StringSubstitutorTemplateEngine
All Implemented Interfaces:
TemplateEngine

public class StringSubstitutorTemplateEngine extends Object implements TemplateEngine
Register an instance of this class (SqlStatements.setTemplateEngine(org.jdbi.v3.core.statement.TemplateEngine)) to use an Apache Commons Text StringSubstitutor as a TemplateEngine. This lets you use any pair of strings as variable delimiters, enabling the use of syntax like
select * from ${foo}
,
select * from <foo>
,
select * from %foo%
, etc.
  • Constructor Details

    • StringSubstitutorTemplateEngine

      public StringSubstitutorTemplateEngine()
      Default is
      ${foo}
      syntax.
    • StringSubstitutorTemplateEngine

      public StringSubstitutorTemplateEngine(Consumer<org.apache.commons.text.StringSubstitutor> customizer)
      Customize the given StringSubstitutor instance to set your preferred prefix, suffix, escape character, and perhaps other configuration. The instance is created by Jdbi, and is not shared nor re-used. Your customizer function however will be re-used for all instances.
  • Method Details