Get classes from a model with the API [message #1754556] |
Mon, 20 February 2017 03:38  |
Eclipse User |
|
|
|
Hi,
I am using the UML2 API to load a model that I have created previously with Papyrus. I want to parse this model to find and get all the classes. This is the code that I am using by now:
EList<Type> list4 = model.getOwnedTypes();
for (Type element : list4)
{
out(element.getName());
}
With this code I am able to get a lot of elements of the model, including classes, associations, etc. However, I just want to get the classes of a UML diagram. How can I achieve this? How can I check the type of the elements?
This must be quite simple to do but I am just browsing through the API and I can't find anything. Could you refer me to some examples?
Regards,
Pablo
|
|
|
|
|
Re: Get classes from a model with the API [message #1754782 is a reply to message #1754778] |
Wed, 22 February 2017 05:30  |
Eclipse User |
|
|
|
Hi
No. Never compare by exact name, you ensure that all extensibility with inheritance goes wrong and break the encapsulation whereby users should only use the interface.
If you really want to compare the name, at least use eClass().getName() to hide the EMF details.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.08673 seconds