J-Integra® COM to Java late binding type mapping and coercion

These tables show the Java expression used to convert a VB value 'vb' of the VB type on the left to the Java type at the top.

Note that conversions marked with a * can also raise Type Mismatch Error.

Java boolean, byte, short and int

VB/Java

boolean

byte

short

int

Boolean

natural

vb ? 1 : 0

vb ? 1 : 0

vb ? 1 : 0

Byte(0..255)

vb != 0

new Integer(vb).byteValue()

new Integer(vb).shortValue()

new Integer(vb).intValue()

Integer(16 bit)

vb != 0

new Short(vb).byteValue()

natural

new Short(vb).intValue()

Long(32 bit)

vb != 0

new Integer(vb).byteValue()

new Integer(vb).shortValue()

natural

Single

vb != 0.0F

new Float(vb).byteValue()

new Float(vb).shortValue()

new Float(vb).intValue()

Double

vb != 0.0

new Double(vb).byteValue()

new Double(vb).shortValue()

new Double(vb).intValue()

Currency(64 bit)

vb != 0

new Long(vb).byteValue()

new Long(vb).shortValue()

new Long(vb).intValue()

String

new Boolean(vb).booleanValue()

new Long(vb).byteValue()*

new Long(vb).shortValue()*

new Long(vb).intValue()*

Date

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Object

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Variant

As above depending on content

Java long, char, float and double

VB/Java

long

char

float

double

Boolean

vb ? 1 : 0

vb ? (char)1 : (char)0

vb ? 1.0F : 0.0F

vb ? 1.0 : 0.0

Byte(0..255)

new Integer(vb).longValue()

new Integer(vb).byteValue()

new Integer(vb).shortValue()

new Integer(vb).intValue()

Integer(16 bit)

new Short(vb).longValue()

new Short(vb).byteValue()

new Short(vb).shortValue()

new Short(vb).intValue()

Long(32 bit)

new Integer(vb).longValue()

new Integer(vb).byteValue()

new Integer(vb).shortValue()

new Integer(vb).intValue()

Single

new Float(vb).longValue()

new Float(vb).byteValue()

new Float(vb).shortValue()

new Float(vb).intValue()

Double

new Double(vb).longValue()

new Double(vb).byteValue()

new Double(vb).shortValue()

new Double(vb).intValue()

Currency(64 bit)

new Long(vb).longValue()

new Long(vb).byteValue()

new Long(vb).shortValue()

new Long(vb).intValue()

String

new Long(vb).longValue()

new Long(vb).byteValue()

new Long(vb).shortValue()

new Long(vb).intValue()

Date

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Type Mismatch Error

Object

Error

Error

Error

Error

Variant

As above depending on content

Java String, Date and Object

VB/Java

String

Date

Object

Boolean

natural

vb ? 1 : 0

vb ? 1 : 0

vb ? 1 : 0

Byte(0..255)

vb != 0

new Integer(vb).byteValue()

new Integer(vb).shortValue()

new Integer(vb).intValue()

Integer(16 bit)

vb != 0

new Short(vb).byteValue()

new Short(vb).shortValue()

new Short(vb).intValue()

Long(32 bit)

vb != 0

new Integer(vb).byteValue()

new Integer(vb).shortValue()

new Integer(vb).intValue()

Single

vb != 0

new Float(vb).byteValue()

new Float(vb).shortValue()

new Float(vb).intValue()

Double

vb != 0

new Double(vb).byteValue()

new Double(vb).shortValue()

new Double(vb).intValue()

Currency

vb != 0

new Long(vb).byteValue()

new Long(vb).shortValue()

new Long(vb).intValue()

String

new Boolean(vb).booleanValue()

new Long(vb).byteValue()

new Long(vb).shortValue()

new Long(vb).intValue()

Date

Error

Error

Error

Error

Object

Error

Error

Error

Error

Variant

As above depending on content

Byte ByValByte ByRef

Java

VB

Notes and converson used.

void byteMethod(byte p1)

javaObject.byteMethod(123)

integer number ByVal.
p1 = new Long(value).byteValue()

javaObject.byteMethod(12.3)

float number ByVal.
p1 = new Double(value).byteValue()

javaObject.byteMethod(false)

boolean ByVal.
If value then p1 = 1 else p1 = 0

javaObject.byteMethod("101")

String ByVal.
If value contains a '.' then p1 = new Double(value).byteValue(), else p1 = new Long(value).byteValue(). If converson error then ???

Dim byteParam as Byte
...
javaObject.byteMethod(byteParam)

Byte ByRef.
VB byte is unsigned (0..255), Java byte is signed (-127..+128).
p1 = new Integer(byteParam).byteValue()

Dim booleanParam as Boolean
...
javaObject.byteMethod(booleanParam)

Boolean ByRef.
If booleanParam then p1 = 1 else p1 = 0

Dim integerParam as Integer
...
javaObject.byteMethod(integerParam)

Integer ByRef.
VB Integer is 16 bits, Java short is 16 bits.
p1 = new Short(integerParam).byteValue()

Dim longParam as Long
...
javaObject.byteMethod(longParam)

Long ByRef.
VB Long is 32 bits, Java int is 32 bits.
p1 = new Integer(longParam).byteValue()

Dim singleParam as Single
...
javaObject.byteMethod(singleParam)

Single ByRef.

Dim doubleParam as Double
...
javaObject.byteMethod(doubleParam)

Double ByRef.

Dim currencyParam as Currency
...
javaObject.byteMethod(currencyParam)

Currency ByRef.

Dim dateParam as Date
...
javaObject.byteMethod(dateParam)

Date ByRef.

Dim stringParam as String
...
javaObject.byteMethod(stringParam)

String ByRef.