WebSphere Message Service Clients for C/C++ and .NET, Version 1.2 Operating Systems: Linux, Windows

Implicit conversion of a property value from one data type to another

When an application gets the value of a property, the value can be converted by XMS into another data type. There are a number of rules that govern which conversions are supported and how XMS performs the conversions.

A property of an object has a name and a value, where the value has an associated data type. The data type of the value of a property is also referred to as the property type.

An application uses the methods of the PropertyContext class to get and set the properties of objects. In order to get the value of a property, an application normally calls the method that is appropriate for the property type. For example, to get the value of an integer property, an application normally calls the Get Integer Property method.

However, when an application gets the value of a property, the value can be converted by XMS into another data type. For example, to get the value of an integer property, an application can call the Get String Property method, which returns the value of the property as a string. The conversions supported by XMS are shown in Table 1.

Table 1. Supported conversions from a property type to other data types
Property type Supported target data types
String xmsBOOL, xmsDOUBLE, xmsFLOAT, xmsINT, xmsLONG, xmsSBYTE, xmsSHORT
xmsBOOL String, xmsSBYTE, xmsINT, xmsLONG, xmsSHORT
xmsCHAR String
xmsDOUBLE String
xmsFLOAT String, xmsDOUBLE
xmsINT String, xmsLONG
xmsLONG String
xmsSBYTE String, xmsINT, xmsLONG, xmsSHORT
xmsSBYTE array String
xmsSHORT String, xmsINT, xmsLONG
The general rules governing the supported conversions are as follows:
The specific rules for converting a property value from one data type to another are as follows:

Conversions from a property type to other data types are supported by the methods of both the Property and the PropertyContext classes. However, the C functions xmsPropertyGetStringByRef() and xmsGetStringPropertyByRef() make no attempt to convert a property value that is not a string. If an application calls either of these functions to get a pointer to a property value that is not a string, XMS returns error code XMS_E_TYPE_CONVERSION_FAILED.

Related reference
Map messages
Stream messages

Concept topic

Terms of Use | Rate this page

Last updated: 7 Dec 2005

© Copyright IBM Corporation 2005. All Rights Reserved.