Groovy 2.2.0

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, List caseStatements, Statement defaultStatement)

 
Method Summary
void addCase(CaseStatement caseStatement)

CaseStatement getCaseStatement(int idx)

@return the case statement of the given index or null

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 Object
wait, wait, wait, equals, toString, hashCode, getClass, 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)
Returns:
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-2013 The Codehaus. All rights reserved.