public class Template
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Template.ResourceOpener
Used to resolve references to resources in the template, through
#parse directives. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
evaluate(java.util.Map<java.lang.String,?> vars)
Evaluate the given template with the given initial set of variables.
|
static Template |
parseFrom(java.io.Reader reader)
Parses a VTL template from the given
Reader. |
static Template |
parseFrom(java.lang.String resourceName,
Template.ResourceOpener resourceOpener)
Parse a VTL template of the given name using the given
ResourceOpener. |
public static Template parseFrom(java.io.Reader reader) throws java.io.IOException
Reader. The given Reader will be closed on
return from this method.java.io.IOExceptionpublic static Template parseFrom(java.lang.String resourceName, Template.ResourceOpener resourceOpener) throws java.io.IOException
ResourceOpener.resourceName - name of the resource. May be null.resourceOpener - used to open included files for #parse directives in the
template.java.io.IOExceptionpublic java.lang.String evaluate(java.util.Map<java.lang.String,?> vars)
vars - a map where the keys are variable names and the values are the corresponding
variable values. For example, if "x" maps to 23, then $x in the template
will expand to 23.Copyright © 2018 Google, Inc.. All Rights Reserved.