public final class UnifiedJEXL.TemplateContext extends java.lang.Object implements JexlContext, NamespaceResolver
This context exposes its writer as '$jexl' to the scripts.
public for introspection purpose.
Modifier | Constructor and Description |
---|---|
protected |
UnifiedJEXL.TemplateContext(JexlContext jcontext,
JexlEngine.Frame jframe,
UnifiedJEXL.Expression[] expressions,
java.io.Writer out)
Creates a template context instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String name)
Gets the value of a variable.
|
JexlEngine.Frame |
getFrame()
Gets this context calling frame.
|
boolean |
has(java.lang.String name)
Checks whether a variable is defined in this context.
|
void |
include(UnifiedJEXL.Template template,
java.lang.Object... args)
Includes a call to another template.
|
void |
print(int e)
Prints an expression result.
|
protected void |
printComposite(org.apache.commons.jexl2.UnifiedJEXL.CompositeExpression composite)
Prints a composite expression.
|
java.lang.Object |
resolveNamespace(java.lang.String ns)
Resolves a namespace by its name.
|
void |
set(java.lang.String name,
java.lang.Object value)
Sets the value of a variable.
|
protected UnifiedJEXL.TemplateContext(JexlContext jcontext, JexlEngine.Frame jframe, UnifiedJEXL.Expression[] expressions, java.io.Writer out)
jcontext
- the base contextjframe
- the calling frameexpressions
- the list of expression from the template to evaluateout
- the output writerpublic JexlEngine.Frame getFrame()
public java.lang.Object get(java.lang.String name)
get
in interface JexlContext
name
- the variable's namepublic void set(java.lang.String name, java.lang.Object value)
set
in interface JexlContext
name
- the variable's namevalue
- the variable's valuepublic boolean has(java.lang.String name)
A variable may be defined with a null value; this method checks whether the value is null or if the variable is undefined.
has
in interface JexlContext
name
- the variable's namepublic java.lang.Object resolveNamespace(java.lang.String ns)
resolveNamespace
in interface NamespaceResolver
ns
- the namepublic void include(UnifiedJEXL.Template template, java.lang.Object... args)
Evaluates a template using this template initial context and writer.
template
- the template to evaluateargs
- the argumentspublic void print(int e)
e
- the expression numberprotected void printComposite(org.apache.commons.jexl2.UnifiedJEXL.CompositeExpression composite)
composite
- the composite expressionCopyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.