The function create-java-object
invokes the Java constructor for the class class-name with the supplied args.
class-name must specify a Java class. create-java-object
first uses class-name to lookup a caller, and if that fails it produces a caller in the same way that define-java-constructor and setup-java-constructor do and caches it. It then uses the caller to call the constructor with args, and returns the result.
The process of actual calling is the same as in ordinary Java callers defined by define-java-constructor. See the entry for define-java-constructor for details.
If the string is incorrect (that is, it does not look like a Java class name or the class cannot be found), create-java-object
signals an error of type create-java-object-error, which reports the actual failure.
create-java-object
needs to lookup the caller using the string, so the call is slightly slower than calls for ordinary Java constructors, but the different is not significant. It also has to keep some extra code that can be shaken out if only define-java-constructor is used, but not much. If you find it convenient, there is no reason not to use it.
LispWorks User Guide and Reference Manual - 13 Feb 2015