Top Description Methods
com.sun.source.tree

public Interface VariableTree

extends StatementTree
Known Direct Implementers
com.sun.tools.javac.tree.JCTree.JCVariableDecl
Imports
javax.lang.model.element.Name

A tree node for a variable declaration. For example:
  modifiers type name initializer ;
  modifiers type qualified-name.this
Authors
Peter von der Ahé, Jonathan Gibbons
Since
1.6
Java Language Specification
8.3 Field Declarations, 14.4 Local Variable Declaration Statements

Method Summary

Modifier and TypeMethod and Description
public ExpressionTree

Returns:

the initializer
getInitializer
()

Returns the initializer for the variable, or null if none.

public ModifiersTree

Returns:

the modifiers
getModifiers
()

Returns the modifiers, including any annotations, on the declaration.

public Name

Returns:

the name
getName
()

Returns the name of the variable being declared or empty name if both the variable is unnamed and the preview features are enabled (Unnamed Patterns and Variables).

public ExpressionTree

Returns:

the qualified identifier of a receiver declaration
getNameExpression
()

Returns the qualified identifier for the name being "declared".

public Tree

Returns:

the type
getType
()

Returns the type of the variable being declared.

Method Detail

getInitializerback to summary
public ExpressionTree getInitializer()

Returns the initializer for the variable, or null if none.

Returns:ExpressionTree

the initializer

getModifiersback to summary
public ModifiersTree getModifiers()

Returns the modifiers, including any annotations, on the declaration.

Returns:ModifiersTree

the modifiers

getNameback to summary
public Name getName()

Returns the name of the variable being declared or empty name if both the variable is unnamed and the preview features are enabled (Unnamed Patterns and Variables).

Returns:Name

the name

getNameExpressionback to summary
public ExpressionTree getNameExpression()

Returns the qualified identifier for the name being "declared". This is only used in certain cases for the receiver of a method declaration. Returns null in all other cases.

Returns:ExpressionTree

the qualified identifier of a receiver declaration

getTypeback to summary
public Tree getType()

Returns the type of the variable being declared.

Returns:Tree

the type