This all depends on your metamodel and how to navigate it. IIRC, Class.getImplementedInterfaces()
is something that comes from UML, so I'll assume that's what you're using.
Furthermore, what you seem to be trying to do is "retrieve all operations for a given classifier, including inherited ones". There should never be any reason to navigate upon the super-classes and interfaces hierarchy yourself for such needs. In UML, this is done through Classifier.getAllOperations()
, which means that you can do everything through :
[for (o : Operation | class.getAllOperations())]
[o.generateOperation()/]
[/for]
If you absolutely need to iterate over the interfaces and super-class(es) yourself, remember that you need to recursively navigate the whole hierarchy : the super-classes and interfaces of your class, the super-classes and interfaces of the super classes of your class, the super-classes ... until the root(s) of the inheritance tree. You'll also have to handle UML's multiple inheritance capabilities and thus solve the potential ambiguities it brings. For that, you'll need to familiarize yourself with the UML model. For instance, retrieving the super-classes is done through Class.getSuperClasses()
. Determining if one of these super-classes is abstract is done through Class.isAbstract()
... and so on.
A side note that could help you : you can import the UML metamodel in your workspace to have a quick overview of its concepts and how to navigate through it. For this :
- Use
File > Import...
- In the pop-up, navigate to
Plug-in Development > Plug-ins and fragments
and hit Next
- Nothing to change on this page, hit
Next
a second time
- In the filter area, enter
org.eclipse.uml2.uml
- Double-click
org.eclipse.uml2.uml
in the left panel so that it appears in the right one.
- Hit
Finish
You now have a new project in your workspace, named org.eclipse.uml2.uml
. You can open the org.eclipse.uml2.uml\model\uml.ecore
file to see the UML metamodel.