W001 Singleton With Non-Lazy Attribute
[Previous]  [Next] 
|
User Manual [Previous]  [Next] W001 Singleton With Non-Lazy AttributeUmple semantic warning reported when a singleton class has an attribute that is not marked lazyA singleton class can't have any arguments in its constructor. In general in Umple, unless an attribute is specified as 'lazy', then an argument for the attribute is added to the constructor. In the case of singletons, this is not done. This warning is to let programmer know this. To avoid the warning, add the keyword 'lazy' to all attributes of a singleton class. However, whether or not this is done, the generated code will behave as if it had been done. Example// This example generates the warning message class X { singleton; Integer x; } Load the above code into UmpleOnline Solution to The Above So the Message No Longer Appears// The following shows how to avoid the warning class X { singleton; lazy Integer x; } Load the above code into UmpleOnline |