Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » Trying to define attribute in class in diagram of type "Set<ComponentType>"
Trying to define attribute in class in diagram of type "Set<ComponentType>" [message #625320] Thu, 03 December 2009 20:03 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I have a simple class diagram, with classes "Catalog" and "Category". I'll be adding many more classes, but these are the first two. There is a property of "Catalog" called "rootCategories", which should be a "Set<Category>". It's easy enough to define an association from Catalog to Category and label it on the source end with "rootCategories", but I'd like to define a "rootCategories" attribute of "Catalog" of type "Set<Category>".

I've created the two class icons, along with the association, but I don't understand the steps required to get that attribute created with that type.
Re: Trying to define attribute in class in diagram of type "Set<ComponentType>" [message #625324 is a reply to message #625320] Fri, 04 December 2009 12:49 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
It is not an easy question because when you create an attribute in the model this is not detected as an association till you don't also create an association between both classifiers. This is a two steps creation and not just the attributes creation.

If you use Java then I agree that if you create an attribute having set<category> then you will have an association between both classifiers. Don't forget that this is association detection is coming from the java tool using JDK and not from the UML model itself.
Re: Trying to define attribute in class in diagram of type "Set<ComponentType>" [message #625326 is a reply to message #625320] Fri, 04 December 2009 14:02 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
David,

Your question appears to be about Java generics but that isn't directly
supported by UML itself. I suppose something equivalent is a
multi-valued property that's unordered and unique, but even this, if
mapped to Ecore and then to Java will result in EList<Category> not
Set<Category>...


David M. Karr wrote:
> I have a simple class diagram, with classes "Catalog" and "Category".
> I'll be adding many more classes, but these are the first two. There
> is a property of "Catalog" called "rootCategories", which should be a
> "Set<Category>". It's easy enough to define an association from
> Catalog to Category and label it on the source end with
> "rootCategories", but I'd like to define a "rootCategories" attribute
> of "Catalog" of type "Set<Category>".
>
> I've created the two class icons, along with the association, but I
> don't understand the steps required to get that attribute created with
> that type.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Where are the UML2 Tools sample projects?
Next Topic:Where are the UML2 Tools sample projects?
Goto Forum:
  


Current Time: Thu Mar 28 18:34:23 GMT 2024

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

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

Back to the top