Method Invocation Syntax

Previous Next

See Also

This topic describes what is needed to define the methods of Java components for RDMI. You can use the Method Lookup wizard to retrieve the method definitions from Java classes.

An imported Off the Shelf component can be used as an example of how the RDMI tables are populated. Choose Define, RDMI, J2EE from the Definer menu bar and in the resulting window you can see the syntax that physical method entries use to define the mapping for the methods of components. For calls to J2EE, this syntax is a very limited subset of the Java syntax itself:

· An RDMI method can map onto a single Java physical method in the same way that RDMI works for COM, but Java method calls always include either a class or an object reference. The syntax for the Java physical method is:

<class | object>.<physical method name>

All RDMI parameters are passed to the actual call without explicitly specifying them in the physical method (classic RDMI style). The mapping of argument types is:

· RDMI String -> Java String Object

 

· RDMI long integer-> Java Integer Object

 

· RDMI double -> Java Double Object

 

· RDMI Date -> Java Util Date Object

 

· RDMI Boolean -> Java Boolean Object

For example:

java.lang.System.getProperty()

· Arguments can be explicitly passed via a placeholder that represents the RDMI variable. The syntax is:

<class | object><physical method name>( [:n [, :m]]... )

For example:

java.lang.Integer.parseInt(:0)

parses a string in argument :0 into an integer.

· Arguments can be casted to non-RDMI compliant Java types. Syntax:

<class | object>.<physical method name>([(<cast specifier)]<argument>, ...)

For example:

java.lang.Integer.toHexString((i):0)

creates a hexadecimal representation of the integer in :0.

Here the Integer is casted to a Java native integer. Without the cast, the native method would be called with a Java Integer Object as its argument. Java would return an invalid method call

NOTE:

See "Typecasts" for more information on the use of typecasts in method invocation.

Possible type casts are specified in the typecast appendix.

Literal arguments are understood.

For example:

java.lang.Integer.toHex((i)"15")

· Return values of method calls can be assigned to transient objects instead of being returned as an RDMI result. For example:

myfile=java.lang.File.createTempFile(:0, ".txt")

The myfile object can be used during the lifetime of the RDMI object, so that, for example, another RDMI call can make the call:

myfile.exists()

· A single RDMI method can map on multiple physical methods. New lines separate the physical methods. The result passed to RDMI is the result of the last call that returns a result. For example:

myfile=java.lang.File.createTempFile(:0, ".txt")

myfile.exists()

· All arguments may be passed into an array to a call as follows:

com.usoft.connectors.JdbcTable.InsertRow(argv)

argv is mapped onto a Java Array of String objects (String[])

This syntax makes it easy to define generic components that inspect their arguments before processing them. This includes the possibility of using a variable number of arguments. For example, EAI table components can implement their QueryExe method by a physical method:

somejavacomponent.QueryExe(argv)

The somejavacomponent component, for example, processes its arguments by looping over the argument vector as in:

for (int i=0; I < argv.length; I++) process(argv[i]);