isInstanceOf

Determines whether an object is an instance of a Coldfusion interface or component, or of a Java class.

isInstanceOf(object, typename) → returns boolean

Argument Reference for the isInstanceOf function

object

Required: Yes
The CFC instance or Java object that you are testing

typename

Required: Yes
The name of the interface, component, or Java class of which the object might be an instance

Examples sample code invoking the isInstanceOf function


Check if Date is instance of java.util.Date

Dates in CFML are instances of the java class: java.util.Date

isInstanceOf(now(), "java.util.Date")

Expected Result: YES


Fork me on GitHub