Transforming a primitive class into a non-primitive class
Transforming a primitive class into a non-primitive class
Here we will be working with the "PatternToNonPrimitive" package, which will allow us to transform a primitive class into a non-primitive class, and parallel to this to transform attributes which have this class as type into associations directed towards this class.
The "PatternToNonPrimitive" package contains:
· an "Employer" primitive class
· a "Company" class containing an "Employee" type attribute
We are going to run the pattern on the "Employee" class.
Initial model

Figure 65. The initial model
Calling the pattern

Figure 66. Calling the pattern
Final model

Figure 67. The model after transformation
Summary of the modifications made to the model
The "Employee" class is no longer primitive. Furthermore, the "Employee" type attribute of the "Company" class has disappeared and been replaced by a navigable association directed towards "Employee".
The name of the role is the name which the attribute had, and the visibility of the navigable association link is the same as that of the erstwhile attribute. The minimum multiplicity of the association is 0. Its maximum multiplicity corresponds to the size the attribute had.