Previous Table of Contents Next


5.8 TypeMapping Metamodel

   The TypeMapping package depends on the following package: org.omg::CWM::ObjectModel::Core

   The TypeMapping package supports the mapping of data types between different systems. The purpose of these mappings is to indicate data types in different systems that are sufficiently compatible that data values can be interchanged between them. Multiple mappings are allowed between any pair of types and a means of identifying the preferred mapping is provided.

   Package


ModelElement (from Core) (from Core)

   


TypeM app ing

TypeSystem /namespace /ownedElement



   


/namespace



   mappingFrom

   mappingTo

   




   




   sourceTy pe targetTy pe

   Cl assi fi er /ownedElement


(fromCore)

   Figure 5-14 TypeMapping metamodel

    Figure 5-15 provides a simple example of the use of the TypeMapping package to map the CORBA IDL v2.2 long data type and the Java 2 int data type to each other.


   CORBAIDLv2.2 : Java2 : TypeSystem TypeSystem


ElementOwnership

   int : DataType



ElementOwnership

   ElementOwnership

   MappingTarget MappingSource

   : : TypeMappingTypeMapping

   isBestMatch = true :

   isBestMatch = true : Boolean

   Boolean

   


MappingSource

MappingTarget isLossy = false :

   isLossy = false : Boolean

   Boolean

   ElementOwnership

   long : DataType

   Figure 5-15 Mapping the CORBA IDL long and Java int data types