Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Getting ITypeBinding from a fully qualified class name. Is it possible?
Getting ITypeBinding from a fully qualified class name. Is it possible? [message #259445] Wed, 08 April 2009 12:11 Go to next message
Jose M Beleta is currently offline Jose M BeletaFriend
Messages: 70
Registered: July 2009
Member
This question has been asked before but no one gave a universal solution.

ITypeBinding has several methods: isAssignmentCompatible, isCastCompatible
and isSubTypeCompatible that take an ITypeBinding as a parameter.

I need to use one of this method to check if a ITypeBindig is a collection
so I want to get an ITypeBinding from
"java.util.Collection" and then use isSubTypeCompatible. So I need the
ITypeBinding of java.util.Collection.

AST.resolveWellKnownType only works for well known types. Why there is not
an AST.resolveType?

Thank you in advance.

Jose M Beleta
Re: Getting ITypeBinding from a fully qualified class name. Is it possible? [message #259513 is a reply to message #259445] Thu, 09 April 2009 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alamothe.ptt.yu

Eclipse wrote:
> This question has been asked before but no one gave a universal
> solution.
> ITypeBinding has several methods: isAssignmentCompatible,
> isCastCompatible and isSubTypeCompatible that take an ITypeBinding as
> a parameter.
> I need to use one of this method to check if a ITypeBindig is a
> collection so I want to get an ITypeBinding from
> "java.util.Collection" and then use isSubTypeCompatible. So I need the
> ITypeBinding of java.util.Collection.
>
> AST.resolveWellKnownType only works for well known types. Why there
> is not an AST.resolveType?

When you parse compilation unit(s), you can provide keys for additional
bindings you will be interested in. See ASTParser.createASTs. The only
problem with this approach is that you need to now in advance (at the time
you parsed the unit) which additional bindings you will need.

> Thank you in advance.
>
> Jose M Beleta
Re: Getting ITypeBinding from a fully qualified class name. Is it possible? [message #259538 is a reply to message #259513] Mon, 13 April 2009 17:07 Go to previous message
Jose M Beleta is currently offline Jose M BeletaFriend
Messages: 70
Registered: July 2009
Member
Thanks a lot!

Jose M Beleta

"Nikola Mihajlovic" <alamothe@ptt.yu> escribió en el mensaje de noticias
news:grkr3k$mj2$1@build.eclipse.org...
>
> Eclipse wrote:
>> This question has been asked before but no one gave a universal
>> solution.
>> ITypeBinding has several methods: isAssignmentCompatible,
>> isCastCompatible and isSubTypeCompatible that take an ITypeBinding as
>> a parameter.
>> I need to use one of this method to check if a ITypeBindig is a
>> collection so I want to get an ITypeBinding from
>> "java.util.Collection" and then use isSubTypeCompatible. So I need the
>> ITypeBinding of java.util.Collection.
>>
>> AST.resolveWellKnownType only works for well known types. Why there
>> is not an AST.resolveType?
>
> When you parse compilation unit(s), you can provide keys for additional
> bindings you will be interested in. See ASTParser.createASTs. The only
> problem with this approach is that you need to now in advance (at the time
> you parsed the unit) which additional bindings you will need.
>
>> Thank you in advance.
>>
>> Jose M Beleta
>
>
Previous Topic:PushDownDescriptor bug?
Next Topic:get information about TextEdit
Goto Forum:
  


Current Time: Thu Apr 25 13:56:10 GMT 2024

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

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

Back to the top