Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

Java.SetObjectField

Sets a field on an object.

Component Version macOS Windows Linux Server iOS SDK
Java 6.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ❌ No
MBS( "Java.SetObjectField"; JObject; FieldName; Signature; Value )   More

Parameters

Parameter Description Example
JObject The java object reference number. $j
FieldName The name of the field. "test"
Signature The java signature of the field.
This describes the data type of the field.
"I"
Value The value to use for the field. 123

Result

Returns OK or error.

Description

Sets a field on an object.
Data type is automatically detected by plugin from signature.

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

Test object field:

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

Sets various fields:

Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_boolean"; "Z"; 1)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_byte"; "B"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_byteArray"; "[B"; Java Test::TestContainer)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_char"; "C"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_charArray"; "[C"; "123")]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_double"; "D"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_float"; "F"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_int"; "I"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_long"; "J"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_short"; "S"; 123)]
Set Variable [$r; Value:MBS( "Java.SetObjectField"; $j; "property_string"; "Ljava/lang/String;"; "123")]

See also

Example Databases

This function checks for a license.

Created 2nd October 2016, last changed 18th October 2016


Java.SetContainerFileName - Java.SetStaticField

💬 Ask a question or report a problem