Invoke(MethodName: String, MethodSig: String, Params: Array): Variant;
MethodName. Name of executed method. Parameter value is case sensitive.
MethodSig. JNI signature of method
Params. Array of parameter values sent to method.
The Invoke method executes method for Java class instance and returns result of its work.
To execute the method, make sure that the file with the *.class extension is located at the path specified using the Options string parameter in the registry key [HKEY_CURRENT_USER\SOFTWARE\Foresight\Foresight Analytics Platform\10.0\DevEnv\Java]. For details see the Connecting External Modules to Foresight Analytics Platform section.
To get a Java class in the file system and convert the file with the *.java extension to the file with the *.class extension, use the IJavaUtils.Compile method.
Executing the example requires the Test.class file. The file should be located in the file system at the specified path in the registry and should contain the compiled version of the following Java code:
public class Test {
public int nonStaticFunc(int a, int b){
return a + b;
}
}
Add a link to the Java system assembly.
Sub UserProc;
Var
Cls: IJavaClass;
ObjCls: IJavaClassObject;
Result: Variant;
Begin
Cls := New JavaClass.Create("Test");
ObjCls := Cls.CreateObject("()V");
Result := ObjCls.Invoke("nonStaticFunc", "(II)I", 7, 8);
Debug.WriteLine(Result);
End Sub UserProc;
After executing the example, an instance of Java class will be created. The function that executes mathematical calculation based on the values sent in parameters will be executed for this class. The function execution result will be displayed in the development environment console.
See also: