com.atlassian.templaterenderer
Interface TemplateRenderer

All Known Subinterfaces:
VelocityTemplateRenderer, VelocityTemplateRenderer
All Known Implementing Classes:
VelocityTemplateRendererImpl, VelocityTemplateRendererImpl

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, WebResourceManager and WebResourceUrlProvider.
 void render(String templateName, Writer writer)
          Renders the template to the writer, using the given context and adding an I18nResolver, WebResourceManager and WebResourceUrlProvider.
 String renderFragment(String fragment, Map<String,Object> context)
          Renders the template to the writer, using the given context and adding an I18nResolver, WebResourceManager and WebResourceUrlProvider.
 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, using the given context and adding an I18nResolver, WebResourceManager and WebResourceUrlProvider.

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, WebResourceManager and WebResourceUrlProvider.

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 template to the writer, using the given context and adding an I18nResolver, WebResourceManager and WebResourceUrlProvider.

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 © 2014 Atlassian. All Rights Reserved.