Class MustacheTemplateRenderer

java.lang.Object
io.spring.initializr.generator.io.template.MustacheTemplateRenderer
All Implemented Interfaces:
TemplateRenderer

public class MustacheTemplateRenderer extends Object implements TemplateRenderer
A TemplateRenderer using Mustache with a configurable resource prefix. Templates should have an mustache extension.
Author:
Stephane Nicoll
  • Constructor Details

    • MustacheTemplateRenderer

      public MustacheTemplateRenderer(String resourcePrefix, org.springframework.cache.Cache templateCache)
      Create a new instance with the resource prefix and the Cache to use.
      Parameters:
      resourcePrefix - the resource prefix to apply to locate a template based on its name
      templateCache - the cache to use for compiled templates (can be null to not use caching)
    • MustacheTemplateRenderer

      public MustacheTemplateRenderer(String resourcePrefix)
      Create a new instance with the resource prefix to use.
      Parameters:
      resourcePrefix - the resource prefix to apply to locate a template based on its name
      See Also:
  • Method Details

    • render

      public String render(String templateName, Map<String,?> model)
      Description copied from interface: TemplateRenderer
      Render the template with the specified name and the specified model.
      Specified by:
      render in interface TemplateRenderer
      Parameters:
      templateName - the name of the template
      model - the model to use
      Returns:
      the rendering result