Dealing with the Data Types

After jCOM is configured and up and running, you'll find that the only real day-to-day programming task you'll encounter is in dealing with the data types that you send and receive from the server objects you've exposed. From a Java or COM client perspective, you'll need to reconcile between individual idiosyncrasies in the primitive data type mappings that jCOM provides.

Overall, jCOM should be given credit for providing a workable solution to a difficult problem and doing a very good job of mapping primitive and complex data types across platforms into a form familiar to programmers on either side. But as with all integration efforts, you shouldn't expect perfection. For example, a COM VariantEnumeration type is mapped to a java.lang.Enumeration in Java. COM enumerations have no equivalent to the hasMoreElements() method, so you'll have to work around this by using the nextElement method until you get a NoSuchElementException.

As an alternative, under the Server/ServerName/Connections/jCOM tab on the WebLogic Server Console, you can check Prefetch Enums. In the background, jCOM will pre-fetch the next element so that hasMoreElements() will work correctly.

See Table 33.2 for a sample of how types are mapped between COM and Java. I refer you to the J-Integra Web site documentation where you will find very useful detailed listings of all the latest type mappings: http://www.intrinsyc.com/support/j-integra/doc/. In Contents, look under Reference/Type Mapping.

Table 33.2. Late Binding Type Mapping and Coercion Early Versus Late Binding Summary
Visual Basic Variant TypeJava Primitive Type
VARIANT BOOLjava.lang.Boolean
unsigned charjava.lang.Byte
doublejava.lang.Double
floatjava.lang.Float
longjava.lang.Integer
shortjava.lang.Short
Decimaljava.math.BigDecimal
DATEjava.util.Date
BSTRjava.lang.String

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset