[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.uml2] Re: Composite attributes

Ricardo,

I don't know that much about UML so hopefully my comments are useful to the point...

Does Widget extend Element? All your applied stereotyped objects will be modeled using dynamic EMF. As such, if your profile model extends something that's generated, your dynamic instance will extend the implementation of that generated class. But if your model doesn't extend something that's generated, it will just be an EObject and will be implemented by EObjectImpl, DynamicEObjectImpl, or anything else that behaves correctly. You can use EObject.eClass() to determine the type of object you are dealing with and should find that the eClass() of your widget instance is the Widget EClass. You should be able to do many cool and useful things using eObject.eClass().getEAllStructuralFeatures() to determine all the features of eObject and using eObject.eGet/eSet and so on to access or modify your data. Using eObject.eAllContents() you can easily walk the entire tree of contained objects.


Ricardo Giacomin wrote:
Hi,

I have an stereotype Container with a property 'children: Widget[0..*]' (iow, a list of widgets, where Widget is another stereotype and aggregation type is Composite). When I create a model and apply stereotype container to a given class, New Child menu options include a 'Children Widget' option. Perfect, that is what I expected.

My question is: I have a method that traverses the model and transform each Element on it. However, the child of type Widget is not an Element but an EObject (more precisely, a DynamicEObjectImpl). Isn't the widget I added as child of my container an Element of the model? Is it possible to obtain the Element from the EObject?

By the way, I've read in a message on this group that it is not possible to have an stereotype with a composition to another stereotype (http://dev.eclipse.org/newslists/news.eclipse.tools.uml2/msg03179.html). Does that mean what I did is not correct?
Thanks a lot,