Skip to main content


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 21:56 Go to next message
Hector M Chavez is currently offline Hector M ChavezFriend
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 06:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
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
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: (eObject instanceof Element) in destroy() method [message #494208 is a reply to message #494044] Thu, 29 October 2009 15:04 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
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 17:51 Go to previous message
Hector M Chavez is currently offline Hector M ChavezFriend
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: Fri Mar 29 11:44:39 GMT 2024

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

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

Back to the top