Package org.codehaus.janino

# Class Java.VariableDeclarator

java.lang.Object
org.codehaus.janino.Java.Located
org.codehaus.janino.Java.VariableDeclarator

All Implemented Interfaces:
  `Java.Locatable`

Enclosing class:
  `Java`

public static final class Java.VariableDeclarator extends Java.Located
Used by FieldDeclaration and LocalVariableDeclarationStatement.

## Field Summary

Fields
Modifier and Type
Field
Description
`final int`
`brackets`
The number of "[]"s after the name.
`final Java.ArrayInitializerOrRvalue`
`initializer`
The initializer for the variable, if any.
`Java.LocalVariable`
`localVariable`
Used only if the variable declarator declares a local variable.
`final String`
`name`
The name of this field or local variable.

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

`NOWHERE`

## Constructor Summary

Constructors
Constructor
Description
`VariableDeclarator(Location location, String name, int brackets, Java.ArrayInitializerOrRvalue initializer)`

## Method Summary

Modifier and Type
Method
Description
`void`
`setEnclosingScope(Java.Scope s)`
Sets the immediately enclosing scope for the (optional) initializer.
`String`
`toString()`

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

## Field Details

### name

public final String name
The name of this field or local variable.

### brackets

public final int brackets
The number of "[]"s after the name.

### initializer

@Nullable public final Java.ArrayInitializerOrRvalue initializer
The initializer for the variable, if any.

### localVariable

@Nullable public Java.LocalVariable localVariable
Used only if the variable declarator declares a local variable.

## Constructor Details

### VariableDeclarator

public VariableDeclarator(Location location, String name, int brackets, @Nullable Java.ArrayInitializerOrRvalue initializer)

## Method Details

### setEnclosingScope

public void setEnclosingScope(Java.Scope s)
Sets the immediately enclosing scope for the (optional) initializer.

### toString

public String toString()

Overrides:
  `toString` in class `Object`