Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Topic |
Prev | Next |
Set Collection Classes
Using Enterprise Architect, you can define Collection Classes for generating code from Association connectors where the target role has a multiplicity setting greater than 1.
Tasks
Task |
Detail |
See also |
---|---|---|
Defining Collection Classes |
On the 'Source Code Engineering' section of the 'Manage Project Options' dialog (select the 'Configure > Model > Options > Source Code Engineering' ribbon option), on each language page click on the . The 'Collection Classes for Association Roles' dialog displays. On this dialog, you can define:
|
|
Defining Collection Classes for a specific Class |
Class-specific Collection Classes can be defined by clicking the 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 (for example, foo if foo is found in the model) is defined as a Collection Class. |
|
Additional Collection Classes |
Additional Collection Classes can be defined within the model-specific language options pages for C#, C++ and Java. |
C# Options - Model Example Use of Collection Classes C++ Options - Model Java Options - Model |
Member Type |
On the 'Role(s)' tab of the Association 'Properties' dialog (accessible from the right-click context menu of any Association) there is a 'Member Type' field for each of the Source and Target Roles. If you set this, the value you enter overrides all the above options. |
Source and Target Role |
Learn more