Implementing Associations / UML 2.0 to Java 1.5

File (PDF)

Implementing Associations / UML 2.0 to Java 1.5.pdf



MDD : Mapping embedded system designs to :

  • low level implementations
  • system verification tools

The UML standard does not include a complete semantics of n-ary associations so it is not surprising that the tools do not support them.

The UML standard does not include a complete semantics of n-ary associations so it is not surprising that the tools do not support them. Also the last few concepts (subsetting, derived union,and redeļ¬nition) are concepts only introduced with version 2.0 of the UML, so it is not surprising that at the time of writing this paper they are not yet supported. However, it is disappointing that only three of the reviewed tools (EMF,Octopus and Fujaba) generate code that correctly supports the bi-directional semantics of an association; and only one of these (Octopus) supports the full complement of different collection types.

Properties' characteristics

same as Class
field from a Class
Composite Property
object owner acts as container of the property.
isUnique, isOrdered
defines if the elements are unique / defines the type of the collection
readOnly & value derived from subseted properties.
[x..y] boundary
change the collections to assert the bounds checking
assigned only once ; disabling setter and returning unmodifiable collections
for code generation doesn't really matter

Ordered Associations

No standard java class for OrderedSet.
3 solutions :

  • Use interface SortedSet and implement the Comparator based on insertion order.
  • Provide an explicit implementation extending List and Set java classes
  • Use Set as interface and provide implementation based on List.

Qualified Associations

Given a qualifying field and a qualified object the number os objects at the other end will be the defined multiplicity :

  • 0..1 = qualifying field must be unique
  • 0..* = qualifying field partitions the set of elements working as a classifier for each part. Returns a set of objects with the same qualifying field. Sugests an implementation with easy access using the qualifying field

Implementation using unlinked properties (within the class)

  • Can be done using a Map in the Class A matching for each qualifying of B the B instance.
  • Using a tuple middle class which stores the qualifying value and has a *-many association with both A and B.

The combination of qualifiers with other characteristics remains as future work.


The author try to be strictly consistent about using Java libraries. The key idea is that if it is not available in the Java language he doesn't want to commit with a custom solution/implementation.


Bibliographic Description

    title = {Implementing associations: UML 2.0 to Java 5.},
    author = {David H. Akehurst and Gareth Howells and Klaus D. McDonald-Maier},
    journal = {Software and System Modeling},
    number = {1},
    pages = {3-35},
    url = {},
    volume = {6},
    year = {2007},
    biburl = {},
    description = {dblp},
    ee = {}, date = {2008-03-31},
    keywords = {dblp }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License