Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ast.stmt
Class SwitchStatement

    java.lang.Object
      org.codehaus.groovy.ast.ASTNode
          org.codehaus.groovy.ast.stmt.Statement
              org.codehaus.groovy.ast.stmt.SwitchStatement

    public class SwitchStatement

extends Statement

Represents a switch (object) { case value: ... case [1, 2, 3]: ... default: ... } statement in Groovy.

Version:
  $Revision: 6778 $
Author:
  James Strachan

Constructor Summary
`SwitchStatement(Expression expression)`
`SwitchStatement(Expression expression, List caseStatements, Statement defaultStatement)`
`SwitchStatement(Expression expression, Statement defaultStatement)`

Method Summary
`void` | `addCase(CaseStatement caseStatement)`
`CaseStatement` | `getCaseStatement(int idx)`
`List` | `getCaseStatements()`
`Statement` | `getDefaultStatement()`
`Expression` | `getExpression()`
`void` | `setDefaultStatement(Statement defaultStatement)`
`void` | `setExpression(Expression e)`
`void` | `visit(GroovyCodeVisitor visitor)`

Methods inherited from class org.codehaus.groovy.ast.stmt.Statement
`getStatementLabel, isEmpty, setStatementLabel`

Methods inherited from class org.codehaus.groovy.ast.ASTNode
`getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setSourcePosition`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SwitchStatement

    public SwitchStatement(Expression expression)

### SwitchStatement

    public SwitchStatement(Expression expression,
                           Statement defaultStatement)

### SwitchStatement

    public SwitchStatement(Expression expression,
                           List caseStatements,
                           Statement defaultStatement)

Method Detail

### visit

    public void visit(GroovyCodeVisitor visitor)

  Overrides:
    `visit` in class `ASTNode`

### getCaseStatements

    public List getCaseStatements()

### getExpression

    public Expression getExpression()

### setExpression

    public void setExpression(Expression e)

### getDefaultStatement

    public Statement getDefaultStatement()

### setDefaultStatement

    public void setDefaultStatement(Statement defaultStatement)

### addCase

    public void addCase(CaseStatement caseStatement)

### getCaseStatement

    public CaseStatement getCaseStatement(int idx)

  Returns:
    the case statement of the given index or null

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2008 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD