.JavaFindMethodSignature
Find Java Methods and Fields

Description

Find public Java methods and fields for a class.

Usage

.JavaFindMethodSignature(javaClass, method, argClasses=character(0),
                         static=FALSE, stable=TRUE, mustFind=TRUE)
.JavaFindFieldSignature(javaClass, field, static=FALSE, mustFind=TRUE)

Arguments

javaClass a string specifying a full Java classname, such as "Ljava/lang/Math;". This class can also be specified as "java/lang/Math" or "java.lang.Math".
method a string naming a method within the class.
field A string naming a field within the class.
argClasses a string vector giving the Java class names for the method arguments,
static A logical. If TRUE, must produce a static method or field. If FALSE, may produce either a static or non-static method or field.
stable A logical. If TRUE, uses an algorithm that will always find the same method for a given javaClass and argClasses. If FALSE, uses an alternative algorithm that may find a better method with more argument classes closer to argClasses.
mustFind A logical. If TRUE, and a Java method or field cannot be found, an error is generated.

Details

.JavaFindMethodSignature is called by .JavaCall and .JavaNew when the SIGNATURE argument is NULL, to determine which method to call, by passing the Java classes of the specified arguments.
.JavaFindFieldSignature is called by .JavaFieldGet and .JavaFieldSet when the SIGNATURE argument is NULL, to determine the field class.
Value
.JavaFindMethodSignaturereturns a vector of strings with length one greater than the length of argClasses. This contains the Java class names for the found method's arguments, followed by the Java class of the return value. If no method is found, and mustFind is FALSE, returns NULL.
.JavaFindFieldSignaturereturns a string. If no field is found, and mustFind is FALSE, returns NULL.
See Also
.JavaCall, .JavaFieldGet, .JavaClass, .JavaRef, .JavaArray
Examples
.JavaFindMethodSignature("java.lang.Math", "pow", c("D","D"))
## [1] "D" "D" "D"

.JavaFindFieldSignature("java.lang.Math", "PI") ## [1] "D"

Package terrJava version 6.0.0-69
Package Index