|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.specrunner.expressions.core.AbstractExpression
org.specrunner.expressions.core.ExpressionJanino
public class ExpressionJanino
A Janino expression.
| Field Summary | |
|---|---|
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). |
| Fields inherited from class org.specrunner.expressions.core.AbstractExpression |
|---|
DEFAULT_PRECEDENCE |
| Fields inherited from interface org.specrunner.expressions.IExpression |
|---|
FEATURE_PRECEDENCE |
| Constructor Summary | |
|---|---|
ExpressionJanino(IExpressionFactory parent,
Object source)
Basic constructor. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.specrunner.expressions.core.AbstractExpression |
|---|
evaluate, getParent, getPrecedence, setPrecedence |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FEATURE_JDK_COMPILER
org.codehaus.commons.compiler.jdk.ExpressionEvaluator).
protected static ICache<ExpressionKey,org.codehaus.commons.compiler.IExpressionEvaluator> cache
| Constructor Detail |
|---|
public ExpressionJanino(IExpressionFactory parent,
Object source)
parent - The parent factory.source - The object source.| Method Detail |
|---|
public Object evaluate(IContext context,
boolean silent)
throws ExpressionException
IExpression
context - 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.protected Number numericValue(String original)
original - The text.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||