Package org.codehaus.janino

# Class Java.TryStatement

java.lang.Object
org.codehaus.janino.Java.Located
org.codehaus.janino.Java.Statement
org.codehaus.janino.Java.TryStatement

All Implemented Interfaces:
  `Java.BlockStatement`, `Java.Locatable`, `Java.Scope`

Enclosing class:
  `Java`

public static final class Java.TryStatement extends Java.Statement
Representation of a JLS7 14.20 TRY statement.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`Java.TryStatement.LocalVariableDeclaratorResource`
Representation of a JLS9 14.20.2 "local-variable-declarator resource" in a TRY-with-resources statement.
`static class`
`Java.TryStatement.Resource`
Representation of a JLS9 14.20.2 "resource" in a TRY-with-resources statement.
`static class`
`Java.TryStatement.VariableAccessResource`
Representation of a JLS9 14.20.2 "variable-access resource" in a TRY-with-resources statement.

## Field Summary

Fields
Modifier and Type
Field
Description
`final Java.BlockStatement`
`body`
The body of the TRY statement.
`final List<Java.CatchClause>`
`catchClauses`
The list of catch clauses (including the "default" clause) of the TRY statement.
`final Java.Block`
`finallY`
The optional "finally" block of the TRY statement.
`final List<Java.TryStatement.Resource>`
`resources`
The "resources" managed by the TRY-with-resources statement.

### Fields inherited from class org.codehaus.janino.Java.Statement

`localVariables`

### Fields inherited from class org.codehaus.janino.Java.Located

`NOWHERE`

## Constructor Summary

Constructors
Constructor
Description
`TryStatement(Location location, List<Java.TryStatement.Resource> resources, Java.BlockStatement body, List<Java.CatchClause> catchClauses)`
A TRY statement without a FINALLY clause.
`TryStatement(Location location, List<Java.TryStatement.Resource> resources, Java.BlockStatement body, List<Java.CatchClause> catchClauses, Java.Block finallY)`
`TryStatement(Location location, Java.BlockStatement body, List<Java.CatchClause> catchClauses)`
A TRY statement with no resources and no FINALLY clause.

## Method Summary

Modifier and Type
Method
Description
`<R, EX extends Throwable>
R`
`accept(Visitor.BlockStatementVisitor<R,EX> visitor)`
Invokes the "`visit...()`" method of `Visitor.BlockStatementVisitor` for the concrete `Java.BlockStatement` type.
`String`
`toString()`

### Methods inherited from class org.codehaus.janino.Java.Statement

`findLocalVariable, getEnclosingScope, setEnclosingScope`

### Methods inherited from class org.codehaus.janino.Java.Located

`getLocation, throwCompileException`

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

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

### Methods inherited from interface org.codehaus.janino.Java.Locatable

`getLocation, throwCompileException`

## Field Details

### resources

public final List<Java.TryStatement.Resource> resources
The "resources" managed by the TRY-with-resources statement.

### body

public final Java.BlockStatement body
The body of the TRY statement.

### catchClauses

public final List<Java.CatchClause> catchClauses
The list of catch clauses (including the "default" clause) of the TRY statement.

### finallY

@Nullable public final Java.Block finallY
The optional "finally" block of the TRY statement.

## Constructor Details

### TryStatement

public TryStatement(Location location, Java.BlockStatement body, List<Java.CatchClause> catchClauses)
A TRY statement with no resources and no FINALLY clause.

### TryStatement

public TryStatement(Location location, List<Java.TryStatement.Resource> resources, Java.BlockStatement body, List<Java.CatchClause> catchClauses)
A TRY statement without a FINALLY clause.

### TryStatement

public TryStatement(Location location, List<Java.TryStatement.Resource> resources, Java.BlockStatement body, List<Java.CatchClause> catchClauses, @Nullable Java.Block finallY)

## Method Details

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### accept

@Nullable public <R, EX extends Throwable> R accept(Visitor.BlockStatementVisitor<R,EX> visitor) throws EX
Description copied from interface: `Java.BlockStatement`
Invokes the "`visit...()`" method of `Visitor.BlockStatementVisitor` for the concrete `Java.BlockStatement` type.

Throws:
  `EX`