LOTUSSCRIPT LANGUAGE
Basic data types
The basic data types are mapped between LotusScript and Java automatically.
long
Which data type is used depends on what the Java code expects as a type.
Note The Java byte type is signed (range -128 to +127), but the LotusScript Byte type is unsigned (range 0 to +255).
Java byte values of -128 to -1 map to LotusScript Byte values of +128 to +255. Java byte values of 0 to +127 map to the same LotusScript values, 0 to +127.
About Java precision and the long data type
The Java long data type range is:
min -2^63 == -9,223,372,036,854,775,808 == approx. -9.22337203685478E+18
max +2^63 - 1 == +9,223,372,036,854,775,807 == approx. +9.22337203685478E+18
However, because of a lack of precision in floating-point types, LS2J supports only a smaller range of approximately:
+- 9,223,372,036,854,770,000 == +- 9.22337203685477E+18
This range varies slightly by platform. LS2J throws an "Expression out of range" error if a LotusScript value outside these limits is passed to a Java long data type.
Even within the supported range, only 15 digits of precision are available; that is, a Java long data type will map to a predictable integral LotusScript value only within the range:
+- 1,000,000,000,000,000 == +- 1.0E+15
String mapping example
LSStrings.java:
{
public char F1;
public char [] F2;
public String F3;
public char M1(char p) { return p; }
public char [] M2(char [] p) { return p; }
public String M3(String p) { return p; }
}
LSStrings.lss:
Uselsx "*javacon"
Dim mySession As JavaSession
Sub Initialize
Dim myClass As JavaClass, myObject As JavaObject, s1 As String, _
s2 As String, s3 As String
s1 = "A"
s2 = "BC"
s3 = "DE"
Set mySession = New JavaSession ("\LSI\test\java;")
Set myClass = mySession.GetClass("LSStrings;")
Set myObject = myClass.CreateObject
myObject.F1 = s1
myObject.F2 = s2
myObject.F3 = s3
MsgBox myObject.F1 & myObject.F2 & myObject.F3 & _ myObject.M1(s1) & myObject.M2(s2) & myObject.M3(s3)
' Displays "ABCDEABCDE"
End Sub
The Java reference types have limited support:
print myObject.toString().toCharArray()
LS2J dynamically adapts the Java/lang/String class then binds to the toCharArray method. The toCharArray method returns a char[], which is automatically translated into a LotusScript string.
You can pass all primitive types and Java objects directly as arguments to JavaMethods. For reference types, LotusScript does not yet support the call-by-reference semantics. You can pass single dimension arrays into a Java method, but the results are not copied back into the LotusScript space. LotusScript also does not yet support passing in arrays of Java objects.
Limitations
Some important limitations include: