Package com.sap.cds.ql.cqn
Interface CqnCaseExpression
- All Superinterfaces:
CqnExpression,CqnToken,CqnValue,JSONizable
A case expression, which represents IF - THEN - ELSE logic. The result value
is determined by evaluating a list of
cases. If a
CqnCaseExpression.Case.condition() of a case evaluates to TRUE the result value of the case is returned. If no condition of any case evaluates
to TRUE the default value is returned.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA case, which relates a condition to a result value. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaccept(CqnVisitor visitor) Traverses the expression tree represented by this token with a givenvisitor.default CqnCaseExpressionCasts this expression to aCqnCaseExpression.cases()Thecases, which are evaluated.The default value, which is returned if no condition of any case matchesdefault booleanReturnstrueif this is aCqnCaseExpression.Methods inherited from interface com.sap.cds.ql.cqn.CqnExpression
asArithmeticExpression, asExpression, asNegation, asPredicate, isArithmeticExpression, isExpression, isNegation, isPredicate, toJsonMethods inherited from interface com.sap.cds.ql.cqn.CqnValue
as, asFunction, asList, asLiteral, asNullValue, asParameter, asPlain, asRef, isFunction, isList, isLiteral, isNullValue, isParameter, isPlain, isRef, ofLiteral, ofRef, type
-
Method Details
-
cases
List<CqnCaseExpression.Case> cases()Thecases, which are evaluated.- Returns:
- the cases
-
defaultValue
CqnValue defaultValue()The default value, which is returned if no condition of any case matches- Returns:
- the default value
-
isCaseExpression
default boolean isCaseExpression()Description copied from interface:CqnExpressionReturnstrueif this is aCqnCaseExpression.- Specified by:
isCaseExpressionin interfaceCqnExpression- Returns:
trueif this is a case expression, otherwisefalse
-
asCaseExpression
Description copied from interface:CqnExpressionCasts this expression to aCqnCaseExpression.- Specified by:
asCaseExpressionin interfaceCqnExpression- Returns:
- this as a case expression
-
accept
Description copied from interface:CqnTokenTraverses the expression tree represented by this token with a givenvisitor. The traversal order is depth-first. If this token has child nodes they are traversed first by dispatching the visitor to the children'sacceptmethods. Afterwards this token is passed to the visitor'svisitmethod specific for this token's type.- Specified by:
acceptin interfaceCqnExpression- Specified by:
acceptin interfaceCqnToken- Parameters:
visitor- theCqnVisitor
-