LOTUSSCRIPT LANGUAGE
1. Use the dot notation in JavaObject.
Dim myClass As JavaClass
Dim myObject As JavaObject
Set mySession = new JavaSession
Set myClass = mySession.getClass("myjavaapp")
Set myObject = myClass.CreateObject()
Call myObject.myMethod(arg1, arg2)
Dim myMethod as JavaMethod
Set myMethod = myClass.getMethod("MyMethod", "()V")
myMethod.Invoke(myObject);
The dot notation method is easier and more intuitive, but certain restrictions apply. The JavaMethod ADT method is significantly harder to use but is more appropriate for general use. Dot notation is ambiguous if any of the the conditions listed below occur. If they do, you can use the more general mechanism to resolve the ambiguity.
LotusScript is case insensitive while Java is case sensitive. While theoretically you can have two Java methods differ only in case -- for example, MyMethod and mymethod -- they are distinctly different methods. There is no way for LotusScript to identify the correct method to invoke using the dot notation. The result is JVM-dependent if you try to access the function; that is, the results may differ depending on what operating system you are using.
LotusScript has an internal limitation of 40 characters for names. If you use the dot notation method, you won't be able to get to methods with names longer than 40 characters.
LotusScript currently does not support method overloading. Because Java does, it is fairly common for a Java class to contain methods of the same name but with different signatures. If you use the dot notation, LotusScript uses trial-and-error to try and match the method. It is somewhat JVM-dependent, because the method that is matched depends on the order which the methods are presented to LotusScript by the JVM through JNI. The following algorithm is used to match the method:
Most Java implementations enumerate methods in the order they were declared in the Java source file. However, that is not always the case: for example, the AIX JVM seems to enumerate the method in reverse order.