Hello All Netbeans comes with a UML plugin and provides UML modelling of 7 different associations mechanisms between objects 1. Association 2. Navigable Association 3. Aggregation 4. Navigable Aggregation 5. Composition 6. Navigable Composible 7. Association Class
I was very curious to find out how the implementation of these happen in java. So what I did was have one Order object and 7 different Line Item classes 1. LineItemAssociation 2. LineItemNavigableAssociation 3. LineItemAggregation 4. LineItemNavigableAggregation 5. LineItemComposition 6. LineItemNavigableComposible 7. ItemToOrderAssociation Class
Now all these 7 classes were related with Order based on the name style Like for 1 I associated LineItem to Order using Association uml style for 2 LineItem to Order using Navigable Association
Now I reversed this to generate code. Guess what happened?
I can see all the classes models reversed by UML code generator but if I look Java Implementation of ORDER class i see private instance of NavigableAssociationLineItem NavigableCompositionLineItem NavigableAggregationLineItem with getter and setter and nothing related to Plain Association, Composition or Aggregation implemented in Order class.
So are these meaningful only on diagrams and does not make sense unless navigation is mentioned?
Please reply. I am trying to get the java implementation equivalent of these association styles....
Association end ownership was separated from navigability in UML 2.0, so just because A has a unidirectional association to B does NOT necessarily mean that A owns an attribute of type B (the end could be owned by the association). However, it DOES mean that B does not have an attribute of type A because a non-navigable association end must be owned by the association in UML 2.0. - Kenn Hussey
You can make show those associations say, as a method argument. However, this is one way to show the associations.