public class TemplateCompiler extends Object implements DelegatingTemplateLoader
Constructor and Description |
---|
TemplateCompiler(TemplateFactory templateFactory,
FunctionExecutor globalFunctionExecutor,
AutoEscapeOptions autoEscapeOptions) |
Modifier and Type | Method and Description |
---|---|
Template |
createTemp(String name,
String content,
EscapeMode escapeMode)
Create a temporary template from content, with the provided escape mode.
|
Template |
load(String templateName,
ResourceLoader resourceLoader,
EscapeMode escapeMode)
Load a template from a named resource, with the provided escape mode.
|
void |
setTemplateLoaderDelegate(TemplateLoader templateLoaderDelegate)
TemplateLoader that Templates will delegate back to for includes etc.
|
public TemplateCompiler(TemplateFactory templateFactory, FunctionExecutor globalFunctionExecutor, AutoEscapeOptions autoEscapeOptions)
public void setTemplateLoaderDelegate(TemplateLoader templateLoaderDelegate)
DelegatingTemplateLoader
setTemplateLoaderDelegate
in interface DelegatingTemplateLoader
public Template load(String templateName, ResourceLoader resourceLoader, EscapeMode escapeMode)
TemplateLoader
load
in interface TemplateLoader
templateName
- e.g. some/path/to/template.csresourceLoader
- the ResourceLoader object to use to load any files needed to satisfy this
request.escapeMode
- the type of escaping to apply to the entire template.public Template createTemp(String name, String content, EscapeMode escapeMode)
TemplateLoader
createTemp
in interface TemplateLoader
name
- A name to identify the temporary template in stack traces.content
- e.g. "Hello <cs var:name >"escapeMode
- the type of escaping to apply to the entire template.Copyright © 2010–2019 Google. All rights reserved.