Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

Harris Geospatial / Docs Center / Using IDL / Method Calls On IDL-Java Objects


Method Calls On IDL-Java Objects

Method Calls On IDL-Java Objects

When a method is called on a Java-based IDL object, the method name and arguments are passed to the IDL-Java subsystem and the Java Reflection API to construct and invoke the method call on the underlying object.

IDL handles conversion between IDL and Java data types. Any results are returned in IDL variables of the appropriate type.

As with all IDL objects, the general syntax in IDL for an underlying Java method that returns a value (known as a function method in IDL) is:

result = ObjRef->Method([Arguments])

and the general syntax in IDL for an underlying Java method that does not return a value, a void method, (known as a procedure method in IDL) is:

ObjRef->Method[, Arguments]

where ObjRef is an object reference to an instance of a dynamic subclass of the IDLjavaObject class.

Note: Besides other Java based objects, the value of an argument may be an IDL primitive type, an IDLjavaObject, or an IDL primitive type array. No complex types (structures, pointers, etc.) are supported as parameters to method calls.

What Happens When a Method Call Is Made?

When a method is called on an instance of IDLjavaObject, IDL uses the method name and arguments to construct the appropriate method calls for the underlying Java object.

From the point of view of an IDL user issuing method calls on an instance of IDLjavaObject, this process is completely transparent. IDL handles the translation when the IDL user calls the Java object’s method.

Due to case-sensitivity incompatibilities between IDL and Java, Java’s ability to overload methods, and the fact that Java might promote certain data types, the Java bridge uses an algorithm to match the IDL method name and parameters to the corresponding Java object method.

Before the algorithm starts, IDL provides a case-insensitive <METHODNAME> and a reference to the Java object. For a given object and its parent classes, the Java bridge obtains a list of all the public method names, including static methods. This algorithm performs the following steps:

  1. If the Java class has one method name matching the IDL <METHODNAME> (except for case insensitivity), this Java method name is used. At this point, signatures and overloaded functions are not taken into account.
  2. If the Java class has several method names that differ only in case and one is all uppercase, the uppercase name is used. Otherwise, the IDL-Java bridge issues an error that it has no method named <METHODNAME>.
  3. Once the method name has been determined, a promotion algorithm then matches the Java data parameters as closely as possible with the IDL parameters. Minimum data promotion from IDL to Java is preferred and only widening promotion is allowed. If no match is found, an error is issued.

Data Type Conversions

IDL and Java use different data types. IDL’s dynamic type conversion facilities handle all conversion of data types between IDL and the Java system. The data type mappings are described in IDL-Java Bridge Data Type Mapping.

For example, if the Java object has a method that requires a value of type int as an input argument, IDL would supply the value as an IDL Long. For any other IDL data type, IDL would first convert the value to an IDL Long using its normal data type conversion mechanism before passing the value to the Java object as an int.

© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us