-
-
Notifications
You must be signed in to change notification settings - Fork 12
Implementation Role Feature 4
Max Leuthäuser edited this page Nov 18, 2021
·
6 revisions
Objects may play the same role (type) several times
Unlike feature 3 this does not correspond to multiple classification of an object. Instead it should be possible that each occurrence of an object in a role is associated with a different state. E.g. an employee has one salary and one office address per job.
Simply instantiate a role multiple times and attach it.
val someCoreA = new CoreA()
val someRole1 = new RoleA()
val someRole2 = new RoleA()
someCoreA play someRole1
someCoreA play someRole2
(E.g., CompartmentRoleFeaturesTest.scala)
To distinguish between role instances of the same role type SCROLL uses their object identity (equals
- and hashCode
-methods). So be careful when overriding/implementing them manually.