OCLOperators oclSingleton
This page was created by Hans.karlsen@mdriven.net on 2017-08-07. Last edited by Edgar on 2025-01-20.

oclSingleton is an operator to help you to implement the Singleton pattern (the pattern states that there is exactly one instance of this class - never more - never less).

If you mark a class with IsSingleton=true you can use this oclSingleton operator to get access to the only object instance of this class.

Example:

Class : SysSingleton

Common expression: SysSingleton.oclSingleton.CurrentUser.IsAdmin -- this expression looks up the only SysSingleton instance that acts as a Global variable that points out the CurrentUser

2017-08-07 21h31 37.png