setup-field-accessor name class-name field-name static-p &optional is-final => result, error
The function setup-field-accessor
defines a field accessor for a field in a Java class.
class-name must name a Java class.
field-name must be a field name.
static-p specifies whether the field is static or not.
is-final specifies whether the field is final (read-only) or not.
setup-field-accessor
sets the symbol function of name to a function that reads the value of the field. If is-final is nil
, it also defines (setf
name)
as the setter.
The arguments for the getter and setter are determined by the value of static-p. If static-p is non-nil, the getter takes no arguments and the setter takes the new value. If static-p is nil
, the getter takes that object from which to get the value, and the setter gets the value and the object.
setup-field-accessor
looks up the field definition in Java, and if the definition is incorrect returns nil
and the condition as the second value.
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.
LispWorks User Guide and Reference Manual - 13 Feb 2015