| 221 | |
| 222 | === Function JCOERCE === |
| 223 | |
| 224 | ''Syntax:''' |
| 225 | |
| 226 | '''jcoerce''' ''value intended-class'' |
| 227 | |
| 228 | '''Arguments and Values:''' |
| 229 | |
| 230 | `value` -- an arbitrary Common Lisp data item |
| 231 | |
| 232 | `intended-class` -- string naming a kind of `java-object` |
| 233 | |
| 234 | '''Description:''' |
| 235 | |
| 236 | Returns `java-object` of the appropriate type, if it can. Otherwise raises a `TYPE-ERROR`. A primary purpose of this function is to translate lisp data items into Java primitives so that Java methods with primitive type arguments can be used. |
| 237 | |
| 238 | '''Examples:''' |
| 239 | |
| 240 | `(jcoerce 1.0d0 "double") => #<java.lang.Double 1.0 {13424219}>` |
| 241 | |
| 242 | ` (multiple-value-list (ignore-errors (jcoerce 1.0d0 "int"))) => (NIL #<TYPE-ERROR {236312F7}>)` |