Class MustacheTemplate

java.lang.Object
org.springframework.restdocs.templates.mustache.MustacheTemplate
All Implemented Interfaces:
Template

public class MustacheTemplate extends Object implements Template
An adapter that exposes a compiled Mustache template as a Template.
Author:
Andy Wilkinson
  • Constructor Details

    • MustacheTemplate

      public MustacheTemplate(org.springframework.restdocs.mustache.Template delegate)
      Creates a new MustacheTemplate that adapts the given delegate.
      Parameters:
      delegate - the delegate to adapt
    • MustacheTemplate

      public MustacheTemplate(org.springframework.restdocs.mustache.Template delegate, Map<String,Object> context)
      Creates a new MustacheTemplate that adapts the given delegate. During rendering, the given context and the context passed into render(Map) will be combined and then passed to the delegate when it is executed.
      Parameters:
      delegate - the delegate to adapt
      context - the context
  • Method Details

    • render

      public String render(Map<String,Object> context)
      Description copied from interface: Template
      Renders the template to a String using the given context for variable/property resolution.
      Specified by:
      render in interface Template
      Parameters:
      context - the context to use
      Returns:
      the rendered template