OPCFoundation / UA-Java-Legacy

This repository is provided by OPC Foundation as legacy support for an Java version for OPC UA.
https://github.com/OPCFoundation/UA-.NETStandard
Other
355 stars 227 forks source link

Variant does not support primitive arrays #120

Open jouniaro opened 6 years ago

jouniaro commented 6 years ago

In some cases it would be much more performant to use primitive arrays (int[], double[], etc.) instead of object arrays (Integer[], etc.) in Variant. Currently Variant does not accept primitive types even for arrays, to keep things simple, but this optimisation would be possible. The main question is what should BinaryDecoder do with these: which ones should it decode by default?

The confusion may arise, if Variant.compositeClass() gives Integer.class for scalar values, but int.class for the respective arrays, even though the UA DataType for the variables is the same (Int32).

jouniaro commented 6 years ago

Probably best would be to keep this optional, especially the BinaryDecoder part, so that the application developer can choose which array alternatives are provided by the stack.