Generic access of Class and Property values
Posted: Fri Aug 07, 2009 2:10 pm
by JADE News Administrator >> Thu, 29 Oct 1998 4:59:20 GMT
Hi
I want to create a generic method to take a class name and a property name and then say list the values of the property for all instances of the particular class -- say, on screen using the write function.
For example, you'd call it with statements like listProp("Customer", "custCode"); or listProp("Product", "prodCode"); and then the listProp method (created somewhere like off the Object class so it can be inherited from just about everywhere) would look something like this :
listProp(cls : Class; prp : Property);
begin
foreach obj in cls.instances do
write obj.Class.prp ///--- or do I have to use getPropertyValue perhaps ?????
endforeach;
end;
thoughts on a grey day ???.
SS
Hi
I want to create a generic method to take a class name and a property name and then say list the values of the property for all instances of the particular class -- say, on screen using the write function.
For example, you'd call it with statements like listProp("Customer", "custCode"); or listProp("Product", "prodCode"); and then the listProp method (created somewhere like off the Object class so it can be inherited from just about everywhere) would look something like this :
listProp(cls : Class; prp : Property);
begin
foreach obj in cls.instances do
write obj.Class.prp ///--- or do I have to use getPropertyValue perhaps ?????
endforeach;
end;
thoughts on a grey day ???.
SS