Home > Class Reference > %SYS namespace > %ZHSLIB.Context.NamedInstanceBase


abstract class %ZHSLIB.Context.NamedInstanceBase extends %Library.RegisteredObject

Property Inventory

Method Inventory


final parameter Global = ^IRIS.Temp.ZHSLIB.NamedInstance;


property InstanceKey as %String;
The 'instance key' used to acquire this instance object
Property methods: InstanceKeyDisplayToLogical(), InstanceKeyGet(), InstanceKeyIsValid(), InstanceKeyLogicalToDisplay(), InstanceKeyLogicalToOdbc(), InstanceKeyNormalize(), InstanceKeySet()


classmethod %%CheckSubClassValidity() [ Language = objectscript ]
Ensure non-abstract subclasses have abstract parameters defined correctly
method %OnNew(pKey As %String) as %Status [ Language = objectscript ]
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

classmethod EnsureInstance(pKey As %String) as %ZHSLIB.Context.NamedInstanceBase [ Language = objectscript ]
This method is called to acquire a specific Named instance of a service. The service instance may have been previously registered with the Context using RegisterNamedInstance. First the Context object is called to attempt to acquire a previously registered instance. If the instance is present and its class has not be re-compiled since it was registered, then the registered instance is returned. Otherwise, the subclass implementation of CreateInstance is called to acquire and register an instance.
method InstanceKeyGet() as %String [ Language = objectscript ]
Implement Get for the Calculated 'Instance' property
classmethod InvalidateInstances(pKey) [ Language = objectscript ]
Calling this method ensures that the next time EnsureInstance is called, a new service will be instantiated and initialized. Call this method after changing settings that the service caches in order to have the setting take effect.
classmethod SetDebugMode(pKey As %String, newMode As %Boolean) [ Language = objectscript ]
This method provides control of debug mode. When in debug mode, the EnsureInstance method will always force a CreateInstance. This is useful during the development of a service, but adds overhead in production because the service instance is created and initialized on each request.
classmethod fullKey(pKey As %String) as %String [ Language = objectscript ]

Inherited Members

Inherited Methods