The following table summarizes the equivalent types between Scriptom and COM (VB6/VBA/.NET).
Groovy/Java |
VB6/VBA |
VB.NET |
Comments |
|---|---|---|---|
null |
Empty/Nothing |
Empty/Nothing |
|
VariantNull |
Null |
??? |
VariantNull is not the same as Java null. Use Scriptom.NULL. |
boolean |
Boolean |
Boolean |
|
byte |
Byte |
Byte/SByte |
8-bit signed or unsigned integer. 0 to 255 in the COM library. -128 to 127 in Java. Conversion happens automatically. |
short |
Integer |
Short |
16-bit signed integer. -32,768 to 32,767. |
(int) |
- |
UShort |
16-bit unsigned integer. 0 to 65,535. |
int |
Long |
Integer |
32-bit signed integer. -2,147,483,648 to 2,147,483,647. |
(long) |
- |
UInteger |
32-bit unsigned integer. 0 to 4,294,967,295. |
long |
- |
Long |
64-bit signed integer. -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. 64-bit integers are not supported by COM in Windows Millenium or Windows 2000 and earlier. |
(BigInteger) |
- |
ULong |
64-bit unsigned integer. 0 to 18,446,744,073,709,551,615. 64-bit integers are not supported by COM in Windows Millenium or Windows 2000 and earlier. |
float |
Single |
Single |
Low-precision floating point. -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values. |
double |
Double |
Double |
High-precision floating point. The range of a Double is -1.79769313486231E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values. |
BigDecimal |
- |
Decimal |
Very high-precision fixed/floating point (128 bits), but without the large mantissa values supported by Double. Scriptom supports the Currency data type by converting to and from Decimal. The range of a Decimal is +/-79,228,162,514,264,337,593,543,950,335 |
Date |
Date |
Date |
|
String |
String |
String |
|
SafeArray |
Array |
Array |
Scriptom supports multi-dimensional arrays for COM. |
ActiveXObject |
A COM-callable object |
A COM-callable object |
|
Note that implicit type conversions are supported, so you could - for instance - pass a float to a method that expects a double. COM unsigned integer types are converted to and from the equivalent Java signed types.
CAUTION: The default floating-point type in Groovy is BigDecimal, which gets converted to a COM Decimal. Although Decimal will work in the majority of cases, type conversions involving Decimal are inefficient compared to other numeric types. It is a good idea to explicitly coerce Decimal values to type Double or type Integer, whichever makes the most sense.