Package: org.codehaus.groovy.ast.stmt

## [Java] Class CaseStatement

- org.codehaus.groovy.ast.stmt.CaseStatement

-     public class CaseStatement
      extends Statement

  Represents a case statement within a SwitchStatement. A case statement consists of a pattern (expression) to match against the switch control expression and the statement to execute if the pattern matches. In Groovy, case patterns support various expression types for flexible matching behavior.

  See Also:
    SwitchStatement
    Statement

- - ### Constructor Summary

    Constructors
    Constructor and description
    `CaseStatement(Expression expression, Statement code)` Constructs a case statement with the given expression pattern and code block.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Statement` | `getCode()` Returns the statement executed if this case pattern matches.
    `` | `public Expression` | `getExpression()` Returns the pattern expression matched against the switch control expression.
    `` | `public void` | `setCode(Statement code)` Sets the statement executed if this case pattern matches.
    `` | `public void` | `setExpression(Expression e)` Sets the pattern expression matched against the switch control expression.
    `` | `public String` | `toString()`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Statement` | `addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public CaseStatement(Expression expression, Statement code)

      Constructs a case statement with the given expression pattern and code block.

      Parameters:
        `expression` - the Expression pattern to match against the switch control expression
        `code` - the Statement to execute if the pattern matches

  - ### Method Detail

    - #### public Statement getCode()

      Returns the statement executed if this case pattern matches.

      Returns:
        the Statement associated with this case

    - #### public Expression getExpression()

      Returns the pattern expression matched against the switch control expression.

      Returns:
        the pattern Expression

    - #### public void setCode(Statement code)

      Sets the statement executed if this case pattern matches.

      Parameters:
        `code` - the Statement to execute

    - #### public void setExpression(Expression e)

      Sets the pattern expression matched against the switch control expression.

      Parameters:
        `e` - the pattern Expression

    - #### public String toString()

    - #### public void visit(GroovyCodeVisitor visitor)