public class ELEvaluator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ELEvaluator.Context
Provides functions and variables for the EL evaluator.
|
Constructor and Description |
---|
ELEvaluator()
Creates an ELEvaluator with no functions and no variables defined.
|
ELEvaluator(ELEvaluator.Context context)
Creates an ELEvaluator with the functions and variables defined in the given
ELEvaluator.Context . |
Modifier and Type | Method and Description |
---|---|
boolean |
checkForExistence(String expr,
String sequence)
Check if the input expression contains sequence statically.
|
<T> T |
evaluate(String expr,
Class<T> clazz)
Evaluate an EL expression.
|
ELEvaluator.Context |
getContext()
Return the context with the functions and variables of the EL evaluator.
|
static ELEvaluator |
getCurrent()
If within the scope of a EL evaluation call, it gives access to the ELEvaluator instance performing the EL
evaluation.
|
Object |
getVariable(String name)
Convenience method that returns a variable from the EL evaluator context.
|
void |
setVariable(String name,
Object value)
Convenience method that sets a variable in the EL evaluator context.
|
public ELEvaluator()
public ELEvaluator(ELEvaluator.Context context)
ELEvaluator.Context
. context
- the ELSupport with functions and variables to be available for EL evalution.public static ELEvaluator getCurrent()
null
if none.public ELEvaluator.Context getContext()
public void setVariable(String name, Object value)
name
- variable name.value
- variable value.public Object getVariable(String name)
name
- variable name.null
if not defined.public <T> T evaluate(String expr, Class<T> clazz) throws Exception
expr
- EL expression to evaluate.clazz
- return type of the EL expression.Exception
- thrown if an EL function failed due to a transient error or EL expression could not be
evaluated.public boolean checkForExistence(String expr, String sequence) throws Exception
expr
- - Expression stringsequence
- - char sequence to check in the input expressionException
- Exception thrown if an EL function failed due to a
transient error or EL expression could not be parsedCopyright © 2015 Apache Software Foundation. All Rights Reserved.