public final class TemplateScript extends Object implements JxltEngine.Template
| Constructor and Description |
|---|
TemplateScript(TemplateEngine engine,
JexlInfo info,
String directive,
Reader reader,
String... parms)
Creates a new template from an character input.
|
| Modifier and Type | Method and Description |
|---|---|
String |
asString()
Recreate the template source from its inner components.
|
void |
evaluate(JexlContext context,
Writer writer)
Evaluates this template.
|
void |
evaluate(JexlContext context,
Writer writer,
Object... args)
Evaluates this template.
|
String[] |
getParameters()
Gets the list of parameters expected by this template.
|
Set<List<String>> |
getVariables()
Gets the list of variables accessed by this template.
|
TemplateScript |
prepare(JexlContext context)
Prepares this template by expanding any contained deferred TemplateExpression.
|
String |
toString() |
public TemplateScript(TemplateEngine engine, JexlInfo info, String directive, Reader reader, String... parms)
engine - the template engineinfo - the source infodirective - the prefix for lines of code; can not be "$", "${", "#" or "#{"
since this would preclude being able to differentiate directives and jxlt expressionsreader - the input readerparms - the parameter namesNullPointerException - if either the directive prefix or input is nullIllegalArgumentException - if the directive prefix is invalidpublic String asString()
JxltEngine.TemplateasString in interface JxltEngine.Templatepublic TemplateScript prepare(JexlContext context)
JxltEngine.Templateprepare in interface JxltEngine.Templatecontext - the context to prepare againstpublic void evaluate(JexlContext context, Writer writer)
JxltEngine.Templateevaluate in interface JxltEngine.Templatecontext - the context to use during evaluationwriter - the writer to use for outputpublic void evaluate(JexlContext context, Writer writer, Object... args)
JxltEngine.Templateevaluate in interface JxltEngine.Templatecontext - the context to use during evaluationwriter - the writer to use for outputargs - the argumentspublic Set<List<String>> getVariables()
JxltEngine.TemplateThis method will visit all nodes of the sub-expressions and extract all variables whether they are written in 'dot' or 'bracketed' notation. (a.b is equivalent to a['b']).
getVariables in interface JxltEngine.Templatepublic String[] getParameters()
JxltEngine.TemplategetParameters in interface JxltEngine.TemplateCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.