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

Version:
  $Revision: 15807 $
Author:
  James Strachan

### Constructor Summary

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

### Method Summary

Methods
`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

`getStatementLabel, isEmpty, setStatementLabel`

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

`copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, getText, 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 Detail

#### TryCatchStatement

    public TryCatchStatement(Statement tryStatement,
                     Statement finallyStatement)

### Method Detail

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