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

Set Collection Classes

Enterprise Architect enables you to define Collection Classes for generating code from Association connectors where the target role has a multiplicity setting greater than 1.



See also

Defining Collection Classes

On the Source Code Engineering section of the Options dialog (select the Tools | Options | Source Code Engineering option), on each language page click on the Collection Classes button.
The Collection Classes for Association Roles dialog displays.
On this dialog, you can define:

The default Collection Class for 1..* roles
The ordered Collection Class to use for 1..* roles
The qualified Collection Class to use for 1..* roles

Source Code Options

Defining Collection Classes for a specific Class

Class-specific Collection classes can be defined by clicking the Collection Classes button in the Class Properties dialog of the element.


Element Details

Code Generation Precedence

When Enterprise Architect generates code for a connector that has a multiplicity role >1:

1.If the Qualifier is set use the qualified collection:
for the Class if set
else use the code language qualified collection


2.If the Order option is set use the ordered collection:
for the Class if set
else use the code language ordered collection


3.Else use the default collection:
for the Class if set
else use the code language default collection


Using Markers

You can include the marker #TYPE# in the collection name; Enterprise Architect replaces this with the name of the Class being collected at source generation time (for example, Vector<#TYPE#> would become Vector<foo>).

Conversely, when reverse engineering, an Association connector is also created if a matching entry (e.g. foo if foo is found in the model) is defined as a Collection Class.


Additional Collection Classes

Additional Collection Classes can be defined in the language options page (C#, C++, Java).

Example Use of Collection Classes.

C# Options

C++ Options

Java Options.

Member Type

On both the Source Role and Target Role tabs of the Association Property dialog (accessible from the right-click context menu of any Association) there is a Member Type field.

If you set this, the value you enter overrides all the above options.


Source Role

Target Role

Learn more