FileDocCategorySizeDatePackage
VariableElement.javaAPI DocJava SE 6 API1611Tue Jun 10 00:26:10 BST 2008javax.lang.model.element

VariableElement

public interface VariableElement implements Element
Represents a field, {@code enum} constant, method or constructor parameter, local variable, or exception parameter.
author
Joseph D. Darcy
author
Scott Seligman
author
Peter von der Ahé
version
1.4 06/10/05
since
1.6

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectgetConstantValue()
Returns the value of this variable if this is a {@code final} field initialized to a compile-time constant. Returns {@code null} otherwise. The value will be of a primitive type or a {@code String}. If the value is of a primitive type, it is wrapped in the appropriate wrapper class (such as {@link Integer}).

Note that not all {@code final} fields will have constant values. In particular, {@code enum} constants are not considered to be compile-time constants. To have a constant value, a field's type must be either a primitive type or {@code String}.

return
the value of this variable if this is a {@code final} field initialized to a compile-time constant, or {@code null} otherwise
see
Elements#getConstantExpression(Object)
jls3
15.28 Constant Expression
jls3
4.12.4 final Variables