Eclipse JDT
2.0

org.eclipse.jdt.core.dom
Interface IBinding

All Known Subinterfaces:
IMethodBinding, IPackageBinding, ITypeBinding, IVariableBinding

public interface IBinding

A binding represents a named entity in the Java language. The world of bindings provides an integrated picture of the structure of the program as seen from the compiler's point of view. This interface declare protocol common to the various different kinds of named entities in the Java language: packages, types, fields, methods, constructors, and local variables.

This interface is not intended to be implemented by clients.

Since:
2.0
See Also:
IPackageBinding, ITypeBinding, IVariableBinding, IMethodBinding

Field Summary
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.
 
Method Summary
 boolean equals(Object obj)
          There is no special definition of equality for bindings; equality is simply object identity.
 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.
 String getName()
          Returns the name of this binding.
 boolean isDeprecated()
          Return whether this binding is for something that is deprecated.
 boolean isSynthetic()
          Returns whether this binding is synthetic.
 String toString()
          Returns a string representation of this binding suitable for debugging purposes only.
 

Field Detail

PACKAGE

public static final int PACKAGE
Kind constant (value 1) indicating a package binding. Bindings of this kind can be safely cast to IPackageBinding.

See Also:
getKind(), IPackageBinding, Constant Field Values

TYPE

public static final int TYPE
Kind constant (value 2) indicating a type binding. Bindings of this kind can be safely cast to ITypeBinding.

See Also:
getKind(), ITypeBinding, Constant Field Values

VARIABLE

public static final int VARIABLE
Kind constant (value 3) indicating a field or local variable binding. Bindings of this kind can be safely cast to IVariableBinding.

See Also:
getKind(), IVariableBinding, Constant Field Values

METHOD

public static final int METHOD
Kind constant (value 4) indicating a method or constructor binding. Bindings of this kind can be safely cast to IMethodBinding.

See Also:
getKind(), IMethodBinding, Constant Field Values
Method Detail

getKind

public int getKind()
Returns the kind of bindings this is.

Returns:
one of the kind constants: PACKAGE, TYPE, VARIABLE, or METHOD.

getName

public String getName()
Returns the name of this binding. Details of the name are specified with each specific kind of binding.

Returns:
the name of this binding

getModifiers

public int getModifiers()
Returns the modifiers for this binding.

Note that deprecated is not included among the modifiers. Use isDeprecated to find out whether a binding is deprecated.

Returns:
the bit-wise or of Modifier constants
See Also:
Modifier

isDeprecated

public boolean isDeprecated()
Return whether this binding is for something that is deprecated. A deprecated class, interface, field, method, or constructor is one that is marked with the 'deprecated' tag in its Javadoc comment.

Returns:
true if this binding is deprecated, and false otherwise

isSynthetic

public boolean isSynthetic()
Returns whether this binding is synthetic. A synthetic binding is one that was made up by the compiler, rather than something declared in the source code.

Returns:
true if this binding is synthetic, and false otherwise

getKey

public String getKey()
Returns the key for this binding.

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 compilation unit).

The exact details of how the keys are generated is unspecified. However, it is a function of the following information:

Some bindings, like ones that correspond to declarations occurring within the body of a method, are problematic because of the lack of any universally acceptable way of assigning keys that are both predictable and stable. The keys for bindings to local variables, local types, etc. is unspecified, and may be null.

Returns:
the key for this binding, or null if none

equals

public boolean equals(Object obj)
There is no special definition of equality for bindings; equality is simply object identity. Within the context of a single cluster of bindings, each binding is represented by a distinct object. However, between different clusters of bindings, the binding objects may or may not be different; in these cases, the client should compare bindings via their binding keys (getKey) if available.

Overrides:
equals in class Object
See Also:
getKey()

toString

public String toString()
Returns a string representation of this binding suitable for debugging purposes only.

Overrides:
toString in class Object
Returns:
a debug string

Eclipse JDT
2.0

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