Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   7.6    Statistic  

Java.CallObjectMethod

Calls a method on an object.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Java 6.5 Yes Yes Yes Yes No

MBS( "Java.CallObjectMethod"; JObject; MethodName; Signature { ; Params } )

Parameters

Parameter Description Example value
JObject The java object reference number. $j
MethodName The name of the method. "test"
Signature The java signature of the method.
This describes the parameter types.
Please use "javap -s test.class" with file path to class file to show the signature for a class.
"[]"
Params Optional
The parameters to pass.
Pass one parameter in FileMaker for each parameter to pass.

Result

Returns OK or error.

Description

Calls a method on an object.
Parameters and return type is detected by plugin automatically from signature.
Please call later Java.Release to release an object if this function returns one.

Java is only available if you call Java.Initialize before to load the java runtime.
Supported data types include: void, int, long, boolean, string, double, float, char, byte, object, byte array (for container), char array (using FileMaker text).

Examples

Init a class and a call a merthod:

Set Variable [$j; Value:MBS( "Java.NewClassObject"; "test"; "<init>"; "()V")]
Set Variable [$r; Value:MBS( "Java.CallObjectMethod"; $j; "getValue"; "()I" )]
Show Custom Dialog ["value"; $r]
Set Variable [$r; Value:MBS( "Java.Release"; $j)]

Call method passing parameter and another to query:

Set Variable [$j; Value:MBS( "Java.NewClassObject"; "test"; "<init>"; "()V")]
Set Variable [$r; Value:MBS( "Java.CallObjectMethod"; $j; "setValue"; "(I)V"; 1234 )]
Set Variable [$r; Value:MBS( "Java.CallObjectMethod"; $j; "getValue"; "()I")]
Show Custom Dialog ["value"; $r]
Set Variable [$r; Value:MBS( "Java.Release"; $j)]

Call a void method

// public void DoSomething()
Set Variable [$r; Value:MBS( "Java.CallObjectMethod"; $j; "DoSomething"; "()V" )]

See also

Example Databases


JSON.SetPathItem   -   Java.CallStaticMethod

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos