public final class TemplateEngine extends JxltEngine
JxltEngine.Exception, JxltEngine.Expression, JxltEngine.Template
Constructor and Description |
---|
TemplateEngine(Engine aJexl,
boolean noScript,
int cacheSize,
char immediate,
char deferred)
Creates a new instance of
JxltEngine creating a local cache. |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the cache.
|
JxltEngine.Expression |
createExpression(JexlInfo info,
String expression)
Creates a a
JxltEngine.Expression from an expression string. |
TemplateScript |
createTemplate(JexlInfo info,
String prefix,
Reader source,
String... parms)
Creates a new template.
|
Engine |
getEngine()
Gets the JexlEngine underlying this JxltEngine.
|
protected static Iterator<CharSequence> |
readLines(Reader reader)
Read lines from a (buffered / mark-able) reader keeping all new-lines and line-feeds.
|
protected List<org.apache.commons.jexl3.internal.TemplateEngine.Block> |
readTemplate(String prefix,
Reader source)
Reads lines of a template grouping them by typed blocks.
|
protected int |
startsWith(CharSequence sequence,
CharSequence pattern)
Whether a sequence starts with a given set of characters (following spaces).
|
createExpression, createTemplate, createTemplate, createTemplate, createTemplate, createTemplate
public TemplateEngine(Engine aJexl, boolean noScript, int cacheSize, char immediate, char deferred)
JxltEngine
creating a local cache.aJexl
- the JexlEngine to use.noScript
- whether this engine only allows JEXL expressions or scriptscacheSize
- the number of expressions in this cache, default is 256immediate
- the immediate template expression character, default is '$'deferred
- the deferred template expression character, default is '#'public Engine getEngine()
getEngine
in class JxltEngine
public void clearCache()
clearCache
in class JxltEngine
public JxltEngine.Expression createExpression(JexlInfo info, String expression)
JxltEngine
JxltEngine.Expression
from an expression string.
Uses and fills up the expression cache if any.
If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.
createExpression
in class JxltEngine
info
- the JexlInfo
source informationexpression
- the JxltEngine.Template
string expressionJxltEngine.Expression
, null if silent and an error occuredprotected int startsWith(CharSequence sequence, CharSequence pattern)
Space characters at beginning of line before the pattern are discarded.
sequence
- the sequencepattern
- the pattern to match at start of sequenceprotected static Iterator<CharSequence> readLines(Reader reader)
reader
- the readerprotected List<org.apache.commons.jexl3.internal.TemplateEngine.Block> readTemplate(String prefix, Reader source)
prefix
- the directive prefixsource
- the source readerpublic TemplateScript createTemplate(JexlInfo info, String prefix, Reader source, String... parms)
JxltEngine
createTemplate
in class JxltEngine
info
- the jexl info (file, line, column)prefix
- the directive prefixsource
- the sourceparms
- the parameter namesCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.