Are there auto-generated getter methods for class parameters in ObjectScript?
Hi, ObjectScript experts!
I know that there are auto-generated getter and setter methods for class properties in ObjectScript.
Are there auto-generated getter methods for class parameters?
Comments
Why would you need it?
##class(class.name).#PARAMETER
..#PARAMETER
$parameter(“class.name”, “PARAMETER”)
This is to refer to a parameter via Embedded Python.
I’m rewriting the ObjectScript code to Embedded python and looking for the options how to deal with class parameters. Just don’t want to introduce a helper ObjectScript method to get the parameter value.
Thought it could be something autogenerated as it is for properties.
The same code from comment below, but in Python
.png)
%GetParameter:
SET myinst=##class(Sample.Person).%New()
WRITE myinst.%GetParameter("EXTENTQUERYSPEC")
By default the value of the parameter is static. But you can define parameters that way that the value can be evaluated at RunTime or CompileTime
.png)
So, technically, you can define the Get method for Parameters
And generated code for those parameters
ROUTINE User.Test.G1 [Type=INT,Generated]
;User.Test.G1;(C)InterSystems, method generator for class User.Test. Do NOT edit.Quit;
pCOMPILETIME(%class,%parameter) public { New%classnameSet%classname=%classQuit$ZDateTime($ZTimeStamp,,,3)
}ROUTINE User.Test.1 [Type=INT,Generated]
;User.Test.1;Generated for class User.Test. Do NOT edit. 10/03/2022 07:50:07AM;;3043524C;User.Test;
ztest() public {
Write !,"RunTime: ", ..#RUNTIME
Write !,"CompileTime: ", ..#COMPILETIME
hang .5Write !,"RunTime: ", ..#RUNTIME
Quit1 }
zRUNTIMEP() public {
Quit ($ZDateTime($ZTimeStamp,,,3)) }Wow! Never knew of such an option!