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


create-instance-jobject Functions


Construct a jobject for a CLOS instance.




create-instance-jobject-list instance args => jobject

create-instance-jobject instance &rest args

An instance of a subclass of standard-java-object.
A list or t.

The functions create-instance-jobject-list and create-instance-jobject construct a jobject for the CLOS instance instance and set its slot to that jobject.

The type of instance (that is, the class name of its class) must have been associated with a Java constructor by passing it as the class-symbol argument to define-java-constructor or setup-java-constructor.

create-instance-jobject just calls create-instance-jobject-list with instance and args.

create-instance-jobject-list constructs the jobject using args. args can be either the list of arguments for the constructor (the list may be nil), or t, in which case create-instance-jobject-list uses default-constructor-arguments to create a list of arguments and uses it instead. The Java constructor is called in the same way that it would be called by the caller that is defined by define-java-constructor. See define-java-constructor for details of calling. The result of the construction is stored in instance and is returned.

  1. The importing interface, when defining a class, automatically generates the define-java-constructor form passing it the class-symbol argument. define-java-constructor also defines a caller for the constructor, which can be used independently. create-instance-jobject-list and create-instance-jobject do not actually call it, but share information with it.
  2. create-instance-jobject-list and create-instance-jobject ignore the current jobject in instance, if there is one. There is no problem calling create-instance-jobject-list and create-instance-jobject repeatedly on the same instance.
See also


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