Eclipse JDT
2.0

org.eclipse.jdt.core.dom
Interface IVariableBinding

All Superinterfaces:
IBinding

public interface IVariableBinding
extends IBinding

A variable binding represents either a field of a class or interface, or a local variable declaration (including formal parameters, local variables, and exception variables).

This interface is not intended to be implemented by clients.

Since:
2.0
See Also:
ITypeBinding.getDeclaredFields()

Field Summary
 
Fields inherited from interface org.eclipse.jdt.core.dom.IBinding
METHOD, PACKAGE, TYPE, VARIABLE
 
Method Summary
 ITypeBinding getDeclaringClass()
          Returns the type binding representing the class or interface that declares this field.
 String getName()
          Returns the name of the field or local variable declared in this binding.
 ITypeBinding getType()
          Returns the binding for the type of this field or local variable.
 int getVariableId()
          Returns a small integer variable id for this variable binding.
 boolean isField()
          Returns whether this binding is for a field or for a local variable.
 
Methods inherited from interface org.eclipse.jdt.core.dom.IBinding
equals, getKey, getKind, getModifiers, isDeprecated, isSynthetic, toString
 

Method Detail

isField

public boolean isField()
Returns whether this binding is for a field or for a local variable.

Returns:
true if this is the binding for a field, and false if this is the binding for a local variable

getName

public String getName()
Returns the name of the field or local variable declared in this binding. The name is always a simple identifier.

Specified by:
getName in interface IBinding
Returns:
the name of this field or local variable

getDeclaringClass

public ITypeBinding getDeclaringClass()
Returns the type binding representing the class or interface that declares this field.

The declaring class of a field is the class or interface of which it is a member. Local variables have no declaring class. The field length of an array type has no declaring class.

Returns:
the binding of the class or interface that declares this field, or null if none

getType

public ITypeBinding getType()
Returns the binding for the type of this field or local variable.

Returns:
the binding for the type of this field or local variable

getVariableId

public int getVariableId()
Returns a small integer variable id for this variable binding.

Local variables inside methods: Local variables (and parameters) declared within a single method are assigned ascending ids in normal code reading order; var1.getVariableId()<var2.getVariableId() means that var1 is declared before var2. Note that the numbering does not include the local variables declared within the method's local (or anonymous) types - their ids would be relative to the methods of the local type.

Local variables outside methods: Local variables declared in a type's static initializers (or initializer expressions of static fields) are assigned ascending ids in normal code reading order. Local variables declared in a type's instance initializers (or initializer expressions of non-static fields) are assigned ascending ids in normal code reading order. These ids are useful when checking definite assignment for static initializers (JLS 16.7) and instance initializers (JLS 16.8), respectively.

Fields: Fields declared as members of a type are assigned ascending ids in normal code reading order; field1.getVariableId()<field2.getVariableId() means that field1 is declared before field2.

Returns:
a small non-negative variable id

Eclipse JDT
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.