Association Definition
Associations
noreferences
@@tooltip Overview of Umple associations, and their various types

@@description
<p>      
An association defines a relationship from a <a href="ClassDefinition.html">class</a> to another class. More specifically, it defines which links (i.e. references or pointers) may exist at run time between instances of the classes.
</p>

<p>
Umple supports binary associations (associations with just two ends). This definition includes reflexive associations, in which both ends are the same class.
</p>

<p>
An association can specify the following information:
</p>

<p>
<ul>
  <li>The classes involved (i.e. one or two classes).</li>
  <li>Navigability: -- means both ways (i.e. each class can access the linked objects of the other class) and -> means one way.</li>
  <li>The restrictions on the number of objects allowed in the relationship (<a href="Multiplicity.html">multiplicity</a>).</li>
  <li><a href="RoleNames.html">Role names</a> on association ends (to clarify the relationship and avoid collision if two classes are associated in multiple ways).</li>
</ul>
</p>

<p>The following is a UML diagram showing associations. The corresponding Umple is at the end of the page.</p>

<img src="examples/AssociationExamples.png" alt="UML class diagram showing classes A, B and C with several associations"/>

<p>
Associations can be presented in two ways in Umple.
</p>

<p>
<ul>
  <li><a href="InlineAssociations.html">Inline</a> - Defined within one of the associated classes. See line 7 of the example below; the association is defined between A and B.</li>
  <li><a href="IndependentlyDefinedAssociations.html">Independently</a> - defined as a first-class entity in the model. See line 18 of the example below; the association is defined between A and C.</li>
</ul>
</p>

<p>
There are several special kinds of associations in Umple.
</p>

<p>
<ul>
  <li><a href="ReflexiveAssociations.html">Reflexive</a> - A class that is associated with itself. See line 12 of the example below; the association is defined between C and itself.</li>

  <li><a href="Compositions.html">Compositions</a> - A composition is a sub-type of association where there is mandatory delete on the composition end, regardless of the multiplicity.</li>

  <li>External - To associate a class to class in non-umple code. See lines 13 and 27 of the example below; the association is defined between C and a class D that doesn&#39;t appear in this model and is shown as an external reference. Class D must be separately linked in; it could also be generated by Umple or could be hand-written. <a href="InterfacingtoExternalCode.html">For more on the use of the external keyword, see this example</a>.</li>

  <li><a href="AssociationClassDefinition.html">Association Class</a> - A shorthand for two one-to-many associations to a class
  that contains data that relates the two classes. The two related classes are
  logically in a many-many relationship (this is currently under development).</li>
</ul>
</p>

<p><a href="E005UndefinedClassinAssociation.html">Umple will report an error if an association refers to a non-existent class.</a></p>

@@example
@@source manualexamples/AssociationDefinition1.ump
@@endexample

