IsObject

Description

Determines whether a value is an object.

Returns

True, if the value represents a ColdFusion object. False if the value is any other type of data, such as an integer, string, date, or struct.

Category

Syntax

IsObject(value)

See also

History

ColdFusion MX: Added this function.

Parameters

Parameter

Description

value

A value, typically the name of a variable.

Usage

This function returns False for query and XML objects.

Example

Sample Code 1: 

index.cfm

<cfscript>
       obj = new Comp()
       obj.returnsString();
       writeOutput(isObject(obj)) // Returns True
</cfscript>

Sample Code 2:

comp.cfc

component {
       static function returnsAny(){
               return "G'day world" ;
        }
       function returnsString(){
               writeOutput("Hello World");
        }
}

 

<cfscript>
    random = createObject( "java", "java.security.SecureRandom" ).getInstance("SHA1PRNG");
    writeOutput( isObject( random ) );
   example = { 'name' = 'I am a struct' };
   writeOutput( isObject( example ) );    
</cfscript>

Output

YES

NO

 Adobe

更快、更轻松地获得帮助

新用户?

Adobe MAX 2024

Adobe MAX
创意大会

10 月 14 日至 16 日迈阿密海滩及线上

Adobe MAX

创意大会

10 月 14 日至 16 日迈阿密海滩及线上

Adobe MAX 2024

Adobe MAX
创意大会

10 月 14 日至 16 日迈阿密海滩及线上

Adobe MAX

创意大会

10 月 14 日至 16 日迈阿密海滩及线上