interestingly, I managed to do it through some obscure way:
in someMethod:
closure.class.declaredFields*.name.findAll { it ==~ /^[^_$].+/ }.each {
actions.@"$it"= new Reference(&myValidatorMethod)
}
which finds all local variables within the closure and changes their binding
to my validator method, so any calls that match the local variables names
will get handled by validator and anything else - by methodMissing.
Anybody can suggest a better solution?
--
View this message in context: http://groovy.329449.n5.nabble.com/Bypassing-local-variables-in-a-closure-tp5726326p5726327.html
Sent from the Groovy Users mailing list archive at Nabble.com.
|