public class ConditionalExpression extends Expression
Represents a conditional expression. I've decided not to produce an abstract base "TernaryOperatorExpression" class since (a) future ternary operators are unlikely and (b) it's not clear that there would be a meaningful way to abstract them. (For instance, would they all be right- associative? Would they all have two fixed operator symbols?)
Constructor and Description |
---|
ConditionalExpression(Expression pCondition,
Expression pTrueBranch,
Expression pFalseBranch)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Expression |
bindFunctions(FunctionMapper functions)
Returns an expression with all
FunctionInvocation s replaced by
BoundFunctionInvocation s. |
Object |
evaluate(VariableResolver vr,
FunctionMapper f)
Evaluates the conditional expression and returns the literal result
|
Expression |
getCondition() |
String |
getExpressionString()
Returns the expression in the expression language syntax
|
Expression |
getFalseBranch() |
Expression |
getTrueBranch() |
void |
setCondition(Expression pCondition) |
void |
setFalseBranch(Expression pFalseBranch) |
void |
setTrueBranch(Expression pTrueBranch) |
public ConditionalExpression(Expression pCondition, Expression pTrueBranch, Expression pFalseBranch)
public Expression getCondition()
public void setCondition(Expression pCondition)
public Expression getTrueBranch()
public void setTrueBranch(Expression pTrueBranch)
public Expression getFalseBranch()
public void setFalseBranch(Expression pFalseBranch)
public String getExpressionString()
getExpressionString
in class Expression
public Object evaluate(VariableResolver vr, FunctionMapper f) throws ELException
evaluate
in class Expression
ELException
public Expression bindFunctions(FunctionMapper functions) throws ELException
Expression
FunctionInvocation
s replaced by
BoundFunctionInvocation
s.bindFunctions
in class Expression
functions
- the functions to use in this transformationFunctionInvocation
s replaced by
BoundFunctionInvocation
s.ELException
- if any of the functions in this Expression
are
not present in functions
Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.