Value Type Declarations

Value types are a new IDL construct introduced when Objects-By-Value was adopted in the CORBA specification, for Version 2.3. Prior to the adoption of Objects-By-Value, there were two argument passing semantics available in IDL. Interface types were passed by reference, and basic data types were passed by value. But there wasn’t any way to pass an object by value between remote agents, in the way that Java serialization provides when using Java RMI. The CORBA Objects-By-Value specification extends IDL to include a new entity, called a value type, that is similar in syntax to an interface or a struct.

Value types are declared using the valuetype IDL keyword:

valuetype Coord3DVal { ... };

Any entity declared as a valuetype is passed by value when used as the argument to an operation. In other words, the servant of the operation receives a copy of the entity, not a remote reference to the entity residing on the caller, as is the normal case for IDL interfaces.

Value types can be declared with a custom modifier, which indicates that it will use custom marshalling code provided by the developer in an implementation class:

custom valuetype Coord3DValCustom { ... };

This modifier alters the nature of the generated “native” code, as described in the next section.

Value types can also inherit other value types, which have similar semantics as interface inheritance: the value type inherits all of the attributes, operations, state members, and initializers of its parent(s). ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.