/*
* @(#)VariableElement.java 1.4 06/10/05
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.lang.model.element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
/**
* 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
*/
public interface VariableElement extends Element {
/**
* 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}).
*
* <p>Note that not all {@code final} fields will have
* constant values. In particular, {@code enum} constants are
* <em>not</em> 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
*/
Object getConstantValue();
}