Groovy web console

subscribe to the feed Subscribe
to this
site
Script (via #groovywebconsole)
tweet this snippet Tweet
this
script

Script

Published 2 years ago by Filirom1
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def aClosure = { String name ->

  println "hi "+name
  sayHello()
  println wro4j

}

aClosure.delegate = new MyClass()
aClosure.resolveStrategy = Closure.DELEGATE_FIRST

def result = aClosure("Toto")

class MyClass{

  String wro4j = "Wro4J rocks !!!" 

  void sayHello(){
    println "Hello"
  }

}