Interface PebbleTemplate

  • All Known Implementing Classes:
    PebbleTemplateImpl

    public interface PebbleTemplate
    A template object constructed by an instance of 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.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void evaluate​(java.io.Writer writer)
      Evaluate the template without any provided variables.
      void evaluate​(java.io.Writer writer, java.util.Locale locale)
      Evaluate the template with a particular locale but without any provided variables.
      void evaluate​(java.io.Writer writer, java.util.Map<java.lang.String,​java.lang.Object> context)
      Evaluate the template with a set of variables and the default locale provided by the PebbleEngine
      void evaluate​(java.io.Writer writer, java.util.Map<java.lang.String,​java.lang.Object> context, java.util.Locale locale)
      Evaluate the template with a particular locale and a set of variables.
      void evaluateBlock​(java.lang.String blockName, java.io.Writer writer)
      Evaluate the template but only render the contents of a specific block.
      void evaluateBlock​(java.lang.String blockName, java.io.Writer writer, java.util.Locale locale)
      Evaluate the template but only render the contents of a specific block.
      void evaluateBlock​(java.lang.String blockName, java.io.Writer writer, java.util.Map<java.lang.String,​java.lang.Object> context)
      Evaluate the template but only render the contents of a specific block.
      void evaluateBlock​(java.lang.String blockName, java.io.Writer writer, java.util.Map<java.lang.String,​java.lang.Object> context, java.util.Locale locale)
      Evaluate the template but only render the contents of a specific block.
      java.lang.String getName()
      Returns the name of the template
    • Method Detail

      • evaluate

        void evaluate​(java.io.Writer writer)
               throws java.io.IOException
        Evaluate the template without any provided variables. This will use the default locale provided by the PebbleEngine.
        Parameters:
        writer - The results of the evaluation are written to this writer.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluate

        void evaluate​(java.io.Writer writer,
                      java.util.Locale locale)
               throws java.io.IOException
        Evaluate the template with a particular locale but without any provided variables.
        Parameters:
        writer - The results of the evaluation are written to this writer.
        locale - The locale used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluate

        void evaluate​(java.io.Writer writer,
                      java.util.Map<java.lang.String,​java.lang.Object> context)
               throws java.io.IOException
        Evaluate the template with a set of variables and the default locale provided by the PebbleEngine
        Parameters:
        writer - The results of the evaluation are written to this writer.
        context - The variables used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluate

        void evaluate​(java.io.Writer writer,
                      java.util.Map<java.lang.String,​java.lang.Object> context,
                      java.util.Locale locale)
               throws java.io.IOException
        Evaluate the template with a particular locale and a set of variables.
        Parameters:
        writer - The results of the evaluation are written to this writer.
        context - The variables used during the evaluation of the template.
        locale - The locale used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluateBlock

        void evaluateBlock​(java.lang.String blockName,
                           java.io.Writer writer)
                    throws java.io.IOException
        Evaluate the template but only render the contents of a specific block.
        Parameters:
        blockName - The name of the template block to return.
        writer - The results of the evaluation are written to this writer.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluateBlock

        void evaluateBlock​(java.lang.String blockName,
                           java.io.Writer writer,
                           java.util.Locale locale)
                    throws java.io.IOException
        Evaluate the template but only render the contents of a specific block.
        Parameters:
        blockName - The name of the template block to return.
        writer - The results of the evaluation are written to this writer.
        locale - The locale used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluateBlock

        void evaluateBlock​(java.lang.String blockName,
                           java.io.Writer writer,
                           java.util.Map<java.lang.String,​java.lang.Object> context)
                    throws java.io.IOException
        Evaluate the template but only render the contents of a specific block.
        Parameters:
        blockName - The name of the template block to return.
        writer - The results of the evaluation are written to this writer.
        context - The variables used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • evaluateBlock

        void evaluateBlock​(java.lang.String blockName,
                           java.io.Writer writer,
                           java.util.Map<java.lang.String,​java.lang.Object> context,
                           java.util.Locale locale)
                    throws java.io.IOException
        Evaluate the template but only render the contents of a specific block.
        Parameters:
        blockName - The name of the template block to return.
        writer - The results of the evaluation are written to this writer.
        context - The variables used during the evaluation of the template.
        locale - The locale used during the evaluation of the template.
        Throws:
        java.io.IOException - An IO exception during the evaluation
      • getName

        java.lang.String getName()
        Returns the name of the template
        Returns:
        The name of the template