Fork me on GitHub

PebbleTemplate

In package com.mitchellbosecke.pebble.template

public interface interface PebbleTemplate

A template object constructed by an instance of {@link com.mitchellbosecke.pebble.PebbleEngine}. A template by itself is stateless and can therefore be re-used over and over to provide different outputs depending on the variables that are provided at the time of evaluation.

Methods

public void evaluate(Writer writer)

Evaluate the template without any provided variables. This will use the default locale provided by the {@link com.mitchellbosecke.pebble.PebbleEngine}.

Parameters:
  • Writer writer

    The results of the evaluation are written to this writer.

public void evaluate(Writer writer, Locale locale)

Evaluate the template with a particular locale but without any provided variables.

Parameters:
  • Writer writer

    The results of the evaluation are written to this writer.

  • Locale locale

    The locale used during the evaluation of the template.

public void evaluate(Writer writer, Map<String, Object> context)

Evaluate the template with a set of variables and the default locale provided by the {@link com.mitchellbosecke.pebble.PebbleEngine}

Parameters:
  • Writer writer

    The results of the evaluation are written to this writer.

  • Map<String, Object> context

    The variables used during the evaluation of the template.

public void evaluate(Writer writer, Map<String, Object> context, Locale locale)

Evaluate the template with a particular locale and a set of variables.

Parameters:
  • Writer writer

    The results of the evaluation are written to this writer.

  • Map<String, Object> context

    The variables used during the evaluation of the template.

  • Locale locale

    The locale used during the evaluation of the template.

public void evaluateBlock(String blockName, Writer writer)

Evaluate the template but only render the contents of a specific block.

Parameters:
  • String blockName

    The name of the template block to return.

  • Writer writer

    The results of the evaluation are written to this writer.

public void evaluateBlock(String blockName, Writer writer, Locale locale)

Evaluate the template but only render the contents of a specific block.

Parameters:
  • String blockName

    The name of the template block to return.

  • Writer writer

    The results of the evaluation are written to this writer.

  • Locale locale

    The locale used during the evaluation of the template.

public void evaluateBlock(String blockName, Writer writer, Map<String, Object> context)

Evaluate the template but only render the contents of a specific block.

Parameters:
  • String blockName

    The name of the template block to return.

  • Writer writer

    The results of the evaluation are written to this writer.

  • Map<String, Object> context

    The variables used during the evaluation of the template.

public void evaluateBlock(String blockName, Writer writer, Map<String, Object> context, Locale locale)

Evaluate the template but only render the contents of a specific block.

Parameters:
  • String blockName

    The name of the template block to return.

  • Writer writer

    The results of the evaluation are written to this writer.

  • Map<String, Object> context

    The variables used during the evaluation of the template.

  • Locale locale

    The locale used during the evaluation of the template.

public String getName()

Returns the name of the template

Parameters:
  • No parameters