docs.intersystems.com
Home  /  Application Development: Core Topics  /  Class Definition Reference  /  Class Definitions  /  Method Definitions


Class Definition Reference
Method Definitions
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Describes the structure of a method definition.
Introduction
In most cases, a method definition defines the runtime behavior of the method. InterSystems IRIS supports also method generators, which are a special kind of method that generate the code that is used at runtime.
Details
A method definition has the following structure:
/// description
Method name(formal_spec) As returnclass [ keyword_list ] 
{
implementation
}
Or (for a class method):
/// description
ClassMethod name(formal_spec) As returnclass [ keyword_list ] 
{
implementation
}
Or (for a client method):
/// description
ClientMethod name(formal_spec) As returnclass [ keyword_list ] 
{
implementation
}
Where:
Parameter Values
For formal_spec and returnclass, you can specify optional parameter values after the class names. If the method is used as an SQL stored procedure, then these parameter values are used to provide additional information to an ODBC or JDBC client. These parameters are ignored in all other cases. For example:
ClassMethod MyProc(data As %String(MAXLEN = 85)) As %Integer [ SQLProc ]
{
  Quit 22
}
For another example:
ClassMethod GetName() As %String(MAXLEN=222) [ SQLProc ]
{
  Quit "Mo"
}
See Also