Groovy Documentation

org.codehaus.groovy.ast.stmt
[Java] 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.

Authors:
James Strachan
Version:
\$Revision\$


Constructor Summary
SwitchStatement(Expression expression)

SwitchStatement(Expression expression, Statement defaultStatement)

SwitchStatement(Expression expression, java.util.List caseStatements, Statement defaultStatement)

 
Method Summary
void addCase(CaseStatement caseStatement)

CaseStatement getCaseStatement(int idx)

@return the case statement of the given index or null

java.util.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
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

SwitchStatement

public SwitchStatement(Expression expression)


SwitchStatement

public SwitchStatement(Expression expression, Statement defaultStatement)


SwitchStatement

public SwitchStatement(Expression expression, java.util.List caseStatements, Statement defaultStatement)


 
Method Detail

addCase

public void addCase(CaseStatement caseStatement)


getCaseStatement

public CaseStatement getCaseStatement(int idx)
Returns:
the case statement of the given index or null


getCaseStatements

public java.util.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)


 

Groovy Documentation