src/share/classes/javax/lang/model/element/VariableElement.java

Wed, 23 Jun 2010 16:51:30 -0700

author
darcy
date
Wed, 23 Jun 2010 16:51:30 -0700
changeset 594
be5cafeb318d
parent 554
9d9f26857129
child 849
7a75a1803c7a
permissions
-rw-r--r--

6911258: Project Coin: Add essential API support for Automatic Resource Management (ARM) blocks
Reviewed-by: darcy, alanb
Contributed-by: jjb@google.com

duke@1 1 /*
ohair@554 2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package javax.lang.model.element;
duke@1 27
duke@1 28 import javax.lang.model.type.TypeMirror;
duke@1 29 import javax.lang.model.util.Elements;
duke@1 30
duke@1 31
duke@1 32 /**
duke@1 33 * Represents a field, {@code enum} constant, method or constructor
duke@1 34 * parameter, local variable, or exception parameter.
duke@1 35 *
duke@1 36 * @author Joseph D. Darcy
duke@1 37 * @author Scott Seligman
duke@1 38 * @author Peter von der Ahé
duke@1 39 * @since 1.6
duke@1 40 */
duke@1 41
duke@1 42 public interface VariableElement extends Element {
duke@1 43
duke@1 44 /**
duke@1 45 * Returns the value of this variable if this is a {@code final}
duke@1 46 * field initialized to a compile-time constant. Returns {@code
duke@1 47 * null} otherwise. The value will be of a primitive type or a
duke@1 48 * {@code String}. If the value is of a primitive type, it is
duke@1 49 * wrapped in the appropriate wrapper class (such as {@link
duke@1 50 * Integer}).
duke@1 51 *
duke@1 52 * <p>Note that not all {@code final} fields will have
duke@1 53 * constant values. In particular, {@code enum} constants are
duke@1 54 * <em>not</em> considered to be compile-time constants. To have a
duke@1 55 * constant value, a field's type must be either a primitive type
duke@1 56 * or {@code String}.
duke@1 57 *
duke@1 58 * @return the value of this variable if this is a {@code final}
duke@1 59 * field initialized to a compile-time constant, or {@code null}
duke@1 60 * otherwise
duke@1 61 *
duke@1 62 * @see Elements#getConstantExpression(Object)
duke@1 63 * @jls3 15.28 Constant Expression
duke@1 64 * @jls3 4.12.4 final Variables
duke@1 65 */
duke@1 66 Object getConstantValue();
duke@1 67 }

mercurial