public class Evaluators extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
add(Element config)
Adds an evaluator based on the XML declaration.
|
static String |
add(String name,
String evalcls)
Adds an evaluator
(a.k.a., the expression factory,
ExpressionFactory). |
static boolean |
exists(String name)
Tests whether the evaluator (a.k.a., the expression factory)
for the specified evaluator name
exists.
|
static Class<? extends ExpressionFactory> |
getEvaluatorClass(String name)
Returns the implementation for the specified evaluator name.
|
static Object |
resolveVariable(VariableResolver resolver,
String name)
Resolves the variable based on the specified resolver.
|
static Object |
resolveVariable(XelContext ctx,
Object base,
Object name)
Resolves the variable based on the specified context.
|
static Object |
resolveVariable(XelContext ctx,
VariableResolver resolver,
Object base,
Object name)
Resolves the variable based on the the specified context and
variable resolver.
|
public static final Class<? extends ExpressionFactory> getEvaluatorClass(String name)
name - the name of the evaluator, say, MVEL.SystemException - if not found or the class not found.public static final boolean exists(String name)
name - the name of the evaluator, say, MVEL.public static final String add(String name, String evalcls)
ExpressionFactory).name - the name of the evaluator, say, MVEL.
It is case insensitive.evalcls - the class name of the evaluator, a.k.a., the expression factory
(ExpressionFactory).public static final String add(Element config)
ExpressionFactory.
<xel-config>
<evaluator-name>SuperEL</evaluator-name><!-- case insensitive --!>
<evaluator-class>my.MySuperEvaluator</evaluator-class>
</xel-config>
config - the XML element called zscript-configpublic static Object resolveVariable(XelContext ctx, VariableResolver resolver, Object base, Object name)
public static Object resolveVariable(XelContext ctx, Object base, Object name)
XelContext.getVariableResolver()
is an instance of VariableResolverX, then
VariableResolverX.resolveVariable(XelContext,Object,Object)
will be invoked.ctx - the context. If null, null will be returned.public static Object resolveVariable(VariableResolver resolver, String name)
VariableResolverX, then
VariableResolverX.resolveVariable(XelContext,Object,Object)
will be invoked.
Notice that it is always better to invoke resolveVariable(XelContext,Object,Object)
if XelContext is available.
resolver - the variable resolver. If null, null will be returned.Copyright © 2018. All rights reserved.