Singletons Extension’s Free Functions

Ref<Object> GetOrCreateSingleton ( in String key, in Type singletonObjectType )

Checks if a singleton exists with this key. If not, a new object is created from the passed-in type. This allowa to create an Object only when possible.


Object Singleton_get ( in String key )

retrieves a singleton


Boolean Singleton_has ( in String key )

returns true if a singleton with a given name exists


Object Singleton_init ( in String key, in Object obj )

inits a singleton: sets it only if ‘null’, and returns set value. The returned should be used if the singleton needs to be unique among threads.


Boolean Singleton_remove ( in String key )

deletes a singleton


Singleton_removeAll ()

deletes all known singletons


Singleton_set ( in String key, in Object obj )

stores a singleton