I have the following closure: def check = {x,y,z -> some code}
Is it possible to get the parameters names("x","y","z") inside the closure? and to use it as part of the closure code
For example to print arg name and then it's value.
Thanks
I have the following closure: def check = {x,y,z -> some code}
Is it possible to get the parameters names("x","y","z") inside the closure? and to use it as part of the closure code
For example to print arg name and then it's value.
Thanks
You can use of course these parameters in closure.
def a = {a, b, c ->
a + b + c
}
assert 6 == a(1,2,3)
Second version
def a = {a, b, c ->
[a:a, b:b, c:c]
}
assert [a:1, b:2, c:3] == a(1,2,3)