public abstract class JxltEngine extends Object
At the base is an evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL. At the top is a template engine inspired by Velocity that uses JEXL (instead of OGNL/VTL) as the scripting language.
The evaluator is intended to be used in configuration modules, XML based frameworks or JSP taglibs and facilitate the implementation of expression evaluation.
The template engine is intended to output any form of text; html, XML, CSV...
Modifier and Type | Class and Description |
---|---|
static class |
JxltEngine.Exception
The sole type of (runtime) exception the JxltEngine can throw.
|
static interface |
JxltEngine.Expression
A unified expression that can mix immediate, deferred and nested sub-expressions as well as string constants;
The "immediate" syntax is of the form
"...${jexl-expr}..."
The "deferred" syntax is of the form "...#{jexl-expr}..."
The "nested" syntax is of the form "...#{...${jexl-expr0}...}..."
The "composite" syntax is of the form "...${jexl-expr0}... |
static interface |
JxltEngine.Template
A template is a JEXL script that evaluates by writing its content through a Writer.
|
Constructor and Description |
---|
JxltEngine() |
Modifier and Type | Method and Description |
---|---|
abstract void |
clearCache()
Clears the cache.
|
abstract JxltEngine.Expression |
createExpression(JexlInfo info,
String expression)
Creates a
JxltEngine.Expression from an expression string. |
JxltEngine.Expression |
createExpression(String expression)
Creates a
JxltEngine.Expression from an expression string. |
JxltEngine.Template |
createTemplate(JexlInfo info,
String source)
Creates a new template.
|
abstract JxltEngine.Template |
createTemplate(JexlInfo info,
String prefix,
Reader source,
String... parms)
Creates a new template.
|
JxltEngine.Template |
createTemplate(JexlInfo info,
String source,
String... parms)
Creates a new template.
|
JxltEngine.Template |
createTemplate(String source)
Creates a new template.
|
JxltEngine.Template |
createTemplate(String prefix,
Reader source,
String... parms)
Creates a new template.
|
JxltEngine.Template |
createTemplate(String source,
String... parms)
Creates a new template.
|
abstract JexlEngine |
getEngine()
Gets the
JexlEngine underlying this template engine. |
public JxltEngine()
public JxltEngine.Expression createExpression(String expression)
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.
expression
- the JxltEngine.Template
string expressionJxltEngine.Expression
, null if silent and an error occurredJxltEngine.Exception
- if an error occurs and the JexlEngine
is not silentpublic abstract JxltEngine.Expression createExpression(JexlInfo info, String expression)
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.
info
- the JexlInfo
source informationexpression
- the JxltEngine.Template
string expressionJxltEngine.Expression
, null if silent and an error occurredJxltEngine.Exception
- if an error occurs and the JexlEngine
is not silentpublic abstract JxltEngine.Template createTemplate(JexlInfo info, String prefix, Reader source, String... parms)
info
- the jexl info (file, line, column)prefix
- the directive prefixsource
- the sourceparms
- the parameter namespublic JxltEngine.Template createTemplate(JexlInfo info, String source, String... parms)
info
- the source infoparms
- the parameter namessource
- the sourcepublic JxltEngine.Template createTemplate(JexlInfo info, String source)
info
- the source infosource
- the sourcepublic JxltEngine.Template createTemplate(String prefix, Reader source, String... parms)
prefix
- the directive prefixsource
- the sourceparms
- the parameter namespublic JxltEngine.Template createTemplate(String source, String... parms)
source
- the sourceparms
- the parameter namespublic JxltEngine.Template createTemplate(String source)
source
- the sourcepublic abstract JexlEngine getEngine()
JexlEngine
underlying this template engine.public abstract void clearCache()
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.