[Progress Communities] [Progress OpenEdge ABL] Forum Post: Loop properties from a class from a method in that class

Status
Not open for further replies.
D

DenDuze

Guest
Hi, I want to loop all properties defined in a class from a method in that same class. I also want that all the properties are private (so they can not be assigned a value from outside that class). I found a way to loop those properties but my problem is that the properties needs to be public (and i do not want that). Is there some way to loop all properties from a class (private/public)? I tried with the following class: /*------------------------------------------------------------------------ File : GetPropertiesFromClass Purpose : Syntax : Description : Author(s) : didier.d Created : Fri Sep 20 14:54:04 CEST 2019 Notes : ----------------------------------------------------------------------*/ using Progress.Lang.*. block-level on error undo, throw. class GetPropertiesFromClass: define private property pPrivateProperty as character no-undo get. set. define public property pPublicProperty as character no-undo get. set. define protected property pProtectedProperty as character no-undo get. set. /*------------------------------------------------------------------------------ Purpose: Notes: ------------------------------------------------------------------------------*/ constructor public GetPropertiesFromClass ( ): SUPER (). this-object:mLoopProperties(). end constructor. /*------------------------------------------------------------------------------ Purpose: Notes: ------------------------------------------------------------------------------*/ method private void mLoopProperties( ): define variable oProperty as Progress.Reflect.Property no-undo extent. define variable i as integer no-undo. assign oProperty = cast(this-object, Progress.Lang.Object):Getclass():GetProperties(). do i = 1 to extent(oProperty): message oProperty skip oProperty:name skip oProperty:datatype view-as alert-box info buttons ok. end. return. end method. end class. Regards Didier

Continue reading...
 
Status
Not open for further replies.
Top