public interface IBinding
This interface is not intended to be implemented by clients.
IPackageBinding
,
ITypeBinding
,
IVariableBinding
,
Provisional API: This class/interface is part of an interim API that is still under development and expected to
change significantly before reaching stability. It is being made available at this early stage to solicit feedback
from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
(repeatedly) as the API evolves.
Modifier and Type | Field and Description |
---|---|
static int |
METHOD
Kind constant (value 4) indicating a method or constructor binding.
|
static int |
PACKAGE
Kind constant (value 1) indicating a package binding.
|
static int |
TYPE
Kind constant (value 2) indicating a type binding.
|
static int |
VARIABLE
Kind constant (value 3) indicating a field or local variable binding.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
There is no special definition of equality for bindings; equality is
simply object identity.
|
IJavaScriptElement |
getJavaElement()
Returns the JavaScript element that corresponds to this binding.
|
java.lang.String |
getKey()
Returns the key for this binding.
|
int |
getKind()
Returns the kind of bindings this is.
|
int |
getModifiers()
Returns the modifiers for this binding.
|
java.lang.String |
getName()
Returns the name of this binding.
|
boolean |
isDeprecated()
Return whether this binding is for something that is deprecated.
|
boolean |
isEqualTo(IBinding binding)
Returns whether this binding has the same key as that of the given
binding.
|
boolean |
isRecovered()
Return whether this binding is created because the bindings recovery is enabled.
|
java.lang.String |
toString()
Returns a string representation of this binding suitable for debugging
purposes only.
|
static final int PACKAGE
IPackageBinding
.getKind()
,
IPackageBinding
,
Constant Field Valuesstatic final int TYPE
ITypeBinding
.getKind()
,
ITypeBinding
,
Constant Field Valuesstatic final int VARIABLE
IVariableBinding
.getKind()
,
IVariableBinding
,
Constant Field Valuesstatic final int METHOD
IFunctionBinding
.getKind()
,
IFunctionBinding
,
Constant Field Valuesint getKind()
PACKAGE
,
TYPE
,
VARIABLE
,
METHOD
,
or MEMBER_VALUE_PAIR
.
Note that additional kinds might be added in the future, so clients should not assume this list is exhaustive and should program defensively, e.g. by having a reasonable default in a switch statement.
java.lang.String getName()
int getModifiers()
Note that deprecated is not included among the modifiers.
Use isDeprecated
to find out whether a binding is deprecated.
Modifier
constantsModifier
boolean isDeprecated()
true
if this binding is deprecated, and
false
otherwiseboolean isRecovered()
true
if this binding is a recovered binding, and
false
otherwiseIJavaScriptElement getJavaElement()
null
if this binding has no corresponding
JavaScript element.
For array types, this method returns the JavaScript element that corresponds to the array's element type. For raw and parameterized types, this method returns the JavaScript element of the erasure. For annotations, this methods returns the JavaScript element of the annotation type.
Here are the cases where a null
should be expected:
null
.
null
if nonejava.lang.String getKey()
Within a connected cluster of bindings (for example, all bindings reachable from a given AST), each binding will have a distinct keys. The keys are generated in a manner that is predictable and as stable as possible. This last property makes these keys useful for comparing bindings between disconnected clusters of bindings (for example, the bindings between the "before" and "after" ASTs of the same javaScript unit).
The exact details of how the keys are generated is unspecified. However, it is a function of the following information:
Note that the key for annotation bindings and member value pair bindings is
not yet implemented. This returns null
for these 2 kinds of bindings.
Recovered bindings have a unique key.
boolean equals(java.lang.Object obj)
isEqualTo(IBinding)
, which checks their keys.equals
in class java.lang.Object
obj
- boolean isEqualTo(IBinding binding)
binding
- the other binding, or null
true
if the given binding is the identical
object as this binding, or if the keys of both bindings are the
same string; false
if the given binding is
null
, or if the bindings do not have the same key,
or if one or both of the bindings have no keygetKey()
java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.