The Java Language to IDL specification maps Java serializable objects to CORBA value types. Therefore every Java serializable object to be passed by a CORBA client as a parameter or return value for an enterprise bean must be reimplemented in the language of the client. Implementation of Java serializable objects as value types in C++ or another language can be a significant development effort.
To aid application development, WebSphere Application Server provides a valuetype library that contains C++ valuetype implementations for some commonly used Java classes in the java.lang, java.io, java.util, javax.ejb, java.sql, and java.math packages, for example, Integer, Float, Vector, Exception, OutputStream, and so on. The valuetype library supports the WebSphere C++ Object Request Broker (ORB).
These classes represent an established hierarchy in the Java language and are implemented to preserve the inheritance relationship that exists in certain Java packages. These classes enable CORBA programmers to use the WebSphere C++ classes in the same way they use their Java counterparts. Constructors in the original Java classes do not need to be mapped to the IDL definitions and the C++ bindings. When mapped, constructors become create (or init) methods on the factory classes.
The IDL compiler always provides a pointer type definition for each type. For example, for a valuetype class T, the pointer type definition is typedef T * T_ptr. Unlike mapping for interfaces, the reference counting for valuetype must be implemented by the instance of the valuetypes. The IDL compiler also generates a _var class, which you can use instead of the _ptr. The _var class for a valuetype automates the reference counting, that is, it automatically manages the memory associated with the dynamically allocated object reference. When the T_var object is deleted, the object associated with T_ptr is released. When a T_var object is assigned a new value, the old object reference pointed to by T_ptr is released after the assignment takes place. A casting operator also is provided to enable you to assign a T_var to a type T_ptr.