Class StringSubstitutorTemplateEngine

    • Field Detail

      • customizer

        private final java.util.function.Consumer<org.apache.commons.text.StringSubstitutor> customizer
    • Constructor Detail

      • StringSubstitutorTemplateEngine

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

        public StringSubstitutorTemplateEngine​(java.util.function.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 Detail

      • render

        public java.lang.String render​(java.lang.String template,
                                       StatementContext ctx)
        Description copied from interface: TemplateEngine
        Renders an SQL statement from the given template, using the statement context as needed.
        Specified by:
        render in interface TemplateEngine
        Parameters:
        template - The SQL to rewrite
        ctx - 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