Lazy Immutable Attributes
[Previous]  [Next] 
|
User Manual [Previous]  [Next] Lazy Immutable AttributesIf you want to avoid having an attribute change after it is initially set, but do not want to have an argument in the constructor, then use the combination of keywords 'lazy immutable'. You can call the set method just once on such an attribute. The set method will return false if you try again. This is useful for interacting with architectures where objects are constructed for you, so you have no ability to specify constructor arguments.
Note that if the lazy keyword is omitted, then there will be no set method and an argument will be present in the constructor to initialize the attribute. See also the immutable pattern. Exampleclass A { lazy immutable z; } Load the above code into UmpleOnline SyntaxcomplexAttribute- : [=unique]? [=lazy]? [=ivar]? [=modifier:immutable  |settable  |internal  |defaulted  |const  |fixml]? [[typedName]]  (= [**value]  )? ; |