| Type Params | Return Type | Name and description |
|---|---|---|
|
static void |
addImplicitConversion(Class self, Class to, Closure conversion)Adds an implicit conversion to a class's meta class to another type. |
Adds an implicit conversion to a class's meta class to another type.
// add an implicit conversion from String to Integer that uses the string length
String.addImplicitConversion(Integer) { it.length() }
assert ("foo" as Integer) == 3
self - The source class typeto - When this conversion should be usedconversion - The mechanism used to do the conversion