Call a Java method on a jobject.
lw-ji
jobject-call-method jobject method-name &rest args => result-of-java-method
jobject⇩ |
A Java object (a jobject or an instance of standard-java-object). |
method-name⇩ |
A string naming a Java method. |
args⇩ |
Arguments for the Java method named by method-name. |
result-of-java-method |
The result of calling method-name. |
The function jobject-call-method
looks up the non-static Java method named method-name that is applicable to jobject, and then calls it with jobject and args.
method-name must be the unqualified name of the method, that is without the package and class name. For example, if you have a jobject of class java.io.File
, you can check if the file actually exists by calling:
(jobject-call-method jobject "exists")
If jobject-call-method
does not find the method named by method-name, it signals an error of type jobject-call-method-error.
For static methods, use call-java-static-method.
jobject-call-method
is the natural match to the way method calls look in Java syntax, but it is a little slower than call-java-method, because the lookup is more complex. The difference is probably not significant in most of the case, and in most of the cases it is better to use jobject-call-method
.
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:46