Class Case
- java.lang.Object
-
- com.feedzai.commons.sql.abstraction.dml.Expression
-
- com.feedzai.commons.sql.abstraction.dml.Case
-
- All Implemented Interfaces:
Serializable
public class Case extends Expression
Case SQL Expression.- Since:
- 2.2.3
- Author:
- Francisco Santos (francisco.santos@feedzai.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description List<When>whensList of when clauses.-
Fields inherited from class com.feedzai.commons.sql.abstraction.dml.Expression
alias, enclosed, joins, ordering, properties, quotes, translator, withNoLock
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CasecaseWhen()Returns a new empty case.static CasecaseWhen(Expression condition, Expression trueAction)Returns a new "case when" that does the trueAction considering the condition.ExpressiongetFalseAction()Gets the false action.Caseotherwise(Expression falseAction)Sets the false action.Stringtranslate()Translates the expression.Casewhen(Expression condition, Expression action)Adds a new when clause to this case.-
Methods inherited from class com.feedzai.commons.sql.abstraction.dml.Expression
alias, asc, desc, enclose, fullOuterJoin, getAlias, getJoins, getOrdering, innerJoin, isAliased, isEnclosed, isQuote, isQuotes, isWithNoLock, leftOuterJoin, rightOuterJoin, unquote, withNoLock
-
-
-
-
Method Detail
-
getFalseAction
public Expression getFalseAction()
Gets the false action.- Returns:
- the false action.
-
caseWhen
public static Case caseWhen()
Returns a new empty case.- Returns:
- a new case.
-
caseWhen
public static Case caseWhen(Expression condition, Expression trueAction)
Returns a new "case when" that does the trueAction considering the condition.- Parameters:
condition- condition to verify.trueAction- action to be executed if the condition is true.- Returns:
- a new "case when" that does the trueAction considering the condition.
-
translate
public String translate()
Description copied from class:ExpressionTranslates the expression.- Specified by:
translatein classExpression- Returns:
- A translation of the implementing expression.
-
when
public Case when(Expression condition, Expression action)
Adds a new when clause to this case.- Parameters:
condition- condition to verify.action- action to be executed if the condition is true.- Returns:
- this case.
-
otherwise
public Case otherwise(Expression falseAction)
Sets the false action.- Parameters:
falseAction- action done if the condition is false.- Returns:
- this case.
-
-