Class JinjavaTemplateRenderer

  • All Implemented Interfaces:
    com.embabel.common.textio.template.TemplateCompiler , com.embabel.common.textio.template.TemplateRenderer

    
    public final class JinjavaTemplateRenderer
     implements TemplateRenderer
                        

    Wrap HubSpot Jinjava to render templates. Files are expected to end with '.jinja' Don't forget to escape anything that may be problematic with {{ title|e}} syntax

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String renderLiteralTemplate(String template, Map<String, Object> model) Render a template string without loading it
      String renderLoadedTemplate(String templateName, Map<String, Object> model) Render a template with the given model
      String load(String templateName) Load the template.
      • Methods inherited from class com.embabel.common.textio.template.TemplateRenderer

        compileLoadedTemplate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JinjavaTemplateRenderer

        JinjavaTemplateRenderer(JinjaProperties jinja, ResourceLoader resourceLoader)
    • Method Detail

      • renderLoadedTemplate

         String renderLoadedTemplate(String templateName, Map<String, Object> model)

        Render a template with the given model

        Parameters:
        templateName - template to use.
        model - model
        Returns:

        string result of rendering string

      • load

         String load(String templateName)

        Load the template. Useful if we have to introspect it

        Parameters:
        templateName - name of the template
        Returns:

        template content