com.atlassian.templaterenderer
Interface TemplateRenderer


public interface TemplateRenderer

A service used to abstract the rendering engine used from your code. You can get specific instances of a TemplateRenderer using the TemplateRendererFactory.


Method Summary
 void render(String templateName, Map<String,Object> context, Writer writer)
          Renders the template to the writer, using the given context and adding an I18nResolver and WebResourceManager.
 void render(String templateName, Writer writer)
          Renders the template to the writer with a default context providing an I18nResolver and WebResourceManager.
 String renderFragment(String fragment, Map<String,Object> context)
          Renders the fragment using the given context and adding I18nResolver and WebResourceManager.
 boolean resolve(String templateName)
          Check whether the given template exists or not
 

Method Detail

render

void render(String templateName,
            Writer writer)
            throws RenderingException,
                   IOException
Renders the template to the writer with a default context providing an I18nResolver and WebResourceManager.

Parameters:
templateName - file name of the template to render
writer - where to write the rendered template
Throws:
RenderingException - thrown if there is an internal exception when rendering the template
IOException - thrown if there is a problem reading the template file or writing to the writer

render

void render(String templateName,
            Map<String,Object> context,
            Writer writer)
            throws RenderingException,
                   IOException
Renders the template to the writer, using the given context and adding an I18nResolver and WebResourceManager.

Parameters:
templateName - file name of the template to render
context - Map of objects to make available in the template rendering process
writer - where to write the rendered template
Throws:
RenderingException - thrown if there is an internal exception when rendering the template
IOException - thrown if there is a problem reading the template file or writing to the writer

renderFragment

String renderFragment(String fragment,
                      Map<String,Object> context)
                      throws RenderingException
Renders the fragment using the given context and adding I18nResolver and WebResourceManager.

Parameters:
fragment - template fragment to render
context - Map of objects to make available in the template rendering process
Returns:
rendered template
Throws:
RenderingException - thrown if there is an internal exception when rendering the template

resolve

boolean resolve(String templateName)
Check whether the given template exists or not

Parameters:
templateName - The name of the template to resolve
Returns:
True if the template exists


Copyright © 2012 Atlassian. All Rights Reserved.