OwnedComment vs. annotatedElement [message #917671] |
Thu, 20 September 2012 06:08  |
Eclipse User |
|
|
|
Hello,
I am wondering, why does an ownedComment have an annotatedElement attribute? Shouldn't be the element that ownes the comment be the element that is annotated?
For example when I want to find out the comments for a certain element, I can use:
element.getOwnedComments()
However, there can be other elements that own comments that annotate my element.
element.getAllAnnotatingElements()
This is what I would need, when using annotatedElement not corresponding to the ownership.
Is there a reason why we have this attribute?
Regards,
Tex
|
|
|
Re: OwnedComment vs. annotatedElement [message #917880 is a reply to message #917671] |
Thu, 20 September 2012 10:26   |
Eclipse User |
|
|
|
Hi, Tex,
The annotatedElement property is what indicates the elements that the
comment actually pertains to.
Consider a comment that describes some relationship amongst multiple
elements. The comment can only be owned by one element, so a different
property is required to reference the multiple elements that it
annotates.
The owner is almost immaterial; it just provides a place to put the
comment. It makes sense that the comment owner be some context that
the annotated elements are also in, but there's no real need for that.
HTH,
Christian
On 2012-09-20 10:08:42 +0000, Tex Iano said:
> Hello,
>
> I am wondering, why does an ownedComment have an annotatedElement
> attribute? Shouldn't be the element that ownes the comment be the
> element that is annotated?
> For example when I want to find out the comments for a certain element,
> I can use:
>
> element.getOwnedComments()
>
> However, there can be other elements that own comments that annotate my
> element.
> element.getAllAnnotatingElements()
>
> This is what I would need, when using annotatedElement not
> corresponding to the ownership.
>
> Is there a reason why we have this attribute?
>
> Regards,
>
> Tex
|
|
|
|
|
|
Re: OwnedComment vs. annotatedElement [message #919286 is a reply to message #918999] |
Fri, 21 September 2012 17:46  |
Eclipse User |
|
|
|
Hi, Tex,
What constitutes good or bad style, I really can't say. I suppose that
if the comments are simply there to provide annotations for some
particular viewpoint on the model, and aren't relevant to other
viewpoints, then there might be value in keeping them segregated. That
would then work like an optional overlay on the model, rather like
stacking sheets of Mylar on an overhead projector. It could become
rather unwieldy, though, to manage. I expect that most UML tools would
add the owning object to the annotatedElement collection by default, so
that's pretty straight-forward. Maybe the obvious path is best (as it
so often is).
cW
On 2012-09-21 15:27:57 +0000, Tex Iano said:
> Ah and just another question:
>
> Is it ok to have a package containing all comments within my model and
> only using the annotatedElement to set the annotatedElement? Or is this
> a bad style and the comments should directly be the child of the
> annotated element when possible?
>
> Regards,
>
> Tex
|
|
|
Powered by
FUDForum. Page generated in 0.05698 seconds