by
allistar >> Wed, 6 Oct 2004 9:15:42 GMT
Hi Brian,
As Rob mentioned you could use an existing property such as "text". You could also define a method on the Object class called "getMetaInformation" which could have a signature like this:
getMetaInformation(propertyName: String; meta: MetaInformation input);
And if you want to get the MetaInformation for the address property on the customer class you could call it like this:
create meta transient;
customer.getMetaInformation(Customer::address, meta);
The Customer::getMetaInformation method could look like this:
vars
begin
if (property = Customer::address) then
meta.setIsExtractable(true);
meta.setIsMandatory(false)
endif;
end;
The "MetaInformation" class could have properties like:
isMandatory: Boolean;
isExportable: Boolean;
and whatever other distinguishing features you want to be able to associate with properties. You could extend this to do lots of things, such as more tightly binding database properties to fields on forms so the framework populates a form with the properties on an object instead of the developer having to code this for each form.
It is nice in JADE6 that you can access metadata like this: "Customer::address", so you don't have to worry about misspelling anything.
The disadvantage of this approach is that you need an instance of the class you want to get metadata for, although you could always create a transient instance to satisfy that.
I have used a similar approach before to write generic data export/import routines on subsets of a JADE database.
Regards,
Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst
allistar@silvermoon.co.nz
Auckland, NEW ZEALAND
Silvermoon Software
Specialising in JADE development and consulting
Visit us at:
http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at:
www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------