All Manuals > LispWorks® User Guide and Reference Manual > 39 The LW-JI Package

create-instance-from-jobject Function

Summary

Create a CLOS instance based on a jobject.

Package

lw-ji

Signature

create-instance-from-jobject jobject &optional errorp => instance

Arguments
jobject
errorp
A generalized boolean.
Values
instance
A CLOS object.
Description

The function create-instance-from-jobject creates a CLOS instance based on the jobject jobject.

jobject must be a jobject. Its class name (that is, the result of jobject-class-name) must have been associated with the name of a CLOS subclass of standard-java-object using record-java-class-lisp-symbol (the importing interface, when defining a class, does it automatically).

create-instance-from-jobject uses the record to find the class, and makes the CLOS instance by calling make-instance, passing it jobject.

The result is an instance of the CLOS class, which can be passed to Java interface functions and Java methods.

If create-instance-from-jobject fails to find the CLOS class it signals an error if errorp is non-nil, otherwise it returns nil. The default value of errorp is true.

See also

record-java-class-lisp-symbol
15.8 CLOS partial integration


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:46