I suppose I should have also shown the type validation in the sample.
You can add the line <cfset Person1.setProp("FirstName", StructNew()) />
someplace at the end if you want to see it.
Also some decisions explained:
1) I wanted this whole thing to be "host" friendly. Many hosts (mine,
CrytalTech, included) won't let you set a "com" mapping - thus the
"CFC_DepressedPress" mapping instead. I wanted something distinct enough to
allow (if needed) a simple full search and replace to change the mapping
site-wide.
2) Since I wanted the metadata cache to be fast, but also host friendly, I
made it use the application scope if it's available and the server scope if
not. (The thinking is that most people are using the application
framework.)
3) All of the defined properties are set in the variables scope. This means
that you HAVE to use the methods to get at them. This could be changed, but
it suits my needs to have it this way.
4) All of the validation methods (for the generic set/get and the metadata)
can accept a CFC name as well - but this must be the full name as used to
instantiate the CFC (for example "CFC_DepressedPress.Test.Person" not just
"Person"). Basically you can create your "DP Properties" using all the same
type classes at the CFARGUMENT tag.
5) I've not formalized it yet (I'd like try to do a generic "clone" and
"serialize" method as well, but there's a lot to them) but you can use the
MetaData to easily loop over all of the publicly defined properties.
Oh, also: I've been working on this for a long time - so please be gentle.
;^)
Jim Davis
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]