org.springframework.expression.spel.ast
Class Elvis

java.lang.Object
  extended by org.springframework.expression.spel.ast.SpelNodeImpl
      extended by org.springframework.expression.spel.ast.Elvis
All Implemented Interfaces:
SpelNode

public class Elvis
extends SpelNodeImpl

Represents the elvis operator ?:. For an expression "a?:b" if a is not null, the value of the expression is "a", if a is null then the value of the expression is "b".

Since:
3.0
Author:
Andy Clement

Field Summary
 
Fields inherited from class org.springframework.expression.spel.ast.SpelNodeImpl
children, pos
 
Constructor Summary
Elvis(int pos, SpelNodeImpl... args)
           
 
Method Summary
 TypedValue getValueInternal(ExpressionState state)
          Evaluate the condition and if not null, return it.
 String toStringAST()
           
 
Methods inherited from class org.springframework.expression.spel.ast.SpelNodeImpl
getChild, getChildCount, getEndPosition, getObjectClass, getPreviousChild, getStartPosition, getTypedValue, getValue, getValue, isWritable, nextChildIs, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Elvis

public Elvis(int pos,
             SpelNodeImpl... args)
Method Detail

getValueInternal

public TypedValue getValueInternal(ExpressionState state)
                            throws EvaluationException
Evaluate the condition and if not null, return it. If it is null return the other value.

Specified by:
getValueInternal in class SpelNodeImpl
Parameters:
state - the expression state
Throws:
EvaluationException - if the condition does not evaluate correctly to a boolean or there is a problem executing the chosen alternative

toStringAST

public String toStringAST()
Specified by:
toStringAST in interface SpelNode
Specified by:
toStringAST in class SpelNodeImpl
Returns:
the string form of this AST node