%Static
This special method returns a reference to the static elements of a class object on the language server.
The %Static method can be used with any class, and is essential to provide access to static fields and methods in classes that do not have a constructor.
All special method names and keywords are case-insensitive.
Syntax
{connection->}%Static(class)
Syntax elements
connectionA connection object. The default connection object does not have to be named (although it can be).
classA class name. This must be a class previously imported by the %Import special method.
Applicability
Language objects only.
Examples
Returns a reference to the BankAccount class and assigns it to MyAccount, then assigns the BankAccount.SortCode static field to the SortCode variable.
Account = %Static(BankAccount) SortCode = Account->SortCode
In Java, the Integer class wraps a value of the primitive type int in an object. The Integer class has three static fields: MAX_VALUE, MIN_VALUE and SIZE. So to obtain the value of MAX_VALUE in DataBasic:
JavaCxn = %Connect(JAVA) %Import(java.lang) MaxInteger = %Static(Integer)->MAX_VALUE
(This is equivalent to the Java syntax int MaxInteger = Integer.MAX_VALUE).
For a C# .NET language server this would be:
DotNetCxn = %Connect(DOTNET) MaxInteger = %Static(System.Int32)->MaxValue