JavaCast (type, variable) DescriptionConverts the data type of a ColdFusion variable to pass as an argument to an overloaded method of a Java object. Use only for scalar and string arguments. Can convert to the following types: Boolean, int, long, double, string. ExampleWithin ColdFusion, you use the following code: <cfobject type = java CLASS = fooClass name = obj> <!--- ColdFusion may treat this as a string or a real number ---> <cfset x = 33> <!--- Perform an explicit cast to an int. ---> <cfset myInt = JavaCast("int", x)> <cfset void = fooMethod(myInt)> <!--- Perform an explicit cast to a string. ---> <cfset myString = javaCast("String", x)> <cfset void = fooMethod(myString)> </cfobject> |