|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A type hierarchy provides navigations between a type and its resolved
supertypes and subtypes for a specific type or for all types within a region.
Supertypes may extend outside of the type hierarchy's region in which it was
created such that the root of the hierarchy is always included. For example, if a type
hierarchy is created for a java.io.File
, and the region the hierarchy was
created in is the package fragment java.io
, the supertype
java.lang.Object
will still be included.
A type hierarchy is static and can become stale. Although consistent when
created, it does not automatically track changes in the model.
As changes in the model potentially invalidate the hierarchy, change notifications
are sent to registered ITypeHierarchyChangedListener
s. Listeners should
use the exists
method to determine if the hierarchy has become completely
invalid (for example, when the type or project the hierarchy was created on
has been removed). To refresh a hierarchy, use the refresh
method.
The type hierarchy may contain cycles due to malformed supertype declarations.
Most type hierarchy queries are oblivious to cycles; the getAll*
methods are implemented such that they are unaffected by cycles.
This interface is not intended to be implemented by clients.
Method Summary | |
void |
addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
Adds the given listener for changes to this type hierarchy. |
boolean |
contains(IType type)
Returns whether the given type is part of this hierarchy. |
boolean |
exists()
Returns whether the type and project this hierarchy was created on exist. |
IType[] |
getAllClasses()
Returns all classes in this type hierarchy's graph, in no particular order. |
IType[] |
getAllInterfaces()
Returns all interfaces in this type hierarchy's graph, in no particular order. |
IType[] |
getAllSubtypes(IType type)
Returns all resolved subtypes (direct and indirect) of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType[] |
getAllSuperclasses(IType type)
Returns all resolved superclasses of the given class, in bottom-up order. |
IType[] |
getAllSuperInterfaces(IType type)
Returns all resolved superinterfaces (direct and indirect) of the given type. |
IType[] |
getAllSupertypes(IType type)
Returns all resolved supertypes of the given class, in bottom-up order. |
IType[] |
getAllTypes()
Returns all types in this type hierarchy's graph, in no particular order. |
int |
getCachedFlags(IType type)
Return the flags associated with this type (would be equivalent to IMember.getFlags() ),
or -1 if this information wasn't cached on the hierarchy during its computation. |
IType[] |
getExtendingInterfaces(IType type)
Returns all interfaces resolved to extend the given interface, in no particular order, limited to the interfaces in this hierarchy's graph. |
IType[] |
getImplementingClasses(IType type)
Returns all classes resolved to implement the given interface, in no particular order, limited to the classes in this type hierarchy's graph. |
IType[] |
getRootClasses()
Returns all classes in the graph which have no resolved superclass, in no particular order. |
IType[] |
getRootInterfaces()
Returns all interfaces in the graph which have no resolved superinterfaces, in no particular order. |
IType[] |
getSubclasses(IType type)
Returns the direct resolved subclasses of the given class, in no particular order, limited to the classes in this type hierarchy's graph. |
IType[] |
getSubtypes(IType type)
Returns the direct resolved subtypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType |
getSuperclass(IType type)
Returns the resolved superclass of the given class, or null if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interface. |
IType[] |
getSuperInterfaces(IType type)
Returns the direct resolved interfaces that the given type implements or extends, in no particular order, limited to the interfaces in this type hierarchy's graph. |
IType[] |
getSupertypes(IType type)
Returns the resolved supertypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType |
getType()
Returns the type this hierarchy was computed for. |
void |
refresh(IProgressMonitor monitor)
Re-computes the type hierarchy reporting progress. |
void |
removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
Removes the given listener from this type hierarchy. |
Method Detail |
public void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
listener
- the listenerpublic boolean contains(IType type)
type
- the given type
public boolean exists()
public IType[] getAllClasses()
public IType[] getAllInterfaces()
public IType[] getAllSubtypes(IType type)
type
- the given type
public IType[] getAllSuperclasses(IType type)
NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superclasses than to query a class recursively up the superclass chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
type
- the given type
public IType[] getAllSuperInterfaces(IType type)
NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superinterfaces than to query a type recursively. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
type
- the given type
public IType[] getAllSupertypes(IType type)
NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for supertypes than to query a type recursively up the supertype chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
type
- the given type
public IType[] getAllTypes()
public int getCachedFlags(IType type)
IMember.getFlags()
),
or -1
if this information wasn't cached on the hierarchy during its computation.
Flags
public IType[] getExtendingInterfaces(IType type)
type
- the given type
public IType[] getImplementingClasses(IType type)
type
- the given type
public IType[] getRootClasses()
public IType[] getRootInterfaces()
public IType[] getSubclasses(IType type)
type
- the given type
public IType[] getSubtypes(IType type)
type
- the given type
public IType getSuperclass(IType type)
null
if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interface.
type
- the given type
null
if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interfacepublic IType[] getSuperInterfaces(IType type)
type
- the given type
public IType[] getSupertypes(IType type)
type
- the given type
public IType getType()
null
if this hierarchy was computed for a region.
public void refresh(IProgressMonitor monitor) throws JavaModelException
monitor
- the given progress monitor
JavaModelException
- if unable to refresh the hierarchypublic void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
listener
- the listener
|
Eclipse JDT 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |