Greeting.
In UML 1.5 spec (pg3-69) there's an xor-association which means there could
be only one association happen among a group of association at any one time.
e.g.
class 1 <-> class 2
class 1 <-> class 3
class 1 <-> class 4
//only one will be effective at any one point of time.
I would like to know how to put this in to code, if class2, class3, class4
is all different classes? My opinion is:
class1{
class2 class_2
class3 class_3
class4 class_4
}
//among 3 association attribute, only one will be use at one point of time
- or -
class1{}
class1asso2 extends class1{
class 2 class_2
}
class1asso3 extends class1{
class3 class_3
}
class1asso4 extends class1{
class4 class_4
}
//determine which class to instanciate in run-time
Or are there any better way to implement the xor-association?
Thank you.
====================================================================
Community Web Site (Core J2EE Patterns Catalog - Online Version):
http://java.sun.com/blueprints/corej2eepatterns
Getting Started (Beta Version):
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
Get the book:
http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20
List Archive:
http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing:
email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)