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.
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
example = {
"name" : "I am a struct"
};
writeOutput( isObject( example ) );
Result: false
Additional Examples
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() ) );
Related
Last updated
Was this helpful?