org.springframework.expression.spel.ast

## Class Ternary

- java.lang.Object
- - org.springframework.expression.spel.ast.SpelNodeImpl
  - - org.springframework.expression.spel.ast.Ternary

- All Implemented Interfaces:
    SpelNode

      public class Ternary
      extends SpelNodeImpl

  Represents a ternary expression, for example: "someCheck()?true:false".
  Since:
    3.0
  Author:
    Andy Clement, Juergen Hoeller

- - ### Field Summary

    - ### Fields inherited from class org.springframework.expression.spel.ast.SpelNodeImpl

      `children, pos`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Ternary(int pos, SpelNodeImpl... args)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TypedValue` | `getValueInternal(ExpressionState state)` Evaluate the condition and if true evaluate the first alternative, otherwise evaluate the second alternative.
    `String` | `toStringAST()`

    - ### Methods inherited from class org.springframework.expression.spel.ast.SpelNodeImpl

      `getChild, getChildCount, getEndPosition, getObjectClass, getPreviousChild, getStartPosition, getTypedValue, getValue, getValue, getValueRef, isWritable, nextChildIs, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Ternary

          public Ternary(int pos,
                 SpelNodeImpl... args)

  - ### Method Detail

    - #### getValueInternal

          public TypedValue getValueInternal(ExpressionState state)
                                      throws EvaluationException

      Evaluate the condition and if true evaluate the first alternative, otherwise evaluate the second alternative.
      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