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

NextPrevUpTopContentsIndex

create-instance-jobject-list

create-instance-jobject

Functions
Summary

Construct a jobject for a CLOS instance.

Package

lw-ji

Signature

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

create-instance-jobject instance &rest args

Arguments

instance

An instance of a subclass of standard-java-object.

args

A list or t.

Values

jobject

A jobject.

Description

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 the 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.

Notes
  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

define-java-constructor


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex