Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Get a Itype from IField
Get a Itype from IField [message #239236] Tue, 26 December 2006 12:14 Go to next message
Eclipse UserFriend
Originally posted by: lucas.goncalves.powerlogic.com.br

Anybody knows how to get a IType from a field's type.
ex. i have a IField correspondent to
private Address ad;

Now i need a IType of Address, but i don't known how to get it from IField.
Re: Get a Itype from IField [message #239273 is a reply to message #239236] Wed, 27 December 2006 05:28 Go to previous messageGo to next message
Eclipse UserFriend
Lucas wrote:
> Anybody knows how to get a IType from a field's type.
> ex. i have a IField correspondent to
> private Address ad;
>
> Now i need a IType of Address, but i don't known how to get it from IField.

I think getDeclaringType() should match your need. It's implemented on
IMember (IField super-interface).

Note that documentation of this method sounds really wrong and I've
opened a bug for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=169114
Re: Get a Itype from IField [message #239278 is a reply to message #239273] Wed, 27 December 2006 06:54 Go to previous messageGo to next message
Eclipse UserFriend
Frederic Fusier wrote:
> Lucas wrote:
>> Anybody knows how to get a IType from a field's type.
>> ex. i have a IField correspondent to
>> private Address ad;
>>
>> Now i need a IType of Address, but i don't known how to get it from
>> IField.
>
> I think getDeclaringType() should match your need. It's implemented on
> IMember (IField super-interface).
>
> Note that documentation of this method sounds really wrong and I've
> opened a bug for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=169114

Ooops, forget my previous answer, I misunderstood getDeclaringType()
behavior. I've also invalidated the bug...
My mind seems not to work very well between Christmas and New year feast.
Re: Get a Itype from IField [message #239282 is a reply to message #239278] Wed, 27 December 2006 07:59 Go to previous messageGo to next message
Eclipse UserFriend
Frederic Fusier wrote:
> Frederic Fusier wrote:
>> Lucas wrote:
>>> Anybody knows how to get a IType from a field's type.
>>> ex. i have a IField correspondent to
>>> private Address ad;
>>>
>>> Now i need a IType of Address, but i don't known how to get it from
>>> IField.
>>
>> I think getDeclaringType() should match your need. It's implemented on
>> IMember (IField super-interface).
>>
>> Note that documentation of this method sounds really wrong and I've
>> opened a bug for this:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=169114
>
> Ooops, forget my previous answer, I misunderstood getDeclaringType()
> behavior. I've also invalidated the bug...
> My mind seems not to work very well between Christmas and New year feast.

In fact, it seems you cannot directly get the IType for the field's
type, but only its signature using field.getTypeSignature().

Then for BinaryField, it's easy to get corresponding IType using
following code:
String typeSignature = field.getTypeSignature();
field.getJavaProject().findType(Signature.toString(typeSigna ture))

For SourceField, it's a little bit more tricky as the type signature is
not resolved...
Re: Get a Itype from IField [message #239434 is a reply to message #239236] Wed, 03 January 2007 04:43 Go to previous message
Eclipse UserFriend
IField field;

IType type = (IType) field.getParent()

ILucas wrote:
> Anybody knows how to get a IType from a field's type.
> ex. i have a IField correspondent to
> private Address ad;
>
> Now i need a IType of Address, but i don't known how to get it from IField.
Previous Topic:Filtering of completion proposals in Java editor
Next Topic:How do I integrate the JDK documentation and API reference into Eclipse help system?
Goto Forum:
  


Current Time: Sat Jul 19 05:53:19 EDT 2025

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

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

Back to the top