org.eclipse.jdt.core.ILocalVariable Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core;
/**
* Represents a local variable declared in a method or an initializer.
* ILocalVariable
are pseudo-elements created as the result of a ICodeAssist.codeSelect(...)
* operation. They are not part of the Java model (exists()
returns whether the parent exists rather than
* whether the local variable exists in the parent) and they are not included in the children of an IMethod
* or an IInitializer
.
*
* In particular such a pseudo-element should not be used as a handle. For example its name range won't be updated
* if the underlying source changes.
*
*
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ILocalVariable extends IJavaElement, ISourceReference, IAnnotatable {
/**
* Returns the name of this local variable.
*
* @return the name of this local variable.
*/
@Override
String getElementName();
/**
* Returns the source range of this local variable's name.
*
* @return the source range of this local variable's name
*/
@Override
ISourceRange getNameRange();
/**
* Returns the type signature of this local variable.
*
* The type signature may be either unresolved (for source types)
* or resolved (for binary types), and either basic (for basic types)
* or rich (for parameterized types). See {@link Signature} for details.
*
*
* @return the type signature of this local variable.
* @see Signature
*/
String getTypeSignature();
/**
* Returns true
if this local variable is a method parameter, false
otherwise.
*
* @return true
if this local variable is a method parameter, false
otherwise
* @since 3.7
*/
boolean isParameter();
/**
* Returns the modifier flags for this local variable. The flags can be examined using class
* {@link Flags}.
*
* Note that only flags as indicated in the source are returned.
*
* @return the modifier flags for this local variable
* @see Flags
* @since 3.7
*/
int getFlags();
/**
* Returns the declaring member of this local variable.
*
* This is a handle-only method.
*
*
* @return the declaring member of this local variable
* @since 3.7
*/
IMember getDeclaringMember();
/**
* Returns the Java type root in which this local variable is declared.
*
* This is a handle-only method.
*
*
* @return the Java type root in which this local variable is declared
* @since 3.7
*/
ITypeRoot getTypeRoot();
}