Java Clients
Output ParametersCORBA includes the concept of output parameters, which are parameters that are uninitialized at the time of a call to a CORBA operation (CORBA operations map to Java methods), then initialized by the operation, and returned to the caller. Many IOM objects have operations that use output parameters. Unfortunately, the concept of output parameters does not map well into Java. In Java method calls, parameters of primitive types are always passed by value and parameters of reference types are always passed by reference. In general, only the member variables of an object or elements of an array can be modified during a method call and returned to the caller. Furthermore, some objects are immutable, which means their members cannot be changed after the objects are constructed. Java CORBA programmers need a general way to use both primitive types and reference types for output parameters in method calls on Java CORBA stubs.
For this purpose, each data type that can be used for an output parameter in
a method call on a Java CORBA stub is associated with a
The value of the member variable in a
CORBA also includes the concept of update parameters, which are
parameters that are initialized by the caller of a CORBA operation, possibly
modified by the operation, and returned to the caller. In Java CORBA stubs,
As an example, here is the definition of the class final public class IntHolder { public int value; public IntHolder() { } public IntHolder(int initial) { value = initial; } }
The following example shows how the org.omg.CORBA.IntHolder intHolder = new org.omg.CORBA.IntHolder(); myApplication.myMethod(intHolder); int intValue = intHolder.value;
The language service example shows a more practical
use of |