|
IDL Connectivity Bridges: Using Java Objects in IDL |
|
Property names and arguments are also passed to the IDL Java subsystem and are used in conjunction with the Java Reflection API to construct and access public data members on the underlying object. These public data members (known as properties in IDL) are identified through arguments to the GetProperty and SetProperty methods. See Getting and Setting Properties for more information.
| Note Only public data members may be accessed. |
Due to case-sensitivity incompatibilities between IDL and Java and the fact that Java might promote certain data types, the Java bridge uses an algorithm to match the IDL properties name to the corresponding Java object data members.
Before the algorithm starts, IDL provides a case-insensitive <PROPERTYNAME> and a reference to the Java object. For the given object and its parent classes, the Java bridge obtains a list of all the public data members including static members. This algorithm performs the following steps:
When retrieving a property with the GetProperty method, this step is skipped and the value is returned to IDL.
| Example Code See the allprops.pro and publicmembers.pro files in the resource/bridges/import/java/examples directory of the IDL distribution for IDL routines that provide information about data members associated with given Java classes. |
The IDL-Java bridge follows the standard IDL property interface to support data member access on Java objects and classes.
To retrieve a property value from a Java object, use the following syntax:
ObjRef->GetProperty, PROPERTY=variable
where ObjRef is an instance of IDLjavaObject that encapsulates the Java object, PROPERTY is the name of the Java object's data member (property), and variable is the name of an IDL variable that will contain the retrieved property value.
To retrieve multiple property values in a single statement supply multiple PROPERTY=variable pairs separated by commas.
To set a property value on a Java object, use the following syntax:
ObjRef->SetProperty, Property=value
where ObjRef is an instance of IDLjavaObject that encapsulates the Java object, PROPERTY is the name of the Java object's data member, and value is value of the property to be set.
To set multiple property values in a single statement supply multiple PROPERTY=value pairs separated by commas.
| Note The provided PROPERTY must map directly to a data member name. Any name passed into either of the property routines is assumed to be a fully qualified Java property name. As such, the partial property name functionality provided by IDL is not valid with IDL Java based objects. |
The variable or value part may be an IDL primitive type, an instance of IDLJavaObject, or an array of an IDL primitive type. See IDL-Java Bridge Data Type Mapping for more information.
| Note Besides other Java-based objects, no complex types (structures, pointers, etc.) are supported as parameters to property calls. |
IDL Online Help (March 06, 2007)