java-field-class-name-for-setting
checked-read-java-field full-field-name &optional object => field-value-or-nil, nil-or-condition
The functions read-java-field
, checked-read-java-field
and set-java-field
access the value of a field in a Java Object or a static field.
The functions check-java-field
and java-field-class-name-for-setting
are used to check whether it is possible to access the value of the field.
full-field-name needs to be a full field name including the package and class, for example "java.io.File.separator"
.
If object is supplied and is non-nil, it must be a Java object from which to read/to which set the value. The field must be non-static in this case. If object is nil
, the field must be static.
read-java-field
returns the value of the field. If it fails to get it, it signals an error. If the class is not found, this is a java-class-error, if the field is not found it is a java-field-error.
checked-read-java-field
returns the value like read-java-field
and another value which is nil
when the read is successful. If the class or the field is not found, checked-read-java-field
returns nil
and a condition specifying the error (java-field-error or java-class-error). Note that it may still signal other errors, for example if full-field-name does not look like a proper field name.
set-java-field
sets the field to the value. value must be of an acceptable type (see Types and conversion between Lisp and Java) and the field must not be final, otherwise it signals java-field-setting-error.
check-java-field
checks whether the field exists and matches the value of static-p, and returns a boolean result accordingly.
java-field-class-name-for-setting
checks whether the field exists and matches the value of static-p and whether it is not final, and if it is returns the class name of the field. It returns nil
otherwise. java-field-class-name-for-setting
is useful for checking whether set-java-field
can be used on a a field, and whether a value is suitable to be stored in his field, by using jobject-of-class-p.
It is also possible to access fields using accessors defined by define-field-accessor and setup-field-accessor.
java-field-error
java-class-error
java-field-setting-error
define-field-accessor
setup-field-accessor
Java interface
LispWorks User Guide and Reference Manual - 13 Feb 2015