Schnittstelle IVariableBinding
- Alle Superschnittstellen:
IBinding
- Seit:
- 2.0
- Siehe auch:
-
Feldübersicht
Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.dom.IBinding
ANNOTATION, MEMBER_VALUE_PAIR, METHOD, MODULE, PACKAGE, TYPE, VARIABLE
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungReturns this binding's constant value if it has one.Returns the type binding representing the class or interface that declares this field.Returns the method binding representing the method containing the scope in which this local variable is declared.getName()
Returns the name of the field or local variable declared in this binding.getType()
Returns the binding for the type of this field or local variable.Returns the binding for the variable declaration corresponding to this variable binding.int
Returns a small integer variable id for this variable binding.boolean
Returns whether this binding corresponds to an effectively final local variable (JLS8 4.12.4).boolean
Returns whether this binding is for an enum constant.boolean
isField()
Returns whether this binding is for a field.boolean
Returns whether this binding corresponds to a parameter.default boolean
Returns whether this binding is for a record component constant.Von Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.dom.IBinding
equals, getAnnotations, getJavaElement, getKey, getKind, getModifiers, isDeprecated, isEqualTo, isRecovered, isSynthetic, toString
-
Methodendetails
-
isField
boolean isField()Returns whether this binding is for a field. Note that this method returnstrue
for constants, including enum constants. This method returnsfalse
for local variables.- Gibt zurück:
true
if this is the binding for a field, andfalse
otherwise
-
isEnumConstant
boolean isEnumConstant()Returns whether this binding is for an enum constant. Note that this method returnsfalse
for local variables and for fields other than enum constants.- Gibt zurück:
true
if this is the binding for an enum constant, andfalse
otherwise- Seit:
- 3.1
-
isParameter
boolean isParameter()Returns whether this binding corresponds to a parameter.- Gibt zurück:
true
if this is the binding for a parameter, andfalse
otherwise- Seit:
- 3.2
-
isRecordComponent
default boolean isRecordComponent()Returns whether this binding is for a record component constant. Note that this method returnsfalse
for local variables and for fields other than record component.- Gibt zurück:
true
if this is the binding for a record component, andfalse
otherwise- Seit:
- 3.26
-
getName
String getName()Returns the name of the field or local variable declared in this binding. The name is always a simple identifier. -
getDeclaringClass
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.
- Gibt zurück:
- the binding of the class or interface that declares this field,
or
null
if none
-
getType
ITypeBinding getType()Returns the binding for the type of this field or local variable.- Gibt zurück:
- the binding for the type of this field or local variable
-
getVariableId
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.
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.
- Gibt zurück:
- a small non-negative variable id
-
getConstantValue
Object getConstantValue()Returns this binding's constant value if it has one. Some variables may have a value computed at compile-time. If the type of the value is a primitive type, the result is the boxed equivalent (i.e., int returned as anInteger
). If the type of the value isString
, the result is the string itself. If the variable has no compile-time computed value, the result isnull
. (Note: compile-time constant expressions cannot denotenull
; JLS2 15.28.). The result is alwaysnull
for enum constants.- Gibt zurück:
- the constant value, or
null
if none - Seit:
- 3.0
-
getDeclaringMethod
IMethodBinding getDeclaringMethod()Returns the method binding representing the method containing the scope in which this local variable is declared.The declaring method of a method formal parameter is the method itself. For a local variable declared somewhere within the body of a method, the declaring method is the enclosing method. When local or anonymous classes are involved, the declaring method is the innermost such method. There is no declaring method for a field, or for a local variable declared in a static or instance initializer; this method returns
null
in those cases.- Gibt zurück:
- the binding of the method or constructor that declares this
local variable, or
null
if none - Seit:
- 3.1
-
getVariableDeclaration
IVariableBinding getVariableDeclaration()Returns the binding for the variable declaration corresponding to this variable binding. For a binding for a field declaration in an instance of a generic type, this method returns the binding for the corresponding field declaration in the generic type. For other variable bindings, including all ones for local variables and parameters, this method returns the same binding.- Gibt zurück:
- the variable binding for the originating declaration
- Seit:
- 3.1
-
isEffectivelyFinal
boolean isEffectivelyFinal()Returns whether this binding corresponds to an effectively final local variable (JLS8 4.12.4). A variable is said to be effectively final if it is not final and never assigned to after its initialization.- Gibt zurück:
true
if this is an effectively final local variable andfalse
otherwise- Seit:
- 3.10
-