Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to retrieve the Interface name from Java file?
https://www.eclipse.org/forums/index.php/mv/msg/201518/643726/#msg_643726
import test.IUserService;
public class UserService implements IUserservice{}
I created a listener that gave me acess to the compilationunit of UserService, but now I want to retrive the full qualified name of the interface that UserService is implementing, which is, in this case "test.IUserService"
Can anyone tell me how?]]>Wesley2010-12-08T02:58:10-00:00Re: How to retrieve the Interface name from Java file?
https://www.eclipse.org/forums/index.php/mv/msg/201518/643730/#msg_643730
> As the title says, I'm trying to retrieve the full interface name from a
> java class file, example:
>
> import test.IUserService;
>
> public class UserService implements IUserservice{}
>
> I created a listener that gave me acess to the compilationunit of
> UserService, but now I want to retrive the full qualified name of the
> interface that UserService is implementing, which is, in this case
> "test.IUserService"
> Can anyone tell me how?
Try
org.eclipse.jdt.core.ICompilationUnit.getTypes()
and then
org.eclipse.jdt.core.IType.getSuperInterfaceNames()]]>Deepak Azad2010-12-08T03:02:40-00:00Re: How to retrieve the Interface name from Java file?
https://www.eclipse.org/forums/index.php/mv/msg/201518/643845/#msg_643845
Quote:
Try
org.eclipse.jdt.core.ICompilationUnit.getTypes()
and then
org.eclipse.jdt.core.IType.getSuperInterfaceNames()
Thanks for the answer!
I've already tried this, but the name returned is the unresolved one, in this example i would have "QIUserService", but i need the resolved one: "test.IUserService".
Is there any way to convert?]]>Wesley2010-12-08T13:34:19-00:00Re: How to retrieve the Interface name from Java file?
https://www.eclipse.org/forums/index.php/mv/msg/201518/643875/#msg_643875
> Quote:
>> Try
>> org.eclipse.jdt.core.ICompilationUnit.getTypes()
>> and then
>> org.eclipse.jdt.core.IType.getSuperInterfaceNames()
>
>
> Thanks for the answer!
> I've already tried this, but the name returned is the unresolved one, in
> this example i would have "QIUserService", but i need the resolved one:
> "test.IUserService". Is there any way to convert?
Did you try org.eclipse.jdt.core.IType.resolveType(String) ?]]>Deepak Azad2010-12-08T14:06:20-00:00Re: How to retrieve the Interface name from Java file?
https://www.eclipse.org/forums/index.php/mv/msg/201518/643956/#msg_643956
Quote:
Did you try org.eclipse.jdt.core.IType.resolveType(String) ?
That worked! Thanks... ]]>Wesley2010-12-08T19:52:48-00:00