Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Visual Basic code > Mapping information > Association and role mapping for Visual Basic (Visual Basic code)
  
Association and role mapping for Visual Basic (Visual Basic code)
ACS generates Roles applied by Associations and Aggregations as fields or properties of the class, structure, interface or module that is generated for the owning item:
If the «VB Property» stereotype is not applied to the Attribute, ACS generates a field.
If the «VB Property» stereotype is applied to the Attribute, ACS generates a property.
The type of the field or property is the class, structure, interface or module that is generated for the item that is linked through the Association or Aggregation.
* 
If you want the type of the field or property to not be a class, structure, interface or module; model the field or property through an Attribute. For more information about Attribute mapping, see Attribute mapping for Visual Basic (Visual Basic code).
The code file in which the members are created is determined by the Association Type:
Start-end - generated in the code file created for the Start item.
End-start - generated in the code file created for the End item.
Bi-directional - generated in the code files created for both the Start item and End item.
None - the Association is ignored.
If the «VB DontGenerate» stereotype is applied to an Association or Role, ACS ignores that Association or Role.
ACS generates the child items, properties and tagged values of a Role as follows.
Child items:
A Role does not have any child items that are generated.
Properties:
Behavior property - this property is ignored.
Composite property - this property is ignored.
Data Type property - this property is the associated item; ACS generates the name of the associated item as the field's or property's type unless a value is set for the VB RoleDataType tag definition. If a value is set for the VB RoleDataType tag definition, ACS generates that value as the field's or property's type.
Default Value property - if a value is set, ACS generates that value as follows:
If the «VB Property» stereotype is not applied to the Attribute, ACS generates the value of the Default Value as the default of the field.
If the «VB Property» stereotype is applied to the Attribute, ACS ignores the Default Value property.
Description property - if a value is set, ACS generates that description on the line before the member declaration. For information about how comments are generated, see Generation of code comments (Visual Basic code).
Multiplicity property - ACS generates this property as follows:
If zero or one, only one, tbd or user defined; ACS generates the data type as is. For example:
Private RoleName As TargetClass
if 'zero or more' or 'one or more'; ACS generates a 'System.Collections.Generic.List' statement, and 'ArrayList' for the type. For example:
PrivateProperty RoleName() As System.Collections.Generic.List (Of TargetClass)
Name property - ACS generates this property as the identifier of the field or property in the code. If no name is specified for the Role, the name of the target item preceded by 'the' is used.
* 
ACS may modify the Role name that is added to the code to make it valid for Visual Basic. You can specify the exact Role name to add to the code through the CODE_GENERATION_NAME property of a Role. See Modification of item names when inserted into Visual Basic (Visual Basic code).
Port property - this property is ignored.
Read Only property - this property is ignored.
Qualifierproperty - this property is ignored.
Storage property - when set to On Class, ACS generates the field or property with the Shared modifier.
Unique property - this property is ignored.
Visibilityproperty - this property can be set to Public, Private, Protected or Package; ACS generates the value as the access of the field or property (Package is generated as Public).
If the Visibility is set to Public, Protected, Private or Package; ACS generates the access of the field or property accordingly, unless a tagged value is specified for the VB Access tag definition.
If a tagged value of the VB Access tag definition is set, ACS generates that value as the access of the field or property.
Tag Definitions for Fields and Properties:
The «VB Role» stereotype is applied automatically to Roles and it applies the following tag definitions to a Role:
VB Access tag definition - if a value is set, ACS ignores the Visibility property and generates the value as the access of the field or property.
VB Attributes tag definition - if a value is set, ACS generates that value as .NET attributes of the field or property. The .NET attributes should take the form of <AtrClass(OptInitList)>.
VB CreateInstance tag definition - for fields only, specifies whether ACS generates a New keyword before the field's type. When set to Default or Never, ACS does not generate a New keyword. When set to Always, ACS may generate a New keyword before the type:
When the multiplicity is set to 'zero or more' or 'one or more', ACS generates a New keyword before the field's type.
When the multiplicity is set to zero or one, only one, tbd or user defined and the Association is a composite aggregation, ACS generates a New keyword before the field's type.
When the multiplicity is set to zero or one, only one, tbd or user defined and the Association is a non-composite aggregation or association, ACS does not generate a New keyword.
VB DoBidirect - applies only to Roles that are created through bi-directional Associations, and then only for Roles for which ACS is generating a mutilator operation (VB Set property set to Public, Protected or Private) or a deletor operation (VB Remove property set to Public, Protected or Private).
Using the following example, with the VB Set and VB Remove properties set to True for MyEndRole:
When VB DoBidirect is set to False, ACS generates the mutator operation as follows:
Public Sub SetMyEndRole(ByVal P As TargetClass)
If P IsNot Nothing Then
Me.MyEndRole = P
End If
End Sub
When VB DoBidirect is set to True, ACS generates the mutator operation as follows:
Public Sub SetMyEndRole(ByVal P As TargetClass)
If P IsNot Nothing Then
P.SetMyStartRole = (Me)
Me.MyEndRole = P
End If
End Sub
When VB DoBidirect is set to False, ACS generates the deletor operation as follows:
Public Sub RemoveMyEndRole(ByVal P As TargetClass)
If P IsNot Nothing Then
MyEndRole = Nothing
End If
End Sub
When VB DoBidirect is set to True, ACS generates the deletor operation as follows:
Public Sub RemoveMyEndRole(ByVal P As TargetClass)
If P IsNot Nothing Then
P.RemoveMyStartRole(Me)
MyEndRole = Nothing
End If
End Sub
* 
For qualifiers to be extracted correctly for role mutators, Operation qualifiers should be public and Attribute qualifiers should be set with public accessors. Do not set VB DoBidirect to True for both of an Association's Roles.
VB Get tag definition - specifies whether ACS generates an accessor operation for the field or property:
When set to None, ACS does not generate an accessor operation for the field or property.
When set to Public, Protected or Private; ACS generates an accessor operation for the field or property using the specified access.
VB Modifierstag definition - specifies text for ACS to generate as modifiers for the field or property.
VB QualifierConstruct- applies only to Associations that are qualified and have a multiplicity of 'zero or more' or 'one or more'. For these Associations:
When set to SortedList, ACS generates the container list as follows for qualifier roles: 'System.Collections.Generic.SortedList'.
When set to Dictionary, ACS generates the container list as follows for qualifier roles: 'System.Collections.Generic.Dictionary'.
VB Remove - when set to Public, Protected or Private, ACS generates a role deletor operation that sets the field or property to Nothing. The subroutine uses the specified access. When set to None, ACS does not generate the role deletor.
VB RoleDataType- if a value is set, ACS ignores the target item and generates the value as the type of the field or property.
VB Set tag definition - specifies whether ACS generates a mutator operation for the field or property:
When set to None, ACS does not generate a mutator operation for the field or property.
When set to Public, Protected or Private; ACS generates a mutator operation for the field or property using the specified access.
Tag Definitions for Properties only
For generating properties, apply The «VB Property» stereotype to the Attribute. The «VB Property» stereotype applies the following tag definitions:
VB Access tag definition - if a value is set, ACS ignores the Visibility property and generates the value as the access of the property. Note that this Tag Definition is also applied by the «VB Role» stereotype.
VB Attributes tag definition - if a value is set, ACS generates that value as .NET attributes of the property. The .NET attributes should take the form of <AtrClass(OptInitList)>. Note that this Tag Definition is also applied by the «VB Role» stereotype.
VB GetAccessorAttributes tag definition - if a value is set, ACS generates that value as the accessor for the Get function that is generated for the property, that is, the value is generated before the Get function and before any Get function modifiers.
VB GetAccessorBody tag definition - if a value is set, ACS generates that value as the body code of the Get function that is generated for the property.
If reverse engineering is enabled in ACS, you can change the body code in the code file and ACS will update the VB GetAccessorBody property in the model.
For information about maintaining reversible properties through ACS, see Strategy for maintaining reversible properties (ACS).
VB GetAccessorModifiers tag definition - if a value is set, ACS generates that value as the modifiers for the Get function that is generated for the property, that is, the value is generated before the Get function.
VB Modifiers tag definition - if a value is set, ACS generates that value as modifiers for the property. Note that this Tag Definition is also applied by the «VB Role» stereotype.
VB PropertyAccess tag definition - specifies whether the property access is ReadOnly, WriteOnly or Full:
When set to ReadOnly, ACS generates a ReadOnly keyword before the Property keyword, and generates a Get function for the property.
When set to WriteOnly, ACS generates a WriteOnly keyword before the Property keyword, and generates a Set function for the property.
When set to Full, ACS does not generate a ReadOnly or WriteOnly keyword, and generates both Get and Set functions for the property.
VB PropertyParameters tag definition - if a value is set, ACS generates that value as property parameters after the name of the property, within parentheses.
VB SetAccessorAttributes tag definition - if a value is set, ACS generates that value as the accessor for the Set function that is generated for the property, that is, the value is generated before the Set function and before any Set function modifiers.
VB SetAccessorBody tag definition - if a value is set, ACS generates that value as the body code of the Set function that is generated for the property.
If reverse engineering is enabled in ACS, you can change the body code in the code file and ACS will update the VB SetAccessorBody property in the model.
For information about maintaining reversible properties through ACS, see Strategy for maintaining reversible properties (ACS).
VB SetAccessorModifiers tag definition - if a value is set, ACS generates that value as the modifiers for the Set function that is generated for the property, that is, the value is generated before the Set function.