Package com.snowflake.snowpark_java

## Class CaseExpr

- java.lang.Object
- - com.snowflake.snowpark_java.Column
  - - com.snowflake.snowpark_java.CaseExpr

-     public class CaseExpr
      extends Column

  Represents a CASE expression.

  To construct this object for a CASE expression, call the `com.snowflake.snowpark_java.Functions.when`. specifying a condition and the corresponding result for that condition. Then, call the `when` and `otherwise` methods to specify additional conditions and results.

  Since:
    0.12.0

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Column` | `otherwise​(java.lang.Object value)` | Sets the default result for this CASE expression.
    `CaseExpr` | `when​(Column condition, java.lang.Object value)` | Appends one more WHEN condition to the CASE expression.

    - ### Methods inherited from class com.snowflake.snowpark_java.Column

      `alias, and, as, asc, asc_nulls_first, asc_nulls_last, between, bitand, bitor, bitxor, cast, cast, collate, desc, desc_nulls_first, desc_nulls_last, divide, equal_nan, equal_null, equal_to, geq, getName, gt, in, in, is_not_null, is_null, isNull, leq, like, lt, minus, mod, multiply, not_equal, or, over, over, plus, regexp, subField, subField, toString, unary_minus, unary_not, withinGroup`

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

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

- - ### Method Detail

    - #### when

          public CaseExpr when​(Column condition,
                               java.lang.Object value)

      Appends one more WHEN condition to the CASE expression. This method handles any literal value and converts it into a `Column` if applies.

      Example:

           Column result = when(col("age").lt(lit(18)), "Minor")
           .when(col("age").lt(lit(65)), "Adult")
           .otherwise("Senior");

      Parameters:
        `condition` - The case condition
        `value` - The result value in the given condition
      Returns:
        The result case expression
      Since:
        0.12.0

    - #### otherwise

          public Column otherwise​(java.lang.Object value)

      Sets the default result for this CASE expression. This method handles any literal value and converts it into a `Column` if applies.

      Example:

           Column result = when(col("state").equal(lit("CA")), lit(1000))
           .when(col("state").equal(lit("NY")), lit(2000))
           .otherwise(1000);

      Parameters:
        `value` - The default value, which can be any literal (e.g., String, int, boolean) or a `Column`.
      Returns:
        The result column.
      Since:
        0.12.0