Xojo Conferences
MBSOct2019CologneDE
XDCMarch2020NashvilleUS

« FileMaker Magazin - M… | Home | LZ4 Extremely fast co… »

Upgrading our Java Support for Xojo


With MBS Plugin 19.4 we will include newer Java methods to make your live easier when working with Java classes in Xojo. Instead of passing arguments as memoryblock or checking which of the various methods to use, we simply use variants.

For fields, you can now use Field() or StaticField() methods to get or set the values. Values are passed as variant and we check which type is needed and do required conversions. All the normal data types should work fine this way like integers, floats, booleans or strings. You can pass/receive JavaObjectMBS and subclasses of course. And for arrays please use the JavaArrayMBS subclasses. As a convenience you can pass in Java string with a Xojo string and we create the java string for you.

For method calls, we got CallMethod, CallNonvirtualMethod and CallStaticMethod to call methods and pass arguments as array of variants. Same for NewObject method to create a new object by calling the constructor.

We add to JavaObjectMBS class:

Field(TheField as JavaFieldMBS) as Variant
CallMethod(MethodID as JavaMethodMBS, args() as Variant) as Variant
CallNonvirtualMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args() as Variant) as Variant

and to JavaClassMBS class:

StaticField(TheField as JavaFieldMBS) as Variant
NewObject(MethodID as JavaMethodMBS, args() as Variant) as JavaObjectMBS
CallStaticMethod(MethodID as JavaMethodMBS, args() as Variant) as Variant

We hope you enjoy the new freedom to not build memoryblocks for parameters and let the plugin do the heavy work. Please don't hesitate to send us questions.
06 09 19 - 19:08