Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Association Class

Part of a UML Class diagram showing an Association Class using Sparx Systems Enterprise Architect.

Description

An Association Class is a UML construct that enables an Association to have attributes and operations (features). This results in a hybrid relation with the characteristics of an Association and a Class.

When you add an Association Class connection, Enterprise Architect also creates a Class that is automatically connected to the Association. When you hide or delete the Association, the Class is also hidden or deleted.

To add an Association Class to a Class or Deployment diagram, click on the 'Association Class' icon in the Toolbox. Click and hold on the source object in the diagram while you drag the line to the target element, then release the mouse button. Enterprise Architect draws the connector and adds the Class, then prompts you to add the Class name. Note that the names of the Class and the connector are the same. You can also connect a new Class to an existing Association.

You can highlight the Class part of an Association Class in the Browser window, by selecting the 'Find Association Class' context menu option on the Association connector.

Example

This diagram illustrates an Association Class between model elements. Note the dotted line from the Class to the Association. You cannot move or delete this line.

UML Class diagram showing an Association Class modeled in Sparx Systems Enterprise Architect.

Notes

  • If you are applying a stereotype with a Shape Script to an Association Class, be aware that the Shape Script is applied to both the Class part and the Association part; therefore, you might have to include logic in the shape main that tests the type of the element so that you can give separate drawing instructions for Class and for Association
  • Such logic is not necessary in the:
         -  Shape source or shape target, which are ignored by Classes, or the
         -  Decoration shapes, which are ignored by Association connectors
  • If you dissociate the Class from the Association connector, both parts keep their Shape Scripts until the stereotypes are removed

Toolbox icon

Association Class

Learn more

OMG UML Specification:

The OMG Unified Modeling Language specification, (v2.5.1, p.200) states:

An AssociationClass is a declaration of an Association that has a set of Features of its own. An AssociationClass is both an Association and a Class, and preserves the static and dynamic semantics of both. An AssociationClass describes a set of objects that each share the same specifications of Features, Constraints, and semantics entailed by the AssociationClass as a kind of Class, and correspond to a unique link instantiating the AssociationClass as a kind of Association.