Java Example of Passing anys

Java mapping maps the IDL type any to the Java class org.omg.CORBA.Any. There are two styles of access to CORBA.Any when inserting or extracting data: the API for built-in types and the API for user-defined types.

Insertion or extraction of built-in types is performed by invoking methods directly on CORBA.Any. For example, the IDL type long is inserted and extracted using the following methods:

// Java
void org.omg.CORBA.Any.insert_long(int l)
int org.omg.CORBA.Any.extract_long()

Insertion or extraction of user-defined types is performed by invoking methods defined on the Helper classes. For example, an IDL user-defined struct called Foo would be inserted and extracted using the following methods:

// Java void FooHelper.insert(org.omg.CORBA.Any ...

Get Pure CORBA now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.