Class 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 Detail

      • whens

        public final List<When> whens
        List of when clauses.
    • 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: Expression
        Translates the expression.
        Specified by:
        translate in class Expression
        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.