getComponentProps(object)
Last updated September 21, 2010
Version: 3 | Requires: ColdFusion MX | Library: DataManipulationLib
Description:
Pass in the result from getMetaData() and returns all properties within the cfc and those it extends. It is recursive. (I didn't find any true time difference and this seemed cleaner). This does not include the base 'component' tag in it's search. I couldn't see anyone putting properties there anyways. A special value will be added to each propery, foundIn, that represents which CFC a property was found in. This is useful in case both a child and parent CFC share the same property.
Return Values:
Returns an array of structs.
Example:
<cfset dummyArray = getComponentProps( getMetaData( whatever ))>
<cfdump var="#dummyArray#" />
Parameters:
| Name | Description | Required |
|---|---|---|
| object | The metadata from a component. | Yes |
Full UDF Source:
<cfscript>
/**
* Returns an array of all properties in cfc's metadata, inherited or not.
* v2 was submitted by salvatore fusto
* v3 ditto
*
* @param object The metadata from a component. (Required)
* @return Returns an array of structs.
* @author Robby Lansaw (robby@ohsogooey.com)
* @version 3, September 21, 2010
*/
function getComponentProps(object) {
var propArray = arrayNew(1);
if (structKeyExists(object,'properties')) {
propArray = object.properties
}
if (structKeyExists(object,'extends')) {
propArray.addAll(getComponentProps(object.extends ))
}
return propArray;
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)