Class CaseExpression
java.lang.Object
org.springframework.data.relational.core.sql.CaseExpression
- All Implemented Interfaces:
Expression, Segment, Visitable
Case with one or more conditions expression.
Results in a rendered condition:
CASE
WHEN condition1 THEN result1
WHEN condition2 THEN result2
ELSE result
END
- Since:
- 3.4
- Author:
- Sven Rienstra
-
Method Summary
Modifier and TypeMethodDescriptionstatic CaseExpressionCreate CASEExpressionwith initialWhencondition.elseExpression(Expression elseExpression) Add ELSE clausebooleaninthashCode()Generate a hash code from thisSegment.toString()Return a SQL string representation of thisSegment.voidAdd additionalWhencondition
-
Method Details
-
create
Create CASEExpressionwith initialWhencondition.- Parameters:
condition- initialWhencondition- Returns:
- the
CaseExpression
-
when
Add additionalWhencondition- Parameters:
condition- theWhencondition- Returns:
- the
CaseExpression
-
elseExpression
Add ELSE clause- Parameters:
elseExpression- theExpressionelse value- Returns:
- the
CaseExpression
-
toString
Description copied from interface:SegmentReturn a SQL string representation of thisSegment.The representation is intended for debugging purposes and an approximation to the generated SQL. While it might work in the context of a specific dialect, you should not assume that the
Segment.toString()representation works across multiple databases. -
visit
-
hashCode
public int hashCode()Description copied from interface:SegmentGenerate a hash code from thisSegment.Hashcode typically derives from the
Segment.toString()representation so twoSegments yield the sameSegment.hashCode()if theirSegment.toString()representation matches. -
equals
Description copied from interface:SegmentCheck whether thisSegmentis equal to anotherSegment.Equality is typically given if the
Segment.toString()representation matches.
-