KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > VariableElement


1 /*
2  * @(#)VariableElement.java 1.4 06/10/05
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.element;
9
10 import javax.lang.model.type.TypeMirror;
11 import javax.lang.model.util.Elements;
12
13
14 /**
15  * Represents a field, {@code enum} constant, method or constructor
16  * parameter, local variable, or exception parameter.
17  *
18  * @author Joseph D. Darcy
19  * @author Scott Seligman
20  * @author Peter von der Ahé
21  * @version 1.4 06/10/05
22  * @since 1.6
23  */

24
25 public interface VariableElement extends Element {
26
27     /**
28      * Returns the value of this variable if this is a {@code final}
29      * field initialized to a compile-time constant. Returns {@code
30      * null} otherwise. The value will be of a primitive type or a
31      * {@code String}. If the value is of a primitive type, it is
32      * wrapped in the appropriate wrapper class (such as {@link
33      * Integer}).
34      *
35      * <p>Note that not all {@code final} fields will have
36      * constant values. In particular, {@code enum} constants are
37      * <em>not</em> considered to be compile-time constants. To have a
38      * constant value, a field's type must be either a primitive type
39      * or {@code String}.
40      *
41      * @return the value of this variable if this is a {@code final}
42      * field initialized to a compile-time constant, or {@code null}
43      * otherwise
44      *
45      * @see Elements#getConstantExpression(Object)
46      * @jls3 15.28 Constant Expression
47      * @jls3 4.12.4 final Variables
48      */

49     Object JavaDoc getConstantValue();
50 }
51
Popular Tags