IsObject

Determines whether a value is an object.

True conditions are:

  • Box Class instances are "objects"

  • All other classes that represent a Boxlang type are NOT "objects" (query, array, struct, XML, etc)

  • These JDK classes which are used for "simple" BoxLang types are also not "objects" (String, Number, Boolean)

  • Every other Java class is an "object"

Method Signature

IsObject(value=[any])

Arguments

Argument
Type
Required
Description
Default

value

any

true

The value to test

Examples

isObject Example

Returns true if the parameter is a BL object. The BL object here is a Java object.

Run Example

random = createObject( "java", "java.security.SecureRandom" ).getInstance( "SHA1PRNG" );
writeOutput( isObject( random ) );

Result: true

isObject Example for Other Data Types

Returns false if the parameter is any data type other than a BL object

Run Example

example = { 
	"name" : "I am a struct"
};
writeOutput( isObject( example ) );

Result: false

Additional Examples

Run Example

writeDump( label="String value", var=isObject( "Susi" ) );
writeDump( label="isObject() with array function", var=isObject( arrayNew( 1 ) ) );
writeDump( label="CreateObject in Java", var=isObject( createObject( "java", "java.util.HashMap" ) ) );
writeDump( label="CreateObject in Java with init()", var=isObject( createObject( "java", "java.lang.StringBuffer" ).init() ) );

Last updated

Was this helpful?