Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Reflection: using built-in ABL classes : Using the Progress.Lang.Class class : Getting a Progress.Lang.Class instance
 
Getting a Progress.Lang.Class instance
You can get an instance of a Progress.Lang.Class containing the type information for a specified object type by invoking one of these two built-in ABL class methods:
*GetClass( ) instance method of Progress.Lang.Object invoked on a valid object reference of the specified object type
*GetClass( ) static method of Progress.Lang.Class invoked on that class type with the object type specified as a character parameter
As an alternative to the static GetClass( ), you can use the GET-CLASS function, which takes an object type name instead of an object type specified as a character string.
This is the syntax to get a Progress.Lang.Class instance containing the specified type information:

Syntax

class-reference = {object-reference:GetClass( ) |
                     Progress.Lang.Class:GetClass( expression ) } .
Element descriptions for this syntax diagram follow:
class-reference
A data element defined as a Progress.Lang.Class.
object-reference
A reference to an instantiated class-based object whose type information you want returned in the Progress.Lang.Class instance.
expression
A CHARACTER expression that evaluates to the fully qualified object type name of the type whose information you want returned in the Progress.Lang.Class instance.
For example, after the calls to GetClass( ) in the following procedure fragment, rType1 and rType2 each reference the same Progress.Lang.Class instance:
USING Progress.Lang.*.
USING acme.myObjs.*.

DEFINE VARIABLE rCustObj AS CLASS CustObj NO-UNDO.
DEFINE VARIABLE rType1   AS CLASS Class   NO-UNDO.
DEFINE VARIABLE rType2   AS CLASS Class   NO-UNDO.

rCustObj = NEW CustObj( ).

rType1 = rCustObj:GetClass( ).
rType2 = Progress.Lang.Class:GetClass("acme.myObjs.CustObj").
rType1 is obtained using the instance version of GetClass( ), whereas rType2 is obtained using the static version.