Package org.codehaus.groovy.ast.stmt

# Class TryCatchStatement

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

public class TryCatchStatement extends Statement
Represents a try { ... } catch () finally {} statement in Groovy

Author:
  James Strachan

## Constructor Summary

Constructors
Constructor
Description
`TryCatchStatement(Statement tryStatement, Statement finallyStatement)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addCatch(CatchStatement catchStatement)`
`CatchStatement`
`getCatchStatement(int idx)`
`List<CatchStatement>`
`getCatchStatements()`
`Statement`
`getFinallyStatement()`
`Statement`
`getTryStatement()`
`void`
`setCatchStatement(int idx, CatchStatement catchStatement)`
`void`
`setFinallyStatement(Statement finallyStatement)`
`void`
`setTryStatement(Statement tryStatement)`
`void`
`visit(GroovyCodeVisitor visitor)`

### Methods inherited from class org.codehaus.groovy.ast.stmt.Statement

`addStatementLabel, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`

### Methods inherited from class org.codehaus.groovy.ast.ASTNode

`copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getNodeMetaData, getText, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TryCatchStatement

public TryCatchStatement(Statement tryStatement, Statement finallyStatement)

## Method Details

### visit

public void visit(GroovyCodeVisitor visitor)

Overrides:
  `visit` in class `ASTNode`

### getCatchStatements

public List<CatchStatement> getCatchStatements()

### getFinallyStatement

public Statement getFinallyStatement()

### getTryStatement

public Statement getTryStatement()

### addCatch

public void addCatch(CatchStatement catchStatement)

### getCatchStatement

public CatchStatement getCatchStatement(int idx)

Returns:
  the catch statement of the given index or null

### setTryStatement

public void setTryStatement(Statement tryStatement)

### setCatchStatement

public void setCatchStatement(int idx, CatchStatement catchStatement)

### setFinallyStatement

public void setFinallyStatement(Statement finallyStatement)