To save later grief, please note that in that code, calculated, private and transient properties will NOT be included.

Ralf Huwald wrote:
Thank you, that works!

Ralf

"Ben Taylor" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]

Ralf
I use the following method

ClassMethod classProps() [ CodeMode = objectgenerator ]
{
d %code.WriteLine(" s propList=""""")
s inLoop=0
for i = 1:1:%compiledclass.Properties.Count() {
if


(('%compiledclass.Properties.GetAt(i).Private)&&('%compiledclass.Properties. GetAt(i).Calculated)&&('%compiledclass.Properties.GetAt(i).Transient)){

 d:inLoop=0 %code.Write(" s propList=$LB(")
 d:inLoop=1 %code.Write(",")
 d


%code.Write("$LB("""_%compiledclass.Properties.GetAt(i).Name_""","""_%compil edclass.Properties.GetAt(i).Type_""","""_%compiledclass.Properties.GetAt(i). Collection_""")")

 s:inLoop=0 inLoop=1
 }
 }
 d:inLoop=1 %code.WriteLine(")")
 Do %code.WriteLine(" q propList")
 Quit $$$OK
}

This creates a method in the class that will return a list of lists
containing the name, type, and collection of all the properties in the
class. You could then loop through the list, or change the code to
return an array of just the names, etc.

s list=##class(MY.Class).classProps()
for X=1:1:$LL(list) {
w "Prop name"_$LG($LG(list,X),1)
w "Prop type"_$LG($LG(list,X),2)
w "Prop collection"_$LG($LG(list,X),2)
}

Ben Taylor
MPLNet, Inc.
[EMAIL PROTECTED]

Ralf Huwald wrote:

Hi!

Is there a class or method, which i can use to get a list of all

properties

of a given clasS?
I am looking for something like:

s class="TEST"
s property=""
f  s property=##class(x.y).%Next(class,property) q:property=""  d
.d xyz

Or is there a global, where all of the class-definition is stored?!?

Ralf








Reply via email to