com.danielsomerfield.cvecheck.scratch.ScratchMain.groovy Maven / Gradle / Ivy
package com.danielsomerfield.cvecheck.scratch
class ScratchMain {
public static void main(String [] args) {
println("ScratchMain.main()")
new ScratchMain().run()
}
def configure(Closure closure) {
println(closure.dump())
ScratchConfig config = new ScratchConfig()
println("Pre closure: " + config.dump())
closure.resolveStrategy = Closure.DELEGATE_FIRST
closure.setDelegate(config)
closure()
println("Post closure: " + config.dump())
}
def run(){
configure {
foo {
}
foo {
}
}
}
public static class ScratchConfig {
def foo(Closure closure) {
println("ScratchConfig.foo")
}
}
}