VariableTree.java revision 2571:10fc81ac75b4
1275970Scy/* 2275970Scy * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 3275970Scy * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4275970Scy * 5290000Sglebius * This code is free software; you can redistribute it and/or modify it 6290000Sglebius * under the terms of the GNU General Public License version 2 only, as 7290000Sglebius * published by the Free Software Foundation. Oracle designates this 8275970Scy * particular file as subject to the "Classpath" exception as provided 9290000Sglebius * by Oracle in the LICENSE file that accompanied this code. 10290000Sglebius * 11290000Sglebius * This code is distributed in the hope that it will be useful, but WITHOUT 12290000Sglebius * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13290000Sglebius * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14290000Sglebius * version 2 for more details (a copy is included in the LICENSE file that 15290000Sglebius * accompanied this code). 16290000Sglebius * 17290000Sglebius * You should have received a copy of the GNU General Public License version 18290000Sglebius * 2 along with this work; if not, write to the Free Software Foundation, 19290000Sglebius * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20290000Sglebius * 21290000Sglebius * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22290000Sglebius * or visit www.oracle.com if you need additional information or have any 23290000Sglebius * questions. 24290000Sglebius */ 25290000Sglebius 26290000Sglebiuspackage com.sun.source.tree; 27290000Sglebius 28290000Sglebiusimport javax.lang.model.element.Name; 29290000Sglebius 30290000Sglebius/** 31290000Sglebius * A tree node for a variable declaration. 32290000Sglebius * 33290000Sglebius * For example: 34290000Sglebius * <pre> 35290000Sglebius * <em>modifiers</em> <em>type</em> <em>name</em> <em>initializer</em> ; 36290000Sglebius * <em>modifiers</em> <em>type</em> <em>qualified-name</em>.this 37290000Sglebius * </pre> 38290000Sglebius * 39290000Sglebius * @jls sections 8.3 and 14.4 40290000Sglebius * 41290000Sglebius * @author Peter von der Ahé 42290000Sglebius * @author Jonathan Gibbons 43290000Sglebius * @since 1.6 44290000Sglebius */ 45298770Sdelphij@jdk.Exported 46290000Sglebiuspublic interface VariableTree extends StatementTree { 47290000Sglebius /** 48290000Sglebius * Returns the modifiers, including any annotations, on the declaration. 49290000Sglebius * @return the modifiers 50290000Sglebius */ 51290000Sglebius ModifiersTree getModifiers(); 52290000Sglebius 53275970Scy /** 54275970Scy * Returns the name of the variable being declared. 55275970Scy * @return the name 56275970Scy */ 57275970Scy Name getName(); 58290000Sglebius 59290000Sglebius /** 60275970Scy * Returns the qualified identifier for the name being "declared". 61275970Scy * This is only used in certain cases for the receiver of a 62290000Sglebius * method declaration. Returns {@code null} in all other cases. 63275970Scy * @return the qualified identifier of a receiver declaration 64275970Scy */ 65275970Scy ExpressionTree getNameExpression(); 66275970Scy 67290000Sglebius /** 68290000Sglebius * Returns the type of the variable being declared. 69275970Scy * @return the type 70275970Scy */ 71275970Scy Tree getType(); 72290000Sglebius 73290000Sglebius /** 74290000Sglebius * Returns the initializer for the variable, or {@code null} if none. 75290000Sglebius * @return the initializer 76290000Sglebius */ 77290000Sglebius ExpressionTree getInitializer(); 78290000Sglebius} 79290000Sglebius