Package org.codehaus.janino

# Class Java.Block

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

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

Enclosing class:
  `Java`

public static final class Java.Block extends Java.Statement
Representation of a Java "block" (JLS7 14.2).

The statements that the block defines are executed in sequence.

## Field Summary

Fields
Modifier and Type
Field
Description
`final List<Java.BlockStatement>`
`statements`
The list of statements that comprise the body of the block.

### 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
`Block(Location location)`

## 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.
`void`
`addStatement(Java.BlockStatement statement)`
Adds one statement to the end of the block.
`void`
`addStatements(List<? extends Java.BlockStatement> statements)`
Adds a list of statements to the end of the block.
`Java.BlockStatement[]`
`getStatements()`
`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

### statements

public final List<Java.BlockStatement> statements
The list of statements that comprise the body of the block.

## Constructor Details

### Block

public Block(Location location)

## Method Details

### addStatement

public void addStatement(Java.BlockStatement statement)
Adds one statement to the end of the block.

### addStatements

public void addStatements(List<? extends Java.BlockStatement> statements)
Adds a list of statements to the end of the block.

### getStatements

public Java.BlockStatement[] getStatements()

Returns:
  A copy of the list of statements that comprise the body of the block

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

### toString

public String toString()

Overrides:
  `toString` in class `Object`