Finding out a Property's type from it's Class Instance
Posted: Fri Aug 07, 2009 2:59 pm
by Roland Pope >> Tue, 25 Nov 2008 22:45:29 GMT
Hi all,
I am trying to create a generic update audit mechanism to record changes made to certain objects. When an object is updated by a transaction agent, I go through the properties on the Object being updated and compare them to old values and record the changes.
class :=app.getSchema.getClass("MySchema);
foreach property in class.getProperties() do
//record changes to this property if need be
endforeach;
My question is "Given a 'Property', how do I work out what 'Kind' of property it is? Eg. a String, Boolean, Array etc".
I know can do a 'any := object.getPropertyValue(property.name)' then do an 'any.isKindOf('Type')' check, but this only works if the object in question has a Non-Null value for the property?
So stated another way, "How do I work out a property's type if the instance of the object has a null value for the property?"
Thanks
Roland
Hi all,
I am trying to create a generic update audit mechanism to record changes made to certain objects. When an object is updated by a transaction agent, I go through the properties on the Object being updated and compare them to old values and record the changes.
class :=app.getSchema.getClass("MySchema);
foreach property in class.getProperties() do
//record changes to this property if need be
endforeach;
My question is "Given a 'Property', how do I work out what 'Kind' of property it is? Eg. a String, Boolean, Array etc".
I know can do a 'any := object.getPropertyValue(property.name)' then do an 'any.isKindOf('Type')' check, but this only works if the object in question has a Non-Null value for the property?
So stated another way, "How do I work out a property's type if the instance of the object has a null value for the property?"
Thanks
Roland