JavaInvoke(ClassName,MethodName,MethodSig,Param,…)
ModuleName. Java class name in the file system or the system module name in the JNI signature. On specifying the Java class in the file system, file with the *.class extension is used.
MethodName. Executed method name
MethodSig. JNI signature of the method
Param1, Param2, …, ParamN. Parameters sent to method.
NOTE. To determine signatures in Java Native Interface (JNI) format, review the signature generation rules.
It returns result of static Java method execution.
NOTE. Before using the function, make sure that integration between Foresight Analytics Platform with Java is executed.
The function is outdated, use JavaInvokeModule.
Consider the Java code:
public class math {
public static double staticFunc(double a, double b){
return (a + b)/2;
}
}
The table contains examples of formulas using the JavaInvoke function:
| Formula | Result | Description |
| =JavaInvoke("math", "staticFunc", "(DD)D", 4.0, 2.0) | 3.0 | The staticFunc arithmetic function is executed in the class named math. Parameters of real type are specified in the function - the a variable is set to 4.0, the b variable is set to 2.0. The method returns calculation result of arithmetic function. |
| =JavaInvoke("math", "staticFunc", "(DD)D", C3, C4) | 5.0 | The staticFunc arithmetic function is executed in the class named math. Parameters of real type are specified in the function - the a variable is set to the value specified in the C3 cell, the b variable is set to the value specified in the C4 cell. Value contained in the C3 cell is 4.0, in the C4 cell - 6.0. The method returns calculation result of arithmetic function. |
See also: