Groovy web console

subscribe to the feed Subscribe
to this
site
DSL for declaring type (via #groovywebconsole)
tweet this snippet Tweet
this
script

DSL for declaring type

Published 6 months ago by ajkerchum
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
Closure closure = {
    thingy String
}

class Intro {
    Intro(Closure c) {
        c.delegate = this
        c.call()
        println this.class.declaredFields
    }
    @Override    
    Object invokeMethod(String name, Object args) {
        println "Variable with name: ${name}, and class: ${args[0]}"
    }
}

new Intro(closure)