Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » (eObject instanceof Element) in destroy() method
(eObject instanceof Element) in destroy() method [message #494044] Wed, 28 October 2009 17:56 Go to next message
Hector M Chavez is currently offline Hector M Chavez
Messages: 18
Registered: July 2009
Junior Member
I was looking at the code of the destroy() method in ElementOperations class and found the the following:

if (eObject instanceof Element) {
destroyAll(((Element) eObject).getStereotypeApplications());
}

I was wondering in what cases we could be destroying an object that is not an instance of Element. I understand that the destroy method is defined in the class Element and the rest of the classes inherit the method from it. Or isn't that the case?

I would appreciate some comments. Thanks.

Hector

Re: (eObject instanceof Element) in destroy() method [message #494075 is a reply to message #494044] Thu, 29 October 2009 02:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25748
Registered: July 2009
Senior Member
Hector,

An Element can contain EAnnotations which are not Elements.


Hector M Chavez wrote:
> I was looking at the code of the destroy() method in ElementOperations
> class and found the the following:
>
> if (eObject instanceof Element) {
> destroyAll(((Element) eObject).getStereotypeApplications());
> }
>
> I was wondering in what cases we could be destroying an object that is
> not an instance of Element. I understand that the destroy method is
> defined in the class Element and the rest of the classes inherit the
> method from it. Or isn't that the case?
>
> I would appreciate some comments. Thanks.
>
> Hector
>
>
Re: (eObject instanceof Element) in destroy() method [message #494208 is a reply to message #494044] Thu, 29 October 2009 11:04 Go to previous messageGo to next message
james bruck is currently offline james bruck
Messages: 1724
Registered: July 2009
Senior Member
That version of destroy is also called from
unapplyAllNonApplicableStereotypes() to destroy stereotype applications
which are not Element(s) but rather, dynamic EObjects.

- James.

"Hector M Chavez" <hectormch@gmail.com> wrote in message
news:hcaema$lo6$1@build.eclipse.org...
>I was looking at the code of the destroy() method in ElementOperations
>class and found the the following:
>
> if (eObject instanceof Element) {
> destroyAll(((Element) eObject).getStereotypeApplications());
> }
>
> I was wondering in what cases we could be destroying an object that is not
> an instance of Element. I understand that the destroy method is defined in
> the class Element and the rest of the classes inherit the method from it.
> Or isn't that the case?
>
> I would appreciate some comments. Thanks.
>
> Hector
>
>
Re: (eObject instanceof Element) in destroy() method [message #494461 is a reply to message #494044] Fri, 30 October 2009 13:51 Go to previous message
Hector M Chavez is currently offline Hector M Chavez
Messages: 18
Registered: July 2009
Junior Member
I appreciate your answers, I can see now the need for that condition in the destroy method. Thanks.
Previous Topic:Creating UML diagrams programmatically
Next Topic:(eObject instanceof Element) in destroy() method
Goto Forum:
  


Current Time: Mon Apr 21 11:40:05 EDT 2014

Powered by FUDForum. Page generated in 2.77187 seconds