Java.GetObjectField
-------------------

Queries a field on an object.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Java](component_Java.md) | [6.5](newinversion65.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |

MBS( "Java.GetObjectField"; JObject; FieldName; Signature ) 

**MBS**( **"Java.GetObjectField";** /\* Queries a field on an object. \*/  
**$JObject**; /\* The java object reference number.e.g. $j \*/   
**$FieldName**; /\* The name of the field.e.g. "test" \*/   
**$Signature**) /\* The java signature of the field.  
This describes the data type of the field.e.g. "I" \*/ 

### 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" |

### Result

Returns value or error.

### Description

Queries a field on an object.  
Data type is automatically detected by plugin from signature.  
If you read an object value, please call [Java.Release](JavaRelease.md) later for it.  
  
Java is only available if you call [Java.Initialize](JavaInitialize.md) 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).  
  
For PDF content: If you have a DynaPDF Pro license and [DynaPDF](component_DynaPDF.md) functions initialized, this function can add previews for the PDF file on Windows and Linux. For MacOS, we make them with PDFKit.  
### Examples

Test object field:

 Set Variable \[$j ; Value:MBS ( "[Java.NewClassObject](JavaNewClassObject.md)"; "test"; "&lt;init&gt;"; "()V")\]  
Set Variable \[$r ; Value:MBS ( "[Java.SetObjectField](JavaSetObjectField.md)"; $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](JavaRelease.md)"; $j )\]  
Queries various fields:

 Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_boolean"; "Z")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_byte"; "B")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_byteArray"; "\[B")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_char"; "C")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_charArray"; "\[C")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_double"; "D")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_float"; "F")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_int"; "I")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_long"; "J")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_short"; "S")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetObjectField"; $j ; "property\_string"; "Ljava/lang/String;")\]  
### See also

- [Java.Initialize](JavaInitialize.md)
- [Java.NewClassObject](JavaNewClassObject.md)
- [Java.Release](JavaRelease.md)
- [Java.SetObjectField](JavaSetObjectField.md)

### Example Databases

- [Java/Java Example/Java Example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Java/Java%20Example/Java%20Example.shtml#4ScriptAnchor_)
- [Java/Java Tests/Java Tests](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Java/Java%20Tests/Java%20Tests.shtml#2ScriptAnchor_)

This function checks for a license.

Created 2nd October 2016 , last changed 9th November 2021

  
[Java.GetLoadedClasses](JavaGetLoadedClasses.md) - [Java.GetStaticField](JavaGetStaticField.md)

[HTML Version](JavaGetObjectField.shtml)