Adobe COLDFUSION 9 Manual page 1145

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Under most situations, when the method names are not ambiguous, ColdFusion can determine the data types that a
Java object requires, and often it can convert ColdFusion data to the required types. For example, ColdFusion text
strings are implicitly converted to the Java String type. Similarly, if a Java object contains a doIt method that expects a
parameter of type int, and CFML is issuing a doIt call with a CFML variable x that contains an integer value,
ColdFusion converts the variable x to Java int type. However, ambiguous situations can result from Java method
overloading, where a class has multiple implementations of the same method that differ only in their parameter types.
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
Integer
Real number
Boolean
Date-time
String, including lists
Array
Structure
Query object
XML document object
ColdFusion component
The following table lists how ColdFusion converts data returned by Java methods to ColdFusion data types:
Java
boolean/Boolean
byte/Byte
char/Char
short/Short
int/Integer
long/Long
float/Float
Java
short, int, long (short and int can result in a loss of precision).
float double (float can result in a loss of precision.
boolean
java.util.Date
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).
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 data type of the Java arr: 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 could fail.
java.util.Map
java.util.Map
Not supported.
Not applicable.
CFML
Boolean
String
String
Integer
Integer
Integer
Real Number
Last updated 8/5/2010
1140

Advertisement

Table of Contents
loading

Table of Contents