de.unkrig.commons.text.expression
Interface Expression

All Known Implementing Classes:
AbstractExpression

public interface Expression

An expression evaluates to a value each time it is evaluated. If you want to evaluate an expression only once, you better use ExpressionEvaluator.evaluate(String, Mapping).

See Also:
Parser.parse()

Field Summary
static Expression FALSE
          An expression which always evaluates to false.
static Expression NULL
          An expression which always evaluates to null.
static Expression TRUE
          An expression which always evaluates to true.
 
Method Summary
 java.lang.Object evaluate(Mapping<java.lang.String,?> variables)
          Computes the value of the expression
 java.lang.Object evaluateTo(Mapping<java.lang.String,?> variables, java.lang.Class<?> targetType)
           
 boolean evaluateToBoolean(Mapping<java.lang.String,?> variables)
           
 java.lang.Object evaluateToPrimitive(Mapping<java.lang.String,?> variables, java.lang.Class<?> targetType)
           
 

Field Detail

TRUE

static final Expression TRUE
An expression which always evaluates to true.


FALSE

static final Expression FALSE
An expression which always evaluates to false.


NULL

static final Expression NULL
An expression which always evaluates to null.

Method Detail

evaluate

@Nullable
java.lang.Object evaluate(Mapping<java.lang.String,?> variables)
                          throws EvaluationException
Computes the value of the expression

Parameters:
variables - The values of the variables that were named when the expression was parsed. Allowed values are String, Integer, Boolean, any other Object, or null.
Returns:
A String, Integer, Boolean, any other Object, or null
Throws:
EvaluationException - A problem occurred during evaluation, e.g. a class could not be loaded, or a type cast could not be performed

evaluateTo

@Nullable
java.lang.Object evaluateTo(Mapping<java.lang.String,?> variables,
                                     java.lang.Class<?> targetType)
                            throws EvaluationException
Throws:
EvaluationException
See Also:
AbstractExpression.evaluateTo(Mapping, Class)

evaluateToPrimitive

java.lang.Object evaluateToPrimitive(Mapping<java.lang.String,?> variables,
                                     java.lang.Class<?> targetType)
                                     throws EvaluationException
Throws:
EvaluationException
See Also:
AbstractExpression.evaluateToPrimitive(Mapping, Class)

evaluateToBoolean

boolean evaluateToBoolean(Mapping<java.lang.String,?> variables)
                          throws EvaluationException
Throws:
EvaluationException
See Also:
AbstractExpression.evaluateToBoolean(Mapping)