Modifier and Type | Class and Description |
---|---|
class |
BaseCompiledTemplate.CompiledMacro |
Constructor and Description |
---|
BaseCompiledTemplate() |
Modifier and Type | Method and Description |
---|---|
static boolean |
asBoolean(boolean value) |
static boolean |
asBoolean(Data data) |
static boolean |
asBoolean(int value) |
static boolean |
asBoolean(String value) |
static boolean |
asBoolean(Value value) |
static int |
asInt(boolean value) |
static int |
asInt(Data data) |
static int |
asInt(int value) |
static int |
asInt(String value) |
static int |
asInt(Value value) |
static String |
asString(boolean value) |
static String |
asString(Data data) |
static String |
asString(int value) |
static String |
asString(String value) |
static String |
asString(Value value) |
static Value |
asValue(boolean value) |
static Value |
asValue(int value) |
static Value |
asValue(String value) |
static Value |
asValue(Value value) |
static Value |
asVariableValue(String variableName,
DataContext context) |
RenderingContext |
createRenderingContext(Data data,
Appendable out,
ResourceLoader resourceLoader)
Create a new RenderingContext.
|
static boolean |
exists(Data data) |
Iterable<? extends Data> |
getChildren(Data parent)
Returns child nodes of parent.
|
String |
getDisplayName()
Name to use when displaying error or log messages.
|
EscapeMode |
getEscapeMode()
Return the EscapeMode in which this template was generated.
|
static String |
getNodeName(Data data)
Gets the name of the node for writing.
|
protected TemplateLoader |
getTemplateLoader() |
String |
getTemplateName()
Name of template (e.g.
|
protected void |
include(String templateName,
boolean ignoreMissingFile,
RenderingContext context)
Code common to all three include commands.
|
void |
render(Data data,
Appendable out,
ResourceLoader resourceLoader)
Render the template.
|
void |
setAutoEscapeOptions(AutoEscapeOptions autoEscapeOptions)
Set auto escaping options so they can be passed to the rendering context.
|
void |
setEscapeMode(EscapeMode mode)
Sets the EscapeMode in which this template was generated.
|
void |
setFunctionExecutor(FunctionExecutor functionExecutor) |
void |
setTemplateLoader(TemplateLoader templateLoader) |
void |
setTemplateName(String templateName) |
static boolean |
validateLoopArgs(int start,
int end,
int increment)
Verify that the loop arguments are valid.
|
public void setFunctionExecutor(FunctionExecutor functionExecutor)
public void setTemplateName(String templateName)
public void setTemplateLoader(TemplateLoader templateLoader)
public void setAutoEscapeOptions(AutoEscapeOptions autoEscapeOptions)
AutoEscapeOptions
public void render(Data data, Appendable out, ResourceLoader resourceLoader) throws IOException
Template
render
in interface Template
data
- Data to merge with template.out
- Target to write to.resourceLoader
- ResourceLoader to use instead of the default template one when loading
files.IOException
public RenderingContext createRenderingContext(Data data, Appendable out, ResourceLoader resourceLoader)
Template
createRenderingContext
in interface Template
data
- Data to merge with template.out
- Target to write to.resourceLoader
- ResourceLoader to load files.public String getTemplateName()
Template
getTemplateName
in interface Template
public void setEscapeMode(EscapeMode mode)
mode
- EscapeModepublic EscapeMode getEscapeMode()
Template
getEscapeMode
in interface Template
public String getDisplayName()
Template
getDisplayName
in interface Template
public static boolean validateLoopArgs(int start, int end, int increment)
public static boolean exists(Data data)
public static int asInt(String value)
public static int asInt(int value)
public static int asInt(boolean value)
public static int asInt(Value value)
public static int asInt(Data data)
public static String asString(int value)
public static String asString(boolean value)
public static Value asValue(int value)
public static Value asValue(boolean value)
public static Value asVariableValue(String variableName, DataContext context)
public static boolean asBoolean(boolean value)
public static boolean asBoolean(String value)
public static boolean asBoolean(int value)
public static boolean asBoolean(Value value)
public static boolean asBoolean(Data data)
public static String getNodeName(Data data)
public Iterable<? extends Data> getChildren(Data parent)
protected TemplateLoader getTemplateLoader()
protected void include(String templateName, boolean ignoreMissingFile, RenderingContext context)
templateName
- String representing name of file to include.ignoreMissingFile
- true
if any FileNotFound error generated by the template
loader should be ignored, false
otherwise.context
- Rendering context to use for the included template.Copyright © 2010-2014 Google. All Rights Reserved.