Parameter signatures are used by the JNI functions to get the method ID of a method in a Java class so that it can be called by non-Java programs. Two examples are "(I)I" and "(Z)Z". The first one describes a Java method taking an int parameter and returning an int value. The second is a Java method taking a boolean parameter and returning a boolean value. For a Java method like this:
int MyJavaMethod( boolean param1, int param2, long param3, double param4)
The signature would look like this:
(ZIJD)I.
The return value comes last after the close parenthesis. "Z" was chosen to represent boolean because "B" is used to describe a byte data value. The topic Supported Parameter Types shows a list of the parameter types supported by ACUCOBOL-GT. An "L" represents some object type. "J" is used for longs. Everything else in Java is an object (strings, arrays, etc.), and the signatures look like this:
| Object Types | Signature |
|---|---|
| String | Ljava/lang/String |
| Object | Ljava/lang/Object |
| Array of strings | [Ljava/lang/String |
Example syntax is shown in the following table:
| Signature | Description |
|---|---|
| ()V | Java-defined void method taking no parameters |
| (Z)I | Takes boolean, returns int |
| (ZISDJ)Z | Takes boolean, int, short, double, long, returns boolean |
| (B[J[I)X | Takes byte, long array, int array, returns string |
| (XLjava/lang/Object;)Ljava/lang/String; | Takes string, object, returns string |
| (C)C | Takes char, returns char |