JavaCast()
Converts the data type of a CFML variable to pass as an argument to an overloaded method of a Java object.
Use only for scalar and string arguments.
JavaCast( type=string, variable=any, javaSettings=struct );
Returns: any
| Argument | Description |
|---|---|
|
type
string,
required
|
edit
Data type to which to convert variable: bigdecimal (converts to java.math.BigDecimal)
|
|
variable
any,
required
|
edit
the object to cast |
|
javaSettings
struct,
optional
|
edit
javasettings to use to load the class Introduced: 6.2.0.26 |
Examples
edit// Convert a ColdFusion Number to a Java double primitive
// Converts the number 180.0 degrees to radians using Java method: Math.toRadians(double degrees)
writeDump( createObject("java", "java.lang.Math").toRadians( javacast("double", 180.0) ) );
See also
- Java
- Java - Explicit Casting of a Component to a Specific Interface
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)