Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Equivalent in IType for Class.isAssignableFrom()
Equivalent in IType for Class.isAssignableFrom() [message #248834] Wed, 17 October 2007 03:00 Go to next message
Eclipse UserFriend
Originally posted by: diego.manilla.xeridia.com

Hi. I need to know if a given IType is a supertype of another IType, some
sort of equivalence in JDT for Class.isAssignableFrom(). What I've done is:

iType2.newSupertypeHierarchy(new NullProgressMonitor()).contains(iType1)

But this seems a pretty expensive operation, and I need to execute it many
times. Is there a faster way to do this?

Thanks in advance
Re: Equivalent in IType for Class.isAssignableFrom() [message #248897 is a reply to message #248834] Thu, 18 October 2007 07:10 Go to previous message
Eclipse UserFriend
Diego Manilla Suárez wrote:
> Hi. I need to know if a given IType is a supertype of another IType,
> some sort of equivalence in JDT for Class.isAssignableFrom(). What I've
> done is:
>
> iType2.newSupertypeHierarchy(new NullProgressMonitor()).contains(iType1)
>
> But this seems a pretty expensive operation, and I need to execute it
> many times. Is there a faster way to do this?
>
> Thanks in advance
>
If you need to do it for several types (let's say in a package), you can
build 1 type hierarchy on this packagage (see
IJavaProject#ITypeHierarchy newTypeHierarchy(IRegion region, IProgressMonitor monitor)
with the IRegion containing the IPackageFragmengt only). Then contains(...)
will be much faster.

Jerome
Previous Topic:How to add a new class to a package
Next Topic:J2SE-1.6 Execution Environment Constraint
Goto Forum:
  


Current Time: Sat Jul 19 06:26:00 EDT 2025

Powered by FUDForum. Page generated in 0.02673 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top