public class ExpressionJanino extends AbstractExpression
| Modifier and Type | Field and Description |
|---|---|
protected static ICache<ExpressionKey,org.codehaus.commons.compiler.IExpressionEvaluator> |
cache
Cache of expressions.
|
static String |
FEATURE_JDK_COMPILER
Feature to enable Janino work with JDK expressions (
org.codehaus.commons.compiler.jdk.ExpressionEvaluator). |
protected Object |
source
The expression source.
|
DEFAULT_PRECEDENCE, parent, precedenceFEATURE_PRECEDENCE| Constructor and Description |
|---|
ExpressionJanino(IExpressionFactory parent,
Object source)
Basic constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
arguments(IContext context,
String expression,
List<String> args,
List<Class<?>> types,
List<Object> values,
boolean silent)
Prepare arguments.
|
protected Object |
eval(Object source,
String expression,
List<String> args,
List<Class<?>> types,
List<Object> values,
boolean silent)
Evaluate the expression.
|
Object |
evaluate(IContext context,
boolean silent)
Given a context, evaluates the expression.
|
protected Object |
getValue(IContext context,
String text,
boolean silent)
Get the value for a expression.
|
protected Number |
numericValue(String original)
Convert to number.
|
protected Object |
tryObject(Class<?> returnType,
String expression,
String[] arrayArgs,
Object[] arrayValues,
Class<?>[] arrayTypes)
Compute the expression assuming return type will be the specified.
|
evaluate, getParent, getPrecedence, setPrecedencepublic static final String FEATURE_JDK_COMPILER
org.codehaus.commons.compiler.jdk.ExpressionEvaluator).protected Object source
protected static ICache<ExpressionKey,org.codehaus.commons.compiler.IExpressionEvaluator> cache
public ExpressionJanino(IExpressionFactory parent, Object source)
parent - The parent factory.source - The object source.public Object evaluate(IContext context, boolean silent) throws ExpressionException
IExpressioncontext - A contextual information.silent - true, for evaluation without exceptions,
false, otherwise.ExpressionException - On evaluation errors.protected Object arguments(IContext context, String expression, List<String> args, List<Class<?>> types, List<Object> values, boolean silent) throws ExpressionException
context - The context.expression - The expression.args - The arguments.types - The types.values - The values.silent - Silent option.ExpressionException - On expression errors.protected Object getValue(IContext context, String text, boolean silent) throws ExpressionException
context - The context.text - The expression.silent - The silent mode.ExpressionException - On expression errors.protected Object eval(Object source, String expression, List<String> args, List<Class<?>> types, List<Object> values, boolean silent) throws ExpressionException
source - The expression source.expression - The expression as string.args - The arguments.types - The argument types.values - The argument values.silent - Silent mode.ExpressionException - On evaluation errors.protected Object tryObject(Class<?> returnType, String expression, String[] arrayArgs, Object[] arrayValues, Class<?>[] arrayTypes) throws Exception
returnType - The calling result type.expression - The expression to be evaluated.arrayArgs - The formal parameters.arrayValues - The actual parameters.arrayTypes - The argument types.Exception - On processing errors.Copyright © 2016. All rights reserved.