Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to get (or set) what a class extends?
How to get (or set) what a class extends? [message #1265713] Thu, 06 March 2014 13:07 Go to next message
Christer Jansson is currently offline Christer JanssonFriend
Messages: 1
Registered: March 2014
Junior Member

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,

Refactor from:
public class OriginTestClass extends BeforeChange {

public class OriginTestClass extends TestAfterChange, BeforeChange {
Re: How to get (or set) what a class extends? [message #1273000 is a reply to message #1265713] Wed, 19 March 2014 09:26 Go to previous messageGo to next message
shankha banerjee is currently offline shankha banerjeeFriend
Messages: 40
Registered: February 2013
Is it possible for you to get the type of the class and get it's superclass.
Re: How to get (or set) what a class extends? [message #1369889 is a reply to message #1273000] Tue, 20 May 2014 19:46 Go to previous message
Noopur Gupta is currently offline Noopur GuptaFriend
Messages: 58
Registered: December 2012
- 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.
Previous Topic:How to manage multiple modifications on the same AST
Next Topic:Is there an easy way to mass refactor packages?
Goto Forum:

Current Time: Sun May 26 00:38:12 GMT 2024

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

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

Back to the top