uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Next]   

Loading

Singleton Pattern

Use the Singleton keyword to mark a class as a singleon class. The code ensures that only one object of the class is instantiated at runtime.

For more details on the Singleton pattern, see this Wikipedia page.


Example


class Airline
{
  singleton;
}

      

Load the above code into UmpleOnline

 

Syntax


softwarePattern- : [[isA]] | [[singleton]] | [[immutable]] | [[keyDefinition]] | [[codeInjection]]

// A class that can have only one instance SingletonPattern
singleton- : [=singleton] ;