Determines whether an object is an instance of a ColdFusion interface or component, or of a Java class.
Returns true if any of the following is true:
The Java object specified by the first parameter was created by using the cfobject tag or CreateObjectmethod and is an instance of a Java class that extends the class specified by the second parameter.Returns false otherwise.
Note: The isInstanceOf function returns false if the CFC specified by the object parameter does not define any functions.
IsInstanceOf(object, typeName)
ColdFusion 8: Added this function.
Parameter |
Description |
|---|---|
object |
The CFC instance or Java object that you are testing |
typeName |
The name of the interface, component, or Java class of which the object might be an instance |
For Java objects, the comparison is valid only if you created the object specified in the first parameter by using a cfobject tag or CreateObject method.
<cfscript>
output = isInstanceOf("component","c1");
output1 = isInstanceOf("java","java.system.lang");
writeoutput(output & "<br>");
writeoutput(output1);
</cfscript>
Output
NO
NO
Sign in to your account