toPrimitiveInt()

Converts an object or primitive data type to the primitive int data type.

Syntax

int toPrimitiveInteger(Object objectData)
 int toPrimitiveInteger(float floatData)
 int toPrimitiveInteger(double doubleData)
 

Parameters

objectData
A Java object. The objects currently supported are: Double, Float, Integer, and String.
floatData
Any primitive float variable.
doubleData
Any primitive double variable.

Return values

Returns a primitive int value.

Exceptions

DtpIncompatibleFormatException - If the source data type cannot be converted to integer.

Examples

int myInt = DtpDataConversion.toPrimitiveInt(myObject);
 

See also

getType(), isOKToConvert(), toInteger()

Copyright IBM Corp. 2003