$CLASSNAME and Other Dynamic Access Functions
InterSystems IRIS® data platform supplies several functions that support generalized processing of objects. They do this by allowing a reference to a class and one of its methods or properties to be computed at runtime. (This is known as reflection in Java.) These functions are:
-
$CLASSNAME — Returns the name of a class.
-
$CLASSMETHOD — Supports calls to a class method.
-
$METHOD — Supports calls to an instance method.
-
$PARAMETER — Returns the value of a class parameter of the specified class.
-
$PROPERTY — Supports references to a particular property of an instance.
The function names are shown here in all uppercase letters, but they are, in fact, not case-sensitive.
$CLASSNAME
This function returns the name of a class. The signature is:
$CLASSNAME(Instance)
where Instance is an OREF.
For more information, see $CLASSNAME.
$CLASSMETHOD
This function executes a named class method in the designated class. The signature is:
$CLASSMETHOD (Classname, Methodname, Arg1, Arg2, Arg3, ... )
where:
Methodname
A method of the class specified by the first argument.
Arg1, Arg2, Arg3, ...
A series of expressions to be substituted for the arguments to the designated method.
For more information, see $CLASSMETHOD.
$METHOD
This function executes a named instance method for a specified instance of a designated class. The signature is:
$METHOD (Instance, Methodname, Arg1, Arg2, Arg3, ... )
where:
Instance
An OREF of instance of a class.
Methodname
A method of the class specified by the instance in the first argument.
Arg1, Arg2, Arg3, ...
A series of expressions to be substituted for the arguments to the designated method.
For more information, see $METHOD.
$PARAMETER
This function returns the value of a class parameter of the designated class. The signature is:
$PARAMETER(Instance,Parameter)
where:
Instance
An OREF of instance of a class.
Instance
Either the fully qualified name of a class or an OREF of an instance of the class.
Parameter
A parameter of the given class.
For more information, see $PARAMETER.
$PROPERTY
This function gets or sets the value of a property in an instance of the designated class. If the property is multidimensional, the following arguments after the property name are used as indexes in accessing the value of the property. The signature is:
$PROPERTY (Instance, PropertyName, Index1, Index2, Index3... )
where:
Instance
An OREF of instance of a class.
PropertyName
A property of the class specified by the instance in the first argument.
Index1, Index2, Index3, ...
For multidimensional properties, indexes into the array represented by the property.
For more information, see $PROPERTY.