Groovy 1.7.0

## 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

    class SwitchStatement
    extends Statement

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

author:
  James Strachan

version:
  $Revision: 15807 $

Constructor Summary
`SwitchStatement(Expression expression)`
`SwitchStatement(Expression expression, Statement defaultStatement)`
`SwitchStatement(Expression expression, List caseStatements, 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 Statement
getStatementLabel, isEmpty, setStatementLabel

Methods inherited from class ASTNode
getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setSourcePosition, visit

Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

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

### addCase

    public void addCase(CaseStatement caseStatement)

### getCaseStatement

    public CaseStatement getCaseStatement(int idx)

  return:
    the case statement of the given index or null

### getCaseStatements

    public List getCaseStatements()

### getDefaultStatement

    public Statement getDefaultStatement()

### getExpression

    public Expression getExpression()

### setDefaultStatement

    public void setDefaultStatement(Statement defaultStatement)

### setExpression

    public void setExpression(Expression e)

### visit

    public void visit(GroovyCodeVisitor visitor)

Copyright © 2003-2009 The Codehaus. All rights reserved.