Package org.codehaus.janino

# Class Java.FieldDeclaration

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

All Implemented Interfaces:
  `Java.Annotatable`, `Java.BlockStatement`, `Java.DocCommentable`, `Java.FieldDeclarationOrInitializer`, `Java.Locatable`, `Java.Scope`, `Java.TypeBodyDeclaration`

Enclosing class:
  `Java`

public static final class Java.FieldDeclaration extends Java.Statement implements Java.Annotatable, Java.DocCommentable, Java.FieldDeclarationOrInitializer
This class is derived from "Statement", because it provides for the initialization of the field. In other words, "compile()" generates the code that initializes the field.

## Field Summary

Fields
Modifier and Type
Field
Description
`final Java.Modifier[]`
`modifiers`
The modifiers of this field declaration.
`final Java.Type`
`type`
The type of this field.
`final Java.VariableDeclarator[]`
`variableDeclarators`
The declarators of this field declaration, e.g.

### 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
`FieldDeclaration(Location location, String docComment, Java.Modifier[] modifiers, Java.Type type, Java.VariableDeclarator[] variableDeclarators)`

## 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.
`<R, EX extends Throwable>
R`
`accept(Visitor.FieldDeclarationOrInitializerVisitor<R,EX> visitor)`
`<R, EX extends Throwable>
R`
`accept(Visitor.TypeBodyDeclarationVisitor<R,EX> visitor)`
Invokes the "`visit...()`" method of `Visitor.TypeBodyDeclarationVisitor` for the concrete `Java.TypeBodyDeclaration` type.
`Access`
`getAccess()`
`Java.Annotation[]`
`getAnnotations()`
`Java.TypeDeclaration`
`getDeclaringType()`
`String`
`getDocComment()`
`Java.Modifier[]`
`getModifiers()`
`boolean`
`hasDeprecatedDocTag()`
Returns `true` if the object has a doc comment and the `&#64;deprecated` tag appears in the doc comment.
`boolean`
`isFinal()`
`boolean`
`isPrivate()`
`boolean`
`isStatic()`
`boolean`
`isTransient()`
`boolean`
`isVolatile()`
`void`
`setDeclaringType(Java.TypeDeclaration declaringType)`
Sets the type declaration that this declaration belongs to.
`void`
`setEnclosingScope(Java.Scope enclosingScope)`
Sets the enclosing scope of this `Java.BlockStatement`.
`String`
`toString()`

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

`findLocalVariable, getEnclosingScope`

### 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.BlockStatement

`findLocalVariable, getEnclosingScope`

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

`getLocation, throwCompileException`

## Field Details

### modifiers

public final Java.Modifier[] modifiers
The modifiers of this field declaration.

### type

public final Java.Type type
The type of this field.

### variableDeclarators

public final Java.VariableDeclarator[] variableDeclarators
The declarators of this field declaration, e.g. "int a, b;".

## Constructor Details

### FieldDeclaration

public FieldDeclaration(Location location, @Nullable String docComment, Java.Modifier[] modifiers, Java.Type type, Java.VariableDeclarator[] variableDeclarators)

## Method Details

### setDeclaringType

public void setDeclaringType(Java.TypeDeclaration declaringType)
Description copied from interface: `Java.TypeBodyDeclaration`
Sets the type declaration that this declaration belongs to.

Specified by:
  `setDeclaringType` in interface `Java.TypeBodyDeclaration`

### getDeclaringType

public Java.TypeDeclaration getDeclaringType()

Specified by:
  `getDeclaringType` in interface `Java.TypeBodyDeclaration`
Returns:
  The type declaration that this declaration belongs to.

### setEnclosingScope

public void setEnclosingScope(Java.Scope enclosingScope)
Description copied from interface: `Java.BlockStatement`
Sets the enclosing scope of this `Java.BlockStatement`.

Specified by:
  `setEnclosingScope` in interface `Java.BlockStatement`
Overrides:
  `setEnclosingScope` in class `Java.Statement`

### getModifiers

public Java.Modifier[] getModifiers()

Specified by:
  `getModifiers` in interface `Java.TypeBodyDeclaration`
Returns:
  The `Java.Modifier`s of this declaration

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### accept

@Nullable public <R, EX extends Throwable> R accept(Visitor.FieldDeclarationOrInitializerVisitor<R,EX> visitor) throws EX

Specified by:
  `accept` in interface `Java.FieldDeclarationOrInitializer`
Throws:
  `EX`

### accept

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

Specified by:
  `accept` in interface `Java.TypeBodyDeclaration`
Throws:
  `EX`

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

Specified by:
  `accept` in interface `Java.BlockStatement`
Throws:
  `EX`

### getDocComment

@Nullable public String getDocComment()

Specified by:
  `getDocComment` in interface `Java.DocCommentable`
Returns:
  The doc comment of the object or `null`

### hasDeprecatedDocTag

public boolean hasDeprecatedDocTag()
Description copied from interface: `Java.DocCommentable`
Returns `true` if the object has a doc comment and the `&#64;deprecated` tag appears in the doc comment.

Specified by:
  `hasDeprecatedDocTag` in interface `Java.DocCommentable`

### getAccess

public Access getAccess()

### getAnnotations

public Java.Annotation[] getAnnotations()

Specified by:
  `getAnnotations` in interface `Java.Annotatable`
Returns:
  The annotations of this `Java.TypeDeclaration`, `Java.FieldDeclaration`, `Java.MethodDeclarator` or `Java.ConstructorDeclarator`

### isFinal

public boolean isFinal()

### isPrivate

public boolean isPrivate()

### isStatic

public boolean isStatic()

### isTransient

public boolean isTransient()

### isVolatile

public boolean isVolatile()