TryCatchStatement (Groovy 4.0.15)
Description: declaration: package: org.codehaus.groovy.ast.stmt, class: TryCatchStatement

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

All Implemented Interfaces:
  `NodeMetaDataHandler`

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCatch(CatchStatement catchStatement)`
  `void`
  `addResource(ExpressionStatement resourceStatement)`
  `CatchStatement`
  `getCatchStatement(int idx)`
  `List<CatchStatement>`
  `getCatchStatements()`
  `Statement`
  `getFinallyStatement()`
  `ExpressionStatement`
  `getResourceStatement(int idx)`
  `List<ExpressionStatement>`
  `getResourceStatements()`
  `Statement`
  `getTryStatement()`
  `static boolean`
  `isResource(Expression expression)`
  `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, copyStatementLabels, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel`

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

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition`

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

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

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Constructor Details

  - ### TryCatchStatement

    public TryCatchStatement(Statement tryStatement, Statement finallyStatement)

- ## Method Details

  - ### visit

    public void visit(GroovyCodeVisitor visitor)
    Overrides:
      `visit` in class `ASTNode`

  - ### getResourceStatements

    public List<ExpressionStatement> getResourceStatements()

  - ### getCatchStatements

    public List<CatchStatement> getCatchStatements()

  - ### getFinallyStatement

    public Statement getFinallyStatement()

  - ### getTryStatement

    public Statement getTryStatement()

  - ### addResource

    public void addResource(ExpressionStatement resourceStatement)

  - ### isResource

    public static boolean isResource(Expression expression)

  - ### addCatch

    public void addCatch(CatchStatement catchStatement)

  - ### getCatchStatement

    public CatchStatement getCatchStatement(int idx)
    Returns:
      the catch statement of the given index or null

  - ### getResourceStatement

    public ExpressionStatement getResourceStatement(int idx)
    Returns:
      the resource 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)