Modeling Generic Attributes

Recurring modeling patterns and how to use them with AndroMDA

Modeling Generic Attributes

Postby jmikhail » Tue 30. Aug 2005, 19:45

I'm wondering if anyone has run into trying to model generic attributes in AndroMDA. Our project is using java 5, so we'd like to take advantage of generics...more specifically with the collections framework.



Now I can figure this out for associations since I know the type of the other end. I already modified our templates to generate generic collections for many relationships. But I haven't found a way to do it using attributes. I think the main problem is that I'm modeling to datatypes. I don't want to create a different mapping for every genericized collection. So I'm just pinging the forum to see if anyone has run across this.



If not, I guess one quick option I have would be to introduce a new tagged value where I can specify the type. But I'd prefer not to if there is a more elegant solution.



John
jmikhail
 
Posts: 25
Joined: Thu 18. Aug 2005, 15:45

Generics

Postby dysinger » Tue 30. Aug 2005, 20:01

Search the forum for Generics. I asked the same question a while back.
dysinger
 
Posts: 50
Joined: Wed 11. May 2005, 17:40

Postby jmikhail » Tue 30. Aug 2005, 21:18

Well, looks like there was no resolution to the problem. It's cool, I'll just have to get creative and come up with something we can use for the time being.
jmikhail
 
Posts: 25
Joined: Thu 18. Aug 2005, 15:45

Postby wouter.zoons » Tue 30. Aug 2005, 22:47

perhaps you could model the attribute's multiplicity and use a Collection or something with the generic type as the one modeled for that attribute



Code: Select all
Person.addresses : Address 0..* --> Collection<Address>




just as with association ends
Wouter Zoons - wouter [at] andromda [dot] org

http://www.andromda.org/ - http://draftdog.blogspot.com/
wouter.zoons
AndroMDA Admin
 
Posts: 4137
Joined: Fri 6. May 2005, 19:29
Location: Brussels, Belgium


Return to Modeling Patterns

Who is online

Users browsing this forum: No registered users and 0 guests