WebSphere Message Service Client for C/C++, Version 2.0.2 Operating Systems: AIX, Linux, Solaris, 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. Many rules govern which conversions are supported and how XMS performs the conversions.

A property of an object has a name and a value; the value has an associated data type, where 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 calls the method that is appropriate for the property type. For example, to get the value of an integer property, an application typically 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 following general rules govern the supported conversions:
The following rules apply when a property value is converted from one data type to another:

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 may return an error.


Concept topic

Terms of Use | Rate this page

Last updated: 24 May 2011

(C) Copyright IBM Corporation 2005, 2011. All Rights Reserved.