CFLib.org – Common Function Library Project

IsCFC(objectToCheck)

Last updated October 16, 2002

author

Nathan Dintenfass

Version: 1 | Requires: CF6 | 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:

<cfscript>
	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:

/**
 * 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;		
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson