Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Using the Progress.Lang.ParameterList class : Getting and using a Progress.Lang.ParameterList instance
 

Getting and using a Progress.Lang.ParameterList instance

You can get an instance of a Progress.Lang.ParameterList class using the NEW statement. This is the syntax for creating a Progress.Lang.ParameterList instance.

Syntax

parameterlist-object = NEW Progress.Lang.ParameterList(n).
Element descriptions for this syntax diagram follow:
parameterlist-object
An instance of the Progress.Lang.ParameterList object.
n
An INTEGER expression indicating the number of parameters that the object contains. The argument must be greater than or equal to zero. A value of zero indicates that the method or constructor to which the Progress.Lang.ParameterList object is to be passed does not take any parameters. If a negative value is specified, the AVM raises a run-time error.
In this example, the rDynObj object is an instance of the class specified by pcDynObjTypeName, which in this case might have been CustomerObj, or OrderObj, or any other derived class of BusinessObject:
DEFINE INPUT PARAMETER pcDynObjTypeName AS CHARACTER NO-UNDO.

DEFINE VARIABLE iConstParam AS INTEGER INITIAL 1000         NO-UNDO.
DEFINE VARIABLE rDynObj     AS CLASS BusinessObject          NO-UNDO.
DEFINE VARIABLE rObjClass  AS CLASS Progress.Lang.Class     NO-UNDO.
DEFINE VARIABLE rParamList AS CLASS Progress.Lang.ParameterList NO-UNDO.

ASSIGN
  rObjClass  = Progress.Lang.Class:GetClass(pcDynObjTypeName)
  rParamList = NEW Progress.Lang.ParameterList(1).

rParamList:SetParameter(1, "INTEGER", "INPUT", iConstParam).
rDynObj = CAST(rObjClass:New(rParamList), BusinessObject).