|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A type binding represents fully-resolved type. There are a number of different kinds of type bindings:
void)
- primitive types are referenced but not explicitly declarednullThis interface is not intended to be implemented by clients.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
getDeclaredTypes()| Field Summary |
| Fields inherited from interface org.eclipse.jdt.core.dom.IBinding |
METHOD, PACKAGE, TYPE, VARIABLE |
| Method Summary | |
String |
getBinaryName()
Returns the binary name of this type binding. |
ITypeBinding |
getBound()
Returns the bound of this wildcard type if it has one. |
IVariableBinding[] |
getDeclaredFields()
Returns a list of bindings representing all the fields declared as members of this class, interface, or enum type. |
IMethodBinding[] |
getDeclaredMethods()
Returns a list of method bindings representing all the methods and constructors declared for this class, interface, or enum. |
int |
getDeclaredModifiers()
Returns the declared modifiers for this class or interface binding as specified in the original source declaration of the class or interface. |
ITypeBinding[] |
getDeclaredTypes()
Returns a list of type bindings representing all the types declared as members of this class, interface, or enum type. |
ITypeBinding |
getDeclaringClass()
Returns the type binding representing the class, interface, or enum that declares this binding. |
int |
getDimensions()
Returns the dimensionality of this array type, or 0 if this
is not an array type binding. |
ITypeBinding |
getElementType()
Returns the binding representing the element type of this array type, or null if this is not an array type binding. |
ITypeBinding |
getErasure()
Returns the erasure of this type reference. |
ITypeBinding[] |
getInterfaces()
Returns a list of type bindings representing the direct superinterfaces of the class, interface, or enum type represented by this type binding. |
int |
getModifiers()
Returns the compiled modifiers for this class, interface, enum, or annotation type binding. |
String |
getName()
Returns the unqualified name of the type represented by this binding if it has one. |
IPackageBinding |
getPackage()
Returns the binding for the package in which this type is declared. |
String |
getQualifiedName()
Returns the fully qualified name of the type represented by this binding if it has one. |
ITypeBinding |
getSuperclass()
Returns the type binding for the superclass of the type represented by this class binding. |
ITypeBinding[] |
getTypeArguments()
Returns the type arguments of the parameterized type reference. |
ITypeBinding[] |
getTypeBounds()
Returns the type bounds of this type variable. |
ITypeBinding[] |
getTypeParameters()
Returns the type parameters of this class or interface type binding. |
boolean |
isAnnotation()
Returns whether this type binding represents an annotation type. |
boolean |
isAnonymous()
Returns whether this type binding represents an anonymous class. |
boolean |
isArray()
Returns whether this type binding represents an array type. |
boolean |
isClass()
Returns whether this type binding represents a class type. |
boolean |
isEnum()
Returns whether this type binding represents an enum type. |
boolean |
isFromSource()
Returns whether this type binding originated in source code. |
boolean |
isInterface()
Returns whether this type binding represents an interface type. |
boolean |
isLocal()
Returns whether this type binding represents a local class. |
boolean |
isMember()
Returns whether this type binding represents a member class or interface. |
boolean |
isNested()
Returns whether this type binding represents a nested class, interface, enum, or annotation type. |
boolean |
isNullType()
Returns whether this type binding represents the null type. |
boolean |
isParameterizedType()
Returns whether this type binding represents a parameterized type reference. |
boolean |
isPrimitive()
Returns whether this type binding represents a primitive type. |
boolean |
isRawType()
Returns whether this type binding represents a raw type reference. |
boolean |
isTopLevel()
Returns whether this type binding represents a top-level class, interface, enum, or annotation type. |
boolean |
isTypeVariable()
Returns whether this type binding represents a type variable. |
boolean |
isUpperbound()
Returns whether this wildcard type is an upper bound ("extends") as opposed to a lower bound ("super"). |
boolean |
isWildcardType()
Returns whether this type binding represents a wildcard type. |
| Methods inherited from interface org.eclipse.jdt.core.dom.IBinding |
equals, getKey, getKind, isDeprecated, isSynthetic, toString |
| Method Detail |
public String getBinaryName()
Note that in some cases, the binary name may be unavailable. This may happen, for example, for a local type declared in unreachable code.
null
if the binary name is unknownpublic boolean isPrimitive()
There are nine predefined type bindings to represent the eight primitive
types and void. These have the same names as the primitive
types that they represent, namely boolean, byte, char, short, int,
long, float, and double, and void.
true if this type binding is for a primitive type,
and false otherwisepublic boolean isNullType()
The null type is the type of a NullLiteral node.
true if this type binding is for the null type,
and false otherwisepublic boolean isArray()
true if this type binding is for an array type,
and false otherwisegetElementType(),
getDimensions()public ITypeBinding getElementType()
null if this is not an array type binding. The element
type of an array is never itself an array type.
null if this is
not an array typepublic int getDimensions()
0 if this
is not an array type binding.
0 if this is not an array typepublic boolean isClass()
true if this object represents a class,
and false otherwisepublic boolean isInterface()
true if this object represents an interface,
and false otherwisepublic boolean isEnum()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this object represents an enum type,
and false otherwisepublic boolean isAnnotation()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this object represents an annotation type,
and false otherwisepublic ITypeBinding[] getTypeParameters()
Note that type parameters only occur on the declaring class or
interface; e.g., Collection<T>. Do not confuse
them with type arguments which only occur on references;
e.g., Collection<String>.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
isTypeVariable()public boolean isTypeVariable()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this type binding is for a type variable,
and false otherwisegetTypeBounds()public ITypeBinding[] getTypeBounds()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
isTypeVariable()public boolean isParameterizedType()
For example, a AST type like
Collection<String> typically resolves to a
parameterized type binding whose erasure is a type binding for the class
java.util.Collection and whose type argument is a type
binding for the class java.util.Collection.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this object represents a parameterized
type reference, and false otherwisegetTypeArguments(),
getErasure()public ITypeBinding[] getTypeArguments()
Note that type arguments only occur on type references;
e.g., Collection<String>.
Do not confuse with type parameters which only occur on the
declaring class or interface; e.g., Collection<T>.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
public ITypeBinding getErasure()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
isRawType(),
isParameterizedType()public boolean isRawType()
For example, a AST type like
Collection typically resolves to a
raw type binding whose erasure is a type binding for the class
java.util.Collection.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this object represents a raw type,
and false otherwisegetErasure()public boolean isWildcardType()
For example, a AST type like
Collection<? extends Object> typically resolves to a
parameterized type binding whose type argument is a wildcard type
with upper type bound java.util.Object/code>.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this object represents a wildcard type,
and false otherwisegetBound(),
isUpperbound()public ITypeBinding getBound()
null if this is not a wildcard type.
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
null if noneisWildcardType(),
isUpperbound()public boolean isUpperbound()
Note: Support for new language features proposed for the upcoming 1.5 release of J2SE is tentative and subject to change.
true if this wildcard type has a bound that is
an upper bound, and false in all other casesisWildcardType(),
getBound()public String getName()
For named classes, interfaces, enums, and annotation types, this is the simple name of the type; if the type is parameterized, the name is followed by the simple names of the type variables surrounded by "<>" and separated by "," (the type bounds are not included). For primitive types, the name is the keyword for the primitive type. For array types, the name is the name of the component type (as computed by this method) followed by "[]". If this represents an anonymous class, it returns an empty string (note that it is impossible to have an array type with an anonymous class as element type). For the null type, it returns "null". For type variables, this is the name of the type variable. For parameterized type references, this is the simple name of the erasure type followed by the names of the type arguments (as computed by this method) surrounded by "<>" and separated by ",". For raw type references, this is the simple name of the erasure type. For wildcard types, this is "?" followed by the name of the bound (as computed by this method) when present.
getName in interface IBindinggetQualifiedName()public IPackageBinding getPackage()
null if this type
binding represents a primitive type, an array type, the null type,
a type variable, a parameterized type reference, a raw type reference,
or a wildcard typepublic ITypeBinding getDeclaringClass()
The declaring class of a member class, interface, enum, annotation type is the class, interface, or enum type of which it is a member. The declaring class of a local class or interface (including anonymous classes) is the innermost class or interface containing the expression or statement in which this type is declared. Array types, primitive types, the null type, top-level types, type variables, parameterized type references, raw type references, and wildcard types have no declaring class.
null if nonepublic ITypeBinding getSuperclass()
If this type binding represents any class other than the class
java.lang.Object, then the type binding for the direct
superclass of this class is returned. If this type binding represents
the class java.lang.Object, then null is
returned.
Loops that ascend the class hierarchy need a suitable termination test.
Rather than test the superclass for null, it is more
transparent to check whether the class is Object, by
comparing whether the class binding is identical to
ast.resolveWellKnownType("java.lang.Object").
If this type binding represents an interface, an array type, a
primitive type, the null type, a type variable, an enum type,
an annotation type, a parameterized type reference, a raw type
reference, or a wildcard type, then null is returned.
null if noneAST.resolveWellKnownType(String)public ITypeBinding[] getInterfaces()
If this type binding represents a class or enum type, the return value
is an array containing type bindings representing all interfaces
directly implemented by this class. The number and order of the interface
objects in the array corresponds to the number and order of the interface
names in the implements clause of the original declaration
of this type.
If this type binding represents an interface, the array contains
type bindings representing all interfaces directly extended by this
interface. The number and order of the interface objects in the array
corresponds to the number and order of the interface names in the
extends clause of the original declaration of this interface.
If the class or enum implements no interfaces, or the interface extends no interfaces, or if this type binding represents an array type, a primitive type, the null type, a type variable, an annotation type, a parameterized type reference, a raw type reference, or a wildcard type, this method returns an array of length 0.
public int getModifiers()
getDeclaredModifiers method
should be used if the original modifiers are needed.
Returns 0 if this type does not represent a class or interface.
getModifiers in interface IBindinggetDeclaredModifiers()public int getDeclaredModifiers()
getModifiers method should be used if
the compiled modifiers are needed. Returns -1 if this type does not
represent a class or interface.
Modifier constantsgetModifiers(),
Modifierpublic boolean isTopLevel()
A top-level type is any type whose declaration does not occur within the body of another type declaration. The set of top level types is disjoint from the set of nested types.
true if this type binding is for a top-level class,
interface, enum, or annotation type, and false otherwisepublic boolean isNested()
A nested type is any type whose declaration occurs within the body of another. The set of nested types is disjoint from the set of top-level types. Nested types further subdivide into member types, local types, and anonymous types.
true if this type binding is for a nested class,
interface, enum, or annotation type, and false otherwisepublic boolean isMember()
A member type is any type declared as a member of another type. A member type is a subspecies of nested type, and mutually exclusive with local types.
true if this type binding is for a member class,
interface, enum, or annotation type, and false otherwisepublic boolean isLocal()
A local class is any nested class or enum type not declared as a member of another class or interface. A local class is a subspecies of nested type, and mutually exclusive with member types. Note that anonymous classes are a subspecies of local classes.
Also note that interfaces and annotation types cannot be local.
true if this type binding is for a local class or
enum type, and false otherwisepublic boolean isAnonymous()
An anonymous class is a subspecies of local class, and therefore mutually
exclusive with member types. Note that anonymous classes have no name
(getName returns the empty string).
true if this type binding is for an anonymous class,
and false otherwisepublic ITypeBinding[] getDeclaredTypes()
public IVariableBinding[] getDeclaredFields()
public IMethodBinding[] getDeclaredMethods()
public boolean isFromSource()
false for all primitive types, the null type,
array types, and for all classes, interfaces, enums, annotation
types, type variables, parameterized type references,
raw type references, and wildcard types, whose information came from a
pre-compiled binary class file.
true if the type is in source code,
and false otherwisepublic String getQualifiedName()
getName()) preceded by the package
name (or unqualified if in a default package) and a ".".
Example: "java.lang.String"."java.io.ObjectInputStream.GetField"."int"."java.lang.String[]"."X"."java.util.Collection"."java.util.Collection<java.lang.String>".
"? extends java.lang.Object".
getName()
|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||