How to get (or set) what a class extends? [message #1265713] |
Thu, 06 March 2014 13:07  |
Eclipse User |
|
|
|
Hi,
I'd like my refactoring application to get what a class extends. I've succeeded to get the proper ICompilationUnit and I can list all the methods. Now I'd like to see if the class extends something. I can't find a getter for that so how can this be done?
I also would like to refactor the class so it extends with a specific class. How can I do this?
Best Regards,
Christer
Refactor from:
public class OriginTestClass extends BeforeChange {
.
.
.
}
To:
public class OriginTestClass extends TestAfterChange, BeforeChange {
.
.
.
}
|
|
|
|
Re: How to get (or set) what a class extends? [message #1369889 is a reply to message #1273000] |
Tue, 20 May 2014 19:46  |
Eclipse User |
|
|
|
- A class cannot extend more than one class in Java. So, your expected result is not valid.
- To get the hierarchy of a type, first get that Type using ICompilationUnit#getAllTypes().
Then use the APIs IType#getSuperclass* and IType#getSuperInterface*s.
|
|
|
Powered by
FUDForum. Page generated in 0.03455 seconds