IsCFC(objectToCheck)
Last updated October 16, 2002
Version: 1 | Requires: ColdFusion MX | Library: DataManipulationLib
Description:
Pass it any CF variable, it returns a boolean value to tell you if it is a CFC instance.
Return Values:
Returns a boolean.
Example:
cfc = createObject("component","cflib.udf");
str = createObject("java","java.lang.String");
</cfscript>
<cfoutput>
isCFC(cfc) = #isCFC(cfc)#<br>
isCFC(str) = #isCFC(str)#<br>
isCFC(structNew()) = #isCFC(structNew())#<br>
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| objectToCheck | The object to check. | Yes |
Full UDF Source:
<cfscript>
/**
* Returns a boolean for whether a CF variable is a CFC instance.
*
* @param objectToCheck The object to check. (Required)
* @return Returns a boolean.
* @author Nathan Dintenfass (nathan@changemedia.com)
* @version 1, October 16, 2002
*/
function IsCFC(objectToCheck){
//get the meta data of the object we're inspecting
var metaData = getMetaData(arguments.objectToCheck);
//if it's an object, let's try getting the meta Data
if(isObject(arguments.objectToCheck)){
//if it has a type, and that type is "component", then it's a component
if(structKeyExists(metaData,"type") AND metaData.type is "component"){
return true;
}
}
//if we've gotten here, it must not have been a contentObject
return false;
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
4 day(s) ago
Will Belden added
longTime
9 day(s) ago
James Sleeman added
quickSort
19 day(s) ago
Ben Forta added
GetHostAddress
22 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)