5 Mar 2004 18:45
heads up: default parameter values
In CVS HEAD we can now use default parameter values on methods. This
basically adds helper methods at the bytecode level so that the default
parameters are available to Java developers as well as groovy
developers. e.g.
class Foo {
doSomething(a, b = 'defB', c = 'defC') {
println "Called with a: ${a}, b ${b}, c ${c}"
return a + "-" + b + "-" + c
}
}
foo.doSomething("X", "Y", "Z")
foo.doSomething("X", "Y")
foo.doSomething("X")
James
-------
http://radio.weblogs.com/0112098/
RSS Feed