Contents > Developing ColdFusion MX Applications > Integrating J2EE and Java Elements in CFML Applications > Using Java objects > Java and ColdFusion data type conversions Default data type conversion PreviousNext

Default data type conversion

Whenever possible, ColdFusion automatically matches Java types to ColdFusion types.

The following table lists how ColdFusion converts ColdFusion data values to Java data types when passing arguments. The left column represents the underlying ColdFusion representation of its data. The right column indicates the Java data types into which ColdFusion can automatically convert the data:

CFML

Java

Integer

short, int, long  (short and int might result in a loss of precision).

Real number

float double  (float might result in a loss of precision.

Boolean

boolean

Date-time

java.util.Date

String, including lists

String

short, int, long, float, double, java.util.Date, when a CFML string represents a number or date.

boolean, for strings with the value Yes, No, True, and False (case-insensitive).

Array

java.util.Vector (ColdFusion Arrays are internally represented using an instance of a java.util.Vector object.)

ColdFusion can also map a CFML array to any of the following when the CFML array contains consistent data of a type that can be converted to the Java array's data type: byte[], char[], boolean[], int[], long[], float[], double[], String[], or Object[]. When a CFML array contains data of different of types, the conversion to a simple array type might fail.

Structure

java.util.Map

Query object

java.util.Map

XML document object

Not supported.

ColdFusion component

Not applicable.

The following table lists how ColdFusion converts data returned by Java methods to ColdFusion data types:

Java

CFML

boolean/Boolean

Boolean

byte/Byte

String

char/Char

String

short/Short

Integer

int/Integer

Integer

long/Long

Integer

float/Float

Real Number

double/Double

Real Number

String

String

java.util.Date

Date-time

java.util.List

Comma-delimited list

byte[]

Array

char[]

Array

boolean[]

Array

String[]

Array

java.util.Vector

Array

java.util.Map

Structure


Contents > Developing ColdFusion MX Applications > Integrating J2EE and Java Elements in CFML Applications > Using Java objects > Java and ColdFusion data type conversions Default data type conversion PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.