com.github.jknack.handlebars
Interface Template


public interface Template

A compiled template created by Handlebars.compile(String).

Since:
0.1.0
Author:
edgar.espina

Method Summary
 String apply(Context context)
          Merge the template tree using the given context.
 void apply(Context context, Writer writer)
          Merge the template tree using the given context.
 String apply(Object context)
          Merge the template tree using the given context.
 void apply(Object context, Writer writer)
          Merge the template tree using the given context.
 String text()
          Provide the raw text.
 String toJavaScript()
          Return a pre-compiled JavaScript version of this template.
 

Method Detail

apply

void apply(Object context,
           Writer writer)
           throws IOException
Merge the template tree using the given context.

Parameters:
context - The context object. May be null.
writer - The writer object. Required.
Throws:
IOException - If a resource cannot be loaded.

apply

String apply(Object context)
             throws IOException
Merge the template tree using the given context.

Parameters:
context - The context object. May be null.
Returns:
The resulting template.
Throws:
IOException - If a resource cannot be loaded.

apply

void apply(Context context,
           Writer writer)
           throws IOException
Merge the template tree using the given context.

Parameters:
context - The context object. Required.
writer - The writer object. Required.
Throws:
IOException - If a resource cannot be loaded.

apply

String apply(Context context)
             throws IOException
Merge the template tree using the given context.

Parameters:
context - The context object. Required.
Returns:
The resulting template.
Throws:
IOException - If a resource cannot be loaded.

text

String text()
Provide the raw text.

Returns:
The raw text.

toJavaScript

String toJavaScript()
                    throws IOException
Return a pre-compiled JavaScript version of this template.

Returns:
A pre-compiled JavaScript version of this template.
Throws:
IOException - If compilation fails.


Copyright © 2012. All Rights Reserved.