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

NextPrevUpTopContentsIndex

define-field-accessor

Macro
Summary

Defines a Java field accessor.

Package

lw-ji

Signature

define-field-accessor name class-name field-name static-p &optional is-final => name

Arguments

name

A symbol.

class-name

A string.

field-name

A string.

static-p

A boolean.

is-final

A boolean.

Values

name

A symbol.

Description

The macro define-field-accessor defines a field accessor for a field in a Java class.

The arguments are interpreted as by setup-field-accessor.

Unlike setup-field-accessor, define-field-accessor does not look up anything. The accessor does the look up first time it is called, and signals an error if something failed. This error should be of type:

java-class-error

Failed to find the class.

java-field-error

Failed to find the field, or found the field but wrong static-p value.

field-access-exception

Got an exception trying to access the field.

Notes
  1. In general, accessing fields should be avoided, because they are typically a less well-defined and implemented interface than methods, but sometimes it is necessary.
  2. The importing interface generates appropriate define-field-accessor forms for public fields.
See also

setup-field-accessor


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex