Using Value-Type and Reference-Type Arrays
With Javonet, you can use any value-type or reference-type arrays. Arrays can be retrieved from field or property values, returned as method invocation results, or passed as arguments or set to fields and properties. All array operations can be performed both on instance and static elements.
Using arrays is very simple. Value-typed arrays are translated into regular arrays of corresponding Java types. Reference-typed arrays are represented as array of NObject/JObject objects.
Assuming we have a custom JAR library with the following class inside:
To use method from this class in Java:
Java
Starting with version 1.4hf34 you can also retrieve a mixed arrays of value and reference types. In such case you will received on Java side an Object[] which will consist of NObject items and Java value types like (float, double, int, etc..).
Was this article helpful?