juzu.template

## Class Template.Builder

- java.lang.Object
- - juzu.template.Template.Builder

- Enclosing class:
    Template

      public class Template.Builder
      extends Object

  A builder providing a fluent syntax for rendering a template.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Template.Builder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Template.Builder` | `locale(Locale locale)` Update the locale.
    `Response.Content` | `notFound()` Renders the template and returns a response with the not found status.
    `Response.Content` | `ok()` Renders the template and set the response on the current `MimeContext`.
    `void` | `render()` Renders the template and set the response on the current `MimeContext`
    `<A extends Appendable> A` | `renderTo(A appendable)` Renders the template to the specified appendable.
    `void` | `renderTo(Stream printer)` Renders the template to the specified printer.
    `Template.Builder` | `set(String name, Object value)` Update a parameter, if the value is not null the parameter with the specified name is set, otherwise the parameter is removed.
    `Response.Content` | `status(int status)` Renders the template and returns a response with the specified status.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Template.Builder

          public Template.Builder()

  - ### Method Detail

    - #### locale

          public Template.Builder locale(Locale locale)

      Update the locale.
      Parameters:
        `locale` - the new locale
      Returns:
        this builder

    - #### set

          public Template.Builder set(String name,
                             Object value)
                               throws NullPointerException

      Update a parameter, if the value is not null the parameter with the specified name is set, otherwise the parameter is removed. If the parameter is set and a value was set previously, the old value is overwritten otherwise. If the parameter is removed and the value does not exist, nothing happens.
      Parameters:
        `name` - the parameter name
        `value` - the parameter value
      Returns:
        this builder
      Throws:
        `NullPointerException` - if the name argument is null

    - #### ok

          public final Response.Content ok()

      Renders the template and set the response on the current `MimeContext`.
      Returns:
        the ok resource response

    - #### notFound

          public final Response.Content notFound()

      Renders the template and returns a response with the not found status.
      Returns:
        the not found response

    - #### status

          public final Response.Content status(int status)

      Renders the template and returns a response with the specified status.
      Returns:
        the response

    - #### renderTo

          public <A extends Appendable> A renderTo(A appendable)
                                        throws TemplateExecutionException,
                                               UndeclaredIOException

      Renders the template to the specified appendable.
      Parameters:
        `appendable` - the appendable
      Throws:
        `TemplateExecutionException` - any execution exception
        `UndeclaredIOException` - any io exception

    - #### renderTo

          public void renderTo(Stream printer)
                        throws TemplateExecutionException,
                               UndeclaredIOException

      Renders the template to the specified printer.
      Parameters:
        `printer` - the printer
      Throws:
        `TemplateExecutionException` - any execution exception
        `UndeclaredIOException` - any io exception

    - #### render

          public void render()
                      throws TemplateExecutionException,
                             UndeclaredIOException

      Renders the template and set the response on the current `MimeContext`
      Throws:
        `TemplateExecutionException`
        `UndeclaredIOException`

Copyright © 2013 eXo Platform SAS. All Rights Reserved.